Date: 2017/03/10 13:33:44 UTC-08: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
# +----------------
# | Helpful Citizen .. configurable and easy to use 'helpful citizens'!
# | Version 1.0 by aufdemrand
# | see: Helpful Citizens for Denizen on youtube
helpful citizen configuration:
type: task
debug: false
# Copy this node and its contents to make a new
# configuration. Use the NPC constant 'configuration'
# to select which node to use. Mind the spacing!
# Below is an example of the four types of 'helpful citizens'
# that you can utilize.
default giver:
# Givers give a random item every once in awhile, as customized below.
type: giver
# Just define the item, and a simple phrase for the giver to say!
items:
- i@shirt off back/Here, take this shirt off my back.
- i@feather/I found this feather, please have it!
- i@ladder[quantity=2]/This may come in handy!
# ...and a cooldown...
cooldown: 23h
# ...and some random cooldown text.
cooldown text:
- "You look good today!"
- "I'm always on the lookout for loot."
- "Nice seeing you, <player.name>!"
- "I look for treasure during the <t[<player.world.time.period.is[==].to[night]>]:night time! || day time!>"
default teller:
# Tellers are kind of like givers, but they give advice instead.
type: teller
# Simply specify advice...
advice:
- "Use 'tab' to autocomplete a username!"
- "A stick and two stone make a simple stone sword!"
- "The secret word is 'please'."
# ...and of course, a cooldown...
cooldown: 10s
# ...and what to say on cooldown!
cooldown text:
- "I'm all out of advice for now!"
- "I always keep my ears open for some good advice!"
default healer:
# Healers do just that -- heal a player upon interaction.
type: healer
# You must give the healer a condition. Use 'true' to make
# the healer heal all the time.
condition: <player.health.is[less].than[10]>
# Specify possible heal amounts, and a simple phrase for
# the healer to say upon that selection.
heal:
- <player.health.max>/I was able to help!
- 5/I did what I could!
- 0/I seem to be all out of mana!
# Condition not met? The healer will use these phrases.
healthy text:
- "You're doing fine, lad!"
# Finally, set a cooldown...
cooldown: 10s
# ...and some cooldown text!
cooldown text:
- "You're young and healthy. Much respect!"
- "Keep up the good work!"
- "Battle bruises can easily be healed!"
- "It's a hard job, but someone has to do it!"
default magician:
# Magicians can be really powerful!
type: magician
# First, define some spells, and a simple phrase for when
# the spell is used.
spells:
- teleportation/You've been teleported somewhere unknown!
- invisible/You're now invisible!
- show/I love magic!
# And define a small script for each spell...
teleportation:
- teleport <player> <player.location.find.surface_blocks[grass|gravel|dirt|mycel|stone].within[25].random.as_location.add[0,1,0]>
invisible:
- cast invisibility <player> duration:1m
show:
- look <npc.eye_location.add[0,5,0]>
- firework
# Lastly, specify a cooldown...
cooldown: 10s
# ...and some cooldown text!
cooldown text:
- "I'm on cooldown!"
- "There's only so much magic to go around!"
- "I need rest."
my teller:
# Tellers are kind of like givers, but they give advice instead.
type: teller
# Simply specify advice...
advice:
- "Hello!"
- "Hi!"
# ...and of course, a cooldown...
cooldown: 10s
# ...and what to say on cooldown!
cooldown text:
- "See ya!"
# ---------
# Copy/paste your custom configurations in this spot below! Mind the spacing!
# ---------
# | /// START HANDLERS ///
# | No need to change anything below, unless you want to change the functionality of this script
# | which is, of course, encouraged and applauded! If not, there's a ton of functionality to mess
# | with above by making new configurations!
# Small example of a custom item. The default giver configuration uses
# this to give away.
shirt off back:
type: item
debug: false
material: m@leather_chestplate
color: c@blue
display name: the shirt off his back
lore:
- "<tern[<npc.name.is[!==].to[null]>]:'<npc.name>' || Someone><reset><white> once gave you"
- <white>>the shirt off his back.
- <white>his is that shirt.
# The main script for the NPC in the form of an assignment script.
Helpful Citizen:
type: assignment
debug: false
default constants:
configuration: default teller
actions:
on unavailable:
- narrate 'You tap <npc.name> on the shoulder.'
on click:
- engage duration:3s
- look <npc> <player.eye_location>
- define type '<proc[helpful citizen helper].context[type]>'
#
# Check type of citizen:
# ----> GIVER
- if '%type%' == 'giver' {
- if !<player.flag[helpful_<npc.constant[configuration]>_<npc.id>_cooldown]> {
- define items '<proc[helpful citizen helper].context[items]>'
- flag <npc> helpful_citizen_items:!
- flag <npc> helpful_citizen_items:|:%items%
- define item <npc.flag[helpful_citizen_items].as_list.random.split[/].get[1]>
- chat '<el@val[%items%].split[/].get[2]>'
- animate <npc> arm_swing
- give '%item%'
- narrate '<yellow>[!]<blue> You have recieved <%item%.qty>
"<t[<%item%.has_display>]:<%item%.display> || <%item%.material.name>>"!'
- flag <player> helpful_<npc.constant[configuration]>_<npc.id>_cooldown:true
'duration:<proc[helpful citizen helper].context[cooldown] || 5s>'
} else {
- chat '<proc[helpful citizen helper].context[cooldown text]>'
}
- queue clear
}
# ----> TELLER
- if '%type%' == 'teller' {
- if !<player.flag[helpful_<npc.constant[configuration]>_<npc.id>_cooldown]> {
- define advice '<proc[helpful citizen helper].context[advice]>'
- chat '%advice%'
- flag <player> helpful_<npc.constant[configuration]>_<npc.id>_cooldown:true
'duration:<proc[helpful citizen helper].context[cooldown] || 5s>'
} else {
- chat '<proc[helpful citizen helper].context[cooldown text]>'
}
- queue clear
}
# ----> HEALER
- if '%type%' == 'healer' {
- if !<player.flag[helpful_<npc.constant[configuration]>_<npc.id>_cooldown]> {
- if '<proc[helpful citizen helper].context[condition]>' == 'true' {
- define pair '<proc[helpful citizen helper].context[heal]>'
- define value '<el@val[%pair%].split[/].get[1]>'
- chat '<el@val[%pair%].split[/].get[2]>'
- animate <npc> arm_swing
- playeffect ender_signal qty:10 <npc.eye_location.add[0,-1,0]>
- heal <player> %value%
- narrate '<yellow>[!]<blue> You have recieved %value% HPs!'
- flag <player> helpful_<npc.constant[configuration]>_<npc.id>_cooldown:true
'duration:<proc[helpful citizen helper].context[cooldown] || 5s>'
} else {
- chat '<proc[helpful citizen helper].context[healthy text]>'
}
} else {
- chat '<proc[helpful citizen helper].context[cooldown text]>'
}
- queue clear
}
# ----> MAGICIAN
- if '%type%' == 'magician' {
- if !<player.flag[helpful_<npc.constant[configuration]>_<npc.id>_cooldown]> {
- define pair '<proc[helpful citizen helper].context[spells]>'
- define script '<npc.constant[configuration]>.<el@val[%pair%].split[/].get[1]>'
- animate <npc> arm_swing
- run instantly 's@helpful citizen configuration' p:%script%
- chat '<el@val[%pair%].split[/].get[2]>'
- flag <player> helpful_<npc.constant[configuration]>_<npc.id>_cooldown:true
'duration:<proc[helpful citizen helper].context[cooldown] || 5s>'
} else {
- chat '<proc[helpful citizen helper].context[cooldown text]>'
}
- queue clear
}
- if <player.is_op>
narrate 'I need a configuration!'
else look <player.eye_location>
# This set of helper scripts fetches information from the configurations.
Helpful Citizen Helper:
type: procedure
definitions: node
debug: false
script:
- flag <npc> nodes:!
- flag <npc> 'nodes:|:<s@helpful citizen configuration.constant[<npc.constant[configuration]>.%node%]>'
- if <npc.flag[nodes]> != null
determine <npc.flag[nodes].as_list.random>
else determine 'You take a look at <npc.name>.'