Date: 2015/09/21 09:54:09 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
TeaWalker:
Type: Assignment
Debug: false
Default Constants:
PatrolPoints: Pacing1|Pacing2|Pacing3
Actions:
On Assignment:
- flag <npc> Status:passive
- flag <npc> Goal:seek
- flag <npc> PatrolList:!
- foreach <npc.constant[PatrolPoints]> {
- flag <npc> PatrolList:->:%value%
}
- ^trigger name:click toggle:true
interact scripts:
- 1 TeaWalkerInteract
TeaWalkerInteract:
type: interact
Debug: false
steps:
1:
click trigger:
script:
- run VillagerGoalSwitcher
"VillagerGoalSwitcher":
type: task
debug: false
script:
- if <npc.flag[Goal]||patrol> == patrol {
- narrate "<npc.name> will follow you!"
- pause waypoints
- flag <npc> Goal:seek
- run VillagerSeek def:<player> delay:2s
}
else if <npc.flag[Goal]||patrol> == seek {
- narrate "<npc.name> will patrol!"
- pause waypoints
- flag <npc> Goal:patrol
- run VillagerPatrol delay:2s
}
"VillagerPatrol":
type: task
debug: true
script:
- while <npc.is_spawned||false> {
- if <npc.flag[Status]||passive> == passive && <npc.flag[Goal]||null> == patrol {
- if <npc.flag[PatrolList].as_list.size> <= <npc.flag[HasChecked].as_list.size||0> {
- flag <npc> HasChecked:<npc.flag[CurrentTarget]>
}
- flag <npc> CurrentTarget:!
- flag <npc> CurrentTargetDistance:!
- foreach <npc.flag[PatrolList].as_list> {
- if <npc.flag[HasChecked].as_list.contains[%value%]||false> {
- foreach next
}
else {
- flag <npc> DistanceTo%value%:<npc.location.distance[<server.flag[%value%]>]>
- if <npc.flag[CurrentTargetDistance]||100> > <npc.flag[DistanceTo%value%]> {
- flag <npc> CurrentTarget:%value%
- flag <npc> CurrentTargetDistance:<npc.flag[DistanceTo%value%]>
}
}
}
- pause navigation
- ~walk <npc> <server.flag[<npc.flag[CurrentTarget]>].as_location> radius:5
- wait 2s
- flag <npc> HasChecked:->:<npc.flag[CurrentTarget]>
}
else {
- queue clear
}
}
"VillagerSeek":
type: task
debug: false
script:
- while <npc.is_spawned||false> {
- if <npc.flag[Status]||passive> == passive && <npc.flag[Goal]||null> == seek && <npc.location.distance[<def[1].location>]> < 25 {
- if <npc.location.distance[<def[1].location>]> > 5 {
- pause waypoints
- ~walk <npc> <npc.location.find.players.within[25].get[1].location.cursor_on[2].ignore[tall_grass|double_tallgrass]> radius:4
}
else {
- wait 10t
}
}
else {
- pause waypoints
- queue clear
}
}