Date: 2020/07/12 08:48:03 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
exclamation:
type: item
material: player_head[skull_skin=8d7d24be-a6b6-44ef-a689-f7b39b00e283|eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzJmZjJlNGZkNDE0Y2FiYTU5YzI0NmI5NzY2YjA0MDdjOWRlZWQ1Nzk3ZjQ2NGE1OTE0N2I4OGRmOTZmYzYifX19]
instancedquestsetup:
type: assignment
debug: true
actions:
on spawn:
- foreach <yaml[<npc.flag[instance].as_npc>].read[<npc.flag[instance].as_npc><player.flag[<npc.flag[instance].as_npc>step]>]||<list[]>>:
- inject <script[<[value].before[)(]>]>
on damage:
- flag <npc> playershow:<player>
- foreach <yaml[<npc.flag[instance].as_npc>].read[damage<npc.flag[instance].as_npc><player.flag[<npc.flag[instance].as_npc>step]>]||<list[]>>:
- inject <script[<[value].before[)(]>]>
on despawn:
- adjust <npc.flag[playershow].as_player> show_entity:<npc.flag[instance].as_npc>
- adjust <npc.flag[playershow].as_player> show_entity:<npc.flag[instance].as_npc.flag[icon]>
- adjust <npc.flag[instance].as_npc> skin:<npc.flag[instance].as_npc.name>
on click:
- ~yaml load:<npc.flag[instance].as_npc>.yml id:<npc.flag[instance].as_npc>
- flag <npc> playershow:<player>
- foreach <yaml[<npc.flag[instance].as_npc>].read[click<npc.flag[instance].as_npc><player.flag[<npc.flag[instance].as_npc>step]>]||<list[]>>:
- inject <script[<[value].before[)(]>]>
questsetup:
type: assignment
debug: true
actions:
on assignment:
- yaml create id:<npc>
on spawn:
- ~yaml load:<npc>.yml id:<npc>
on despawn:
- yaml savefile:<npc>.yml id:<npc>
- if !<npc.has_flag[instanced]>:
- yaml unload id:<npc>
on chat:
- if <player.is_op> && <context.message> == wipe:
- determine passively cancelled
- wait 2t
- remove <npc.flag[icon]>
- flag <npc> instanced:!
- flag <npc> damage<npc>step:1
- flag <npc> click<npc>step:1
- flag <npc> proximity_enter<npc>step:1
- flag <npc> proximity_exit<npc>step:1
- flag <npc> mobprox_enter<npc>step:1
- flag <npc> mobprox_exit<npc>step:1
- flag <npc> start_fishing<npc>step:1
- flag <npc> stop_fishing<npc>step:1
- flag <npc> reel_in_fishing_rod<npc>step:1
- foreach <server.players>:
- flag <[value]> damage<npc>step:!
- flag <[value]> click<npc>step:!
- flag <[value]> proximity_enter<npc>step:!
- flag <[value]> proximity_exit<npc>step:!
- flag <[value]> mobprox_enter<npc>step:!
- flag <[value]> mobprox_exit<npc>step:!
- flag <[value]> start_fishing<npc>step:!
- flag <[value]> stop_fishing<npc>step:!
- flag <[value]> reel_in_fishing_rod<npc>step:!
- yaml create id:<npc>
- narrate "fresh slate applied"
- if <player.is_op> && <context.message> == setup:
- determine passively cancelled
- flag <player> setupnpc:<npc>
- inventory open d:trigger_options_gui
- if <player.is_op> && <player.has_flag[questtext]>:
- determine passively cancelled
- yaml id:<npc> set <player.flag[action]><npc><npc.flag[<player.flag[action]>step]>:->:<player.flag[questtext]>)(<context.message>
- narrate "<context.message> applied"
- inventory open d:quest_options_gui
- flag <player> questtext:!
on enter proximity:
- if !<player.has_flag[proximity_enter<npc>step]>:
- flag player proximity_enter<npc>step:1
- foreach <yaml[<npc>].read[proximity_enter<npc><player.flag[proximity_enter<npc>step]>]||<list[]>>:
- inject <script[<[value].before[)(]>]>
on exit proximity:
- if !<player.has_flag[proximity_exit<npc>step]>:
- flag player proximity_exit<npc>step:1
- foreach <yaml[<npc>].read[proximity_exit<npc><player.flag[proximity_exit<npc>step]>]||<list[]>>:
- inject <script[<[value].before[)(]>]>
on mob enter proximity:
- foreach <npc.location.find.players.within[15]> as:player:
- if !<[player].has_flag[mobprox_enter<npc>step]>:
- flag <[player]> mobprox_enter<npc>step:1
- foreach <yaml[<npc>].read[mobprox_enter<npc><[player].flag[mobprox_enter<npc>step]>]||<list[]>>:
- inject <script[<[value].before[)(]>]>
on mob exit proximity:
- foreach <npc.location.find.players.within[15]> as:player:
- if !<[player].has_flag[mobprox_exit<npc>step]>:
- flag <[player]> mobprox_exit<npc>step:1
- foreach <yaml[<npc>].read[mobprox_exit<npc><[player].flag[mobprox_exit<npc>step]>]||<list[]>>:
- inject <script[<[value].before[)(]>]>
on start fishing:
- foreach <npc.location.find.players.within[15]> as:player:
- if !<[player].has_flag[start_fishing<npc>step]>:
- flag <[player]> start_fishing<npc>step:1
- foreach <yaml[<npc>].read[start_fishing<npc><[player].flag[start_fishing<npc>step]>]||<list[]>>:
- inject <script[<[value].before[)(]>]>
on stop fishing:
- foreach <npc.location.find.players.within[15]> as:player:
- if !<[player].has_flag[stop_fishing<npc>step]>:
- flag <[player]> stop_fishing<npc>step:1
- foreach <yaml[<npc>].read[stop_fishing<npc><[player].flag[stop_fishing<npc>step]>]||<list[]>>:
- inject <script[<[value].before[)(]>]>
on reel in fishing rod:
- foreach <npc.location.find.players.within[15]> as:player:
- if !<[player].has_flag[reel_in_fishing_rod<npc>step]>:
- flag <[player]> reel_in_fishing_rod<npc>step:1
- foreach <yaml[<npc>].read[reel_in_fishing_rod<npc><[player].flag[reel_in_fishing_rod<npc>step]>]||<list[]>>:
- inject <script[<[value].before[)(]>]>
on damage:
- if <npc.has_flag[instanced]>:
- if !<player.has_flag[instanced]>:
- create player <npc.name> save:instanced_npc
- flag <player> instanced:<entry[instanced_npc].created_npc>
- assignment set script:instancedquestsetup to:<entry[instanced_npc].created_npc>
- lookclose <player.flag[instanced].as_npc> state:true
- adjust <server.players> hide_from_players:<entry[instanced_npc].created_npc>
- adjust <player> show_entity:<entry[instanced_npc].created_npc>
- adjust <player.flag[instanced].as_npc> skin:<npc.name>
- despawn <player.flag[instanced].as_npc>
- spawn <player.flag[instanced].as_npc> <npc.location.with_pose>
- wait 5t
- adjust <player> hide_entity:<npc>
- adjust <player> hide_entity:<npc.flag[icon]>
- flag <player.flag[instanced].as_npc> instance:<npc>
- flag <npc> playershow:<player>
- else:
- if !<player.has_flag[damage<npc>step]>:
- flag player damage<npc>step:1
- foreach <yaml[<npc>].read[damage<npc><player.flag[damage<npc>step]>]||<list[]>>:
- inject <script[<[value].before[)(]>]>
on click:
- if <npc.has_flag[instanced]>:
- if !<player.has_flag[instanced]>:
- create player <npc.name> save:instanced_npc
- flag <player> instanced:<entry[instanced_npc].created_npc>
- assignment set script:instancedquestsetup to:<entry[instanced_npc].created_npc>
- lookclose <player.flag[instanced].as_npc> state:true
- adjust <server.players> hide_from_players:<entry[instanced_npc].created_npc>
- adjust <player> show_entity:<entry[instanced_npc].created_npc>
- adjust <player.flag[instanced].as_npc> skin:<npc.name>
- despawn <player.flag[instanced].as_npc>
- spawn <player.flag[instanced].as_npc> <npc.location.with_pose>
- wait 5t
- adjust <player> hide_entity:<npc>
- adjust <player> hide_entity:<npc.flag[icon]>
- flag <player.flag[instanced].as_npc> instance:<npc>
- flag <npc> playershow:<player>
- else:
- if !<player.has_flag[click<npc>step]>:
- flag player click<npc>step:1
- foreach <yaml[<npc>].read[click<npc><player.flag[click<npc>step]>]||<list[]>>:
- inject <script[<[value].before[)(]>]>
quest_setup_events:
type: world
debug: true
events:
on player clicks in trigger_options_gui:
- determine passively cancelled
- wait 5t
- if <context.item.scriptname.after[)(].contains_any_text[mob]>:
- trait mobprox state:true to:<player.flag[setupnpc].as_npc>
- trigger name:proximity state:true npc:<player.flag[setupnpc].as_npc> radius:10
- flag <player> action:<context.item.scriptname.after[)(]>
- else if <context.item.scriptname.after[)(].contains_any_text[proximity]>:
- trigger name:proximity state:true npc:<player.flag[setupnpc].as_npc> radius:10
- flag <player> action:<context.item.scriptname.after[)(]>
- else:
- trigger name:<context.item.scriptname.after[)(]> state:true npc:<player.flag[setupnpc].as_npc>
- flag <player> action:<context.item.scriptname.after[)(]>
- narrate "<context.item.scriptname.after[)(]> in use"
- if !<player.flag[setupnpc].as_npc.has_flag[<player.flag[action]>step]>:
- flag <player.flag[setupnpc].as_npc> <player.flag[action]>step:1
- inventory close
- inventory open d:quest_options_gui
on player clicks in quest_options_gui:
- if <context.item.contains_any_text[quest_setup]>:
- determine passively cancelled
- if <context.item.scriptname.after[)(]> == icon:
- create dropped_item name <player.location> save:item
- if <player.item_in_hand.contains[player_head]>:
- adjust <entry[item].created_npc> item:<player.item_in_hand>
- else:
- adjust <entry[item].created_npc> item:player_head[skull_skin=8d7d24be-a6b6-44ef-a689-f7b39b00e283|eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzJmZjJlNGZkNDE0Y2FiYTU5YzI0NmI5NzY2YjA0MDdjOWRlZWQ1Nzk3ZjQ2NGE1OTE0N2I4OGRmOTZmYzYifX19]
- if <player.flag[setupnpc].as_npc.has_flag[icon]>:
- remove <player.flag[setupnpc].as_npc.flag[icon]>
- flag <player.flag[setupnpc].as_npc> icon:<entry[item].created_npc>
- else:
- flag <player.flag[setupnpc].as_npc> icon:<entry[item].created_npc>
- adjust <entry[item].created_npc> gravity:false
- attach <entry[item].created_npc> to:<player.flag[setupnpc].as_npc> offset:0,2,0 sync_server
- if <context.item.scriptname.after[)(]> == save:
- yaml savefile:<player.flag[setupnpc].as_npc>.yml id:<player.flag[setupnpc].as_npc>
- if <context.item.scriptname.after[)(]> == reset_steps:
- yaml id:<player.flag[setupnpc].as_npc> set <player.flag[action]><player.flag[setupnpc].as_npc><player.flag[setupnpc].as_npc.flag[<player.flag[action]>step]>:->:flag)(<<>player<>>)(<player.flag[action]><<>npc<>>step<&co>1
- if <context.item.scriptname.after[)(]> == next_step:
- yaml id:<player.flag[setupnpc].as_npc> set <player.flag[action]><player.flag[setupnpc].as_npc><player.flag[setupnpc].as_npc.flag[<player.flag[action]>step]>:->:flag)(<<>player<>>)(<player.flag[action]><<>npc<>>step<&co>+<&co>1
- flag <player.flag[setupnpc].as_npc> <player.flag[action]>step:+:1
- if <context.item.scriptname.after[)(]> == despawn:
- yaml id:<player.flag[setupnpc].as_npc> set <player.flag[action]><player.flag[setupnpc].as_npc><player.flag[setupnpc].as_npc.flag[<player.flag[action]>[step]>:->:despawn)(<<>npc<>>
- if <context.item.scriptname.after[)(].contains[npcinstance]>:
- flag <player.flag[setupnpc].as_npc> instanced
#wait command section
- if <context.item.scriptname.after[)(]> == wait:
- yaml id:<player.flag[setupnpc].as_npc> set <player.flag[action]><player.flag[setupnpc].as_npc><player.flag[setupnpc].as_npc.flag[<player.flag[action]>step]>:->:wait)(2s
- flag player command:-<&sp><context.item.scriptname.after[)(]>
#for commands that use the selection tool
- if <context.item.scriptname.after[)(].contains[walk]> || <context.item.scriptname.after[)(].contains[teleport_npc]> || <context.item.scriptname.after[)(].contains[teleport_player]>:
- narrate "<context.item.scriptname.after[)(]> editor opened"
- foreach <context.item.lore>:
- if <[value].before[)(]> == flag:
- flag <player> <[value].after[)(]>
- inventory close
- wait 5t
- give questsetupselectionstool
#narrate and chat command section
- if <context.item.scriptname.after[)(].contains[narrate]> || <context.item.scriptname.after[)(].contains[chat]>:
- foreach <context.item.lore>:
- if <[value].before[)(]> == flag:
- flag <player> <[value].after[)(]>:<context.item.scriptname.after[)(]>
- narrate "<green>Please type what you would like to have the npc say"
- inventory close
on player right clicks with questsetupselectionstool:
- determine passively cancelled
- yaml id:<player.flag[setupnpc].as_npc> set <player.flag[action]><player.flag[setupnpc].as_npc><player.flag[setupnpc].as_npc.flag[<player.flag[action]>step]>:->:<player.flag[selectiontoolcommand]>)(<player.flag[selectiontoolnpc]>)(<context.location>
- wait 2t
- fakespawn slime <context.location>
- narrate "<green>Location set drop the selection tool to complete selections"
on player drops questsetupselectionstool:
- determine passively cancelled
- wait 1t
- take questsetupselectionstool
- inventory open d:quest_options_gui
questsetupselectionstool:
type: item
material: stick
dispaly name: selection_tool
despawn:
type: task
script:
- despawn <[value].split[)(].get[2].parsed>
walk:
type: task
script:
- wait 1t
- ~walk <[value].split[)(].get[2].parsed> <[value].split[)(].get[3]>
wait:
type: task
script:
- wait <[value].after[)(]>
narrate:
type: task
script:
- if <[value].contains_any_text[$$]> && <[value].contains_any_text[##]>:
- narrate <[value].after[)(].replace[$$].with[<player.name>].replace[##].with[<npc.name>]> targets:<player||<[player]>>
- else if <[value].contains_any_text[$$]>:
- narrate <[value].after[)(].replace[$$].with[<player.name>]> targets:<player||<[player]>>
- else if <[value].contains_any_text[##]>:
- narrate <[value].after[)(].replace[##].with[<npc.name>]> targets:<player||<[player]>>
- else:
- narrate <[value].after[)(]> targets:<player||<[player]>>
chat:
type: task
script:
- if <[value].contains_any_text[$$]> && <[value].contains_any_text[##]>:
- chat <[value].after[)(].replace[$$].with[<player.name>].replace[##].with[<npc.name>]>
- else if <[value].contains_any_text[$$]>:
- chat <[value].after[)(].replace[$$].with[<player.name>]>
- else if <[value].contains_any_text[##]>:
- chat <[value].after[)(].replace[##].with[<npc.name>]>
- else:
- narrate <[value].after[)(]>
teleport:
type: task
script:
- teleport <[value].split[)(].get[2].parsed> <[value].split[)(].get[3]>
animate:
type: task
script:
- narrate stuff
flag:
type: task
script:
- flag <[value].split[)(].get[2].parsed> <[value].split[)(].get[3].parsed>
#buttons and inventory items
trigger_options_gui:
type: inventory
inventory: chest
slots:
- [quest_action)(damage] [quest_action)(reel_in_fishing_rod] [quest_action)(stop_fishing] [quest_action)(start_fishing] [quest_action)(mobprox_exit] [quest_action)(mobprox_enter] [quest_action)(proximity_exit] [quest_action)(proximity_enter] [quest_action)(click]
quest_action)(damage:
type: item
debug: false
material: wooden_sword
display name: damage
lore:
- triggered when a player hits an npc
quest_action)(reel_in_fishing_rod:
type: item
debug: false
material: salmon
display name: reel_in_fishing_rod
lore:
- triggered when the npc reels in the fishing pole
quest_action)(stop_fishing:
type: item
debug: false
material: bucket
display name: stop_fishing
lore:
- triggered when an npc stops fishing
quest_action)(start_fishing:
type: item
debug: false
material: fishing_rod
display name: start_fishing
lore:
- triggered when an npc starts fishing
quest_action)(mobprox_exit:
type: item
debug: false
material: dark_oak_trapdoor
display name: mobprox_exit
lore:
- triggered when a mob leaves the npcs proximity radius
quest_action)(mobprox_enter:
type: item
debug: false
material: oak_trapdoor
display name: mobprox_enter
lore:
- triggered when a mob enters the proximity radius
quest_action)(proximity_exit:
type: item
debug: false
material: dark_oak_door
display name: proximity_exit
lore:
- triggered when a player leaves the proximity radius
quest_action)(proximity_enter:
type: item
debug: false
material: oak_door
display name: proximity_enter
lore:
- triggered when a player enters the proximity radius
quest_action)(click:
type: item
debug: false
material: stone_button
display name: click
lore:
- triggered when a player right clicks the npc
quest_options_gui:
type: inventory
inventory: chest
slots:
- [quest_setup)(narrate] [quest_setup)(chat] [quest_setup)(wait] [quest_setup)(walk] [quest_setup)(teleport_player] [quest_setup)(teleport_npc] [quest_setup)(npcinstance] [quest_setup)(despawn] [quest_setup)(next_step]
- [quest_setup)(reset_steps] [quest_setup)(save] [quest_setup)(icon] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
quest_setup)(narrate:
type: item
debug: false
material: birch_sign
display name: narrate
lore:
- makes an npc show text only to the player speaking with the npc.
- use $$ to have the text return the player's name
- use ## to have the text return the npc's name
- flag)(questtext
quest_setup)(chat:
type: item
debug: false
material: oak_sign
display name: chat
lore:
- makes an npc show text to all players within range.
- use $$ to have the text return the player's name
- use ## to have the text return the npc's name
- flag)(questtext
quest_setup)(wait:
type: item
debug: false
material: clock
display name: wait
lore:
- makes a delay for in between text and other commands.
- wait)(2s
quest_setup)(walk:
type: item
debug: false
material: leather_boots
display name: walk
lore:
- makes an npc walk to a specified location
- note needs to be within 20 blocks per walk location
- flag)(selectiontoolnpc<&co><<>npc<>>
- flag)(selectiontoolcommand<&co>walk
quest_setup)(teleport_player:
type: item
debug: false
material: ender_pearl
display name: teleport_player
lore:
- teleports the player to a specified location
- flag)(selectiontoolnpc<&co><<>player<>>
- flag)(selectiontoolcommand<&co>teleport
quest_setup)(teleport_npc:
type: item
debug: false
material: ender_eye
display name: teleport_npc
lore:
- teleports the npc to a specified location
- flag)(selectiontoolnpc<&co><<>npc<>>
- flag)(selectiontoolcommand<&co>teleport
#
quest_setup)(npcinstance:
type: item
debug: false
material: glass
display name: instance
lore:
- makes the npc instanced
- use despawn to bring the npc back to its original point
- automatically brings the npc back to its original point when it despawns
- can only be used with damage and click actions
#
quest_setup)(despawn:
type: item
debug: false
material: heart_of_the_sea
display name: despawn
lore:
- despawns the npc
#
quest_setup)(next_step:
type: item
debug: false
material: stone_brick_stairs
display name: next_step
lore:
- adds a new step to the npc
- use this to make the player have
- to click the npc for the next step
#
quest_setup)(reset_steps:
type: item
debug: false
material: stone_bricks
display name: reset_steps
lore:
- resets the npc steps for the selected action
- to start the quest over
- use at the end of your last step
- when you want a repeating quest
#
quest_setup)(save:
type: item
debug: false
material: chest
display name: save
lore:
- saves this quest
#
quest_setup)(icon:
type: item
debug: false
material: player_head[skull_skin=8d7d24be-a6b6-44ef-a689-f7b39b00e283|eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzJmZjJlNGZkNDE0Y2FiYTU5YzI0NmI5NzY2YjA0MDdjOWRlZWQ1Nzk3ZjQ2NGE1OTE0N2I4OGRmOTZmYzYifX19]
display name: add_icon
lore:
- adds an icon over the npcs head
- optionally use a player head for more icons
- hold a player head item in your hand before
- executing this command the held item will become the icon
#
quest_setup)(clickable_text:
type: item
debug: false
material: acacia_sign
display name: clickable_text
lore:
- moves to the next step
- make it as if the player
- was selecting dialogue
- input your own dialogue
#
quest_setup)(previous_step:
type: item
debug: false
material: cobblestone_stairs
display name: previous_step
lore:
- takes the player back a step