Date: 2023/09/28 19:54:54 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
fnpc_format:
type: format
format: <&6><npc.name><&f><&co> <&a><[text]>
fnpc_assignment:
type: assignment
#list the ineract scripts
interact scripts:
- fnpc_interact
actions:
#enable relevant triggers when the assignment is set
on assignment:
- trigger name:click state:true
- trigger name:chat state:true
fnpc_interact:
type: interact
steps:
1:
click trigger:
script:
- narrate "Hey <&c><player.name><&a>, would you like me to show you around?" format:fnpc_format
- narrate "<&7>Respond: <&a>/Yes/ <&7>or <&c>/No/?"
chat trigger:
1:
trigger: /yes/
script:
- narrate "Alright then, follow me!" format:fnpc_format
#hide the main npc from the player
- adjust <player> hide_entity:<npc>
#create a "clone" of the npc that the player will follow
- create player <npc.name> <npc.location> save:tour
- define tour <entry[tour].created_npc>
#hide the created clone from everyone but the player
- adjust <server.online_players.exclude[<player>]> hide_entity:<[tour]>
#loop through the original npc's anchors
- foreach <npc.list_anchors> as:id:
#walk to the current anchor in the loop
- ~walk <[tour]> <npc.anchor[<[id]>]> auto_range
#this is here instead of the "npc_trypause" task script that you had
#check if the clone npc's distance is bigger than 5 from the players location
- while <[tour].location.distance[<player.location>]> > 5:
#if the tag above returns true, the commands below will run every 3 seconds
- narrate "Try to keep up!" format:fnpc_format
- wait 3s
- narrate "This is the <&c><[id]> <&a>area." format:fnpc_format
- wait 2s
#this will narrate only when the tour npc has walked to the last anchor
- narrate "<&a>That's it for the tour, I hope you enjoyed. Bye!" format:fnpc_format
- wait 2s
#this is just for the purpose of testing, once everything
#is done I remove the clone and show the original npc to the player
- remove <[tour]>
- adjust <player> show_entity:<npc>
2:
trigger: /no/
script:
- narrate "Okay! Feel free to come back any time." format:fnpc_format