Date: 2015/05/22 06:26:33 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
BodyguardWS:
type: world
debug: false
events:
on player join:
- if <player.has_flag[bodyguard]> {
- inject locally BodyguardRes
}
on player quits:
- if <player.has_flag[bodyguard]> {
- ^execute as_server "npc sel <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "trait sentry"
- ^execute as_server "npc despawn"
}
BodyguardRes:
- if <player.has_flag[bodyguard1]> {
- wait 1s
- ^execute as_server "npc spawn <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "npc sel <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "trait sentry"
- teleport <player.flag[BodyGuard]> location:<player.location>
- flag <player.flag[BodyGuard]> "guarding:true"
- ^execute as_ "sentry respawn -1"
- ^execute as_server "sentry follow 5"
- ^execute as_server "sentry speed 1.0"
- ^execute as_server "sentry healrate 10"
- ^execute as_server "sentry guard <player.name>"
- ^flag <player.flag[BodyGuard]> "guarding:true"
} else if <player.has_flag[bodyguard2] {
- wait 1s
- ^execute as_server "npc spawn <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "npc sel <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "trait sentry"
- ^execute as_server "sentry respawn 300"
- ^execute as_server "sentry follow 5"
- ^execute as_server "sentry speed 1.0"
- ^execute as_server "sentry healrate 10"
- ^execute as_server "sentry guard <player.name>"
- flag <player.flag[BodyGuard]> "guarding:true"
} else <player.has_flag[bodyguard3] {
- wait 1s
- ^execute as_server "npc spawn <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "npc sel <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "trait sentry"
- ^execute as_server "sentry armor 2"
- ^execute as_server "sentry respawn 1"
- ^execute as_server "sentry follow 5"
- ^execute as_server "sentry speed 1.0"
- ^execute as_server "sentry healrate 5"
- ^execute as_server "sentry guard <player.name>"
- flag <player.flag[BodyGuard]> "guarding:true"
}
BodyguardSalesMan:
type: assignment
debug: false
default constants:
BodyguardCost: 20
BodyGuardRespawnCost: 2000
BodyGuardInstant: 20000
interact scripts:
- 10 BgSalesMan
BgSalesMan:
type: interact
steps:
1:
click trigger:
script:
- if <player.has_flag[Bodyguard]> {
- narrate "<green><npc.name>:<gold> You already have a bodyguard, Come back if he dies."
} else {
- narrate "<green><npc.name>:<gold> Hello <player.name> Welcome to my shop."
- wait 1
- narrate "<green><npc.name>:<gold> As of this moment i only have three types of bodyguard available."
- wait 1
- narrate "<green><npc.name>:<gold> Would you like to hire a <green>normal<gold> bodyguard for $<npc.constant[BodyguardCost]>?"
- wait 1
- narrate "<green><npc.name>:<gold> Or would you like one that <green>respawns<gold> for $<npc.constant[BodyGuardRespawnCost]> or one that respawns <green>instantly<gold> for $<npc.constant[BodyGuardInstant]>?"
}
chat trigger:
1:
trigger: <gold>I am interested in purchasing a /normal/ bodyguard.
script:
- engage
- narrate "<green><npc.name>:<gold> Alright that will be $<npc.constant[BodyguardCost]>."
- if <player.money> < <npc.constant[BodyguardCost]> {
- narrate "<green><npc.name>:<gold> You do not have enough money, please come back when you have enough."
- disengage
} else {
- take money qty:<npc.constant[BodyguardCost]>
- flag player Bodyguard1
- create player BodyGuard save:BodyGuard
- flag player Bodyguard:<entry[BodyGuard].created_npc>
- ^execute as_server "npc select <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "trait sentry"
- ^execute as_server "sentry equip DIAMOND_HELMET"
- ^equip <entry[BodyGuard].created_npc> hand:i@BodyguardSword
- ^execute as_server "sentry equip DIAMOND_CHESTPLATE"
- ^execute as_server "sentry equip DIAMOND_LEGGINGS"
- ^execute as_server "sentry equip DIAMOND_BOOTS"
- ^execute as_server "sentry respawn -1"
- ^execute as_server "sentry follow 5"
- ^execute as_server "sentry speed 1.0"
- ^execute as_server "sentry healrate 10"
- ^execute as_server "npc assignment --set BodyguardAssignment"
- ^execute as_server "npc owner <player.name>"
- ^execute as_server "sentry guard <player.name>"
- ^flag <player.flag[BodyGuard]> "guarding:true"
- narrate "<red>You give <npc.name> $<npc.constant[BodyguardCost]>"
- narrate "<green><npc.name>:<gold> He is yours untill he dies, be safe out there."
- wait 1
- narrate "<green><npc.name>:<gold> Right click on him to enter order mode"
- disengage
}
2:
trigger: <gold>I am interested in purchasing a bodyguard that /respawns/.
script:
- engage
- narrate "<green><npc.name>:<gold> Alright that will be $<npc.constant[BodyguardRespawnCost]>."
- if <player.money> < <npc.constant[BodyguardRespawnCost]> {
- narrate "<green><npc.name>:<gold> You do not have enough money, please come back when you have enough."
- disengage
} else {
- take money qty:<npc.constant[BodyguardRespawnCost]>
- flag player Bodyguard2
- create player BodyGuard save:BodyGuard
- flag player Bodyguard:<entry[BodyGuard].created_npc>
- ^execute as_server "npc select <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "trait sentry"
- ^execute as_server "sentry equip DIAMOND_HELMET"
- ^equip <entry[BodyGuard].created_npc> hand:i@BodyguardSword
- ^execute as_server "sentry equip DIAMOND_CHESTPLATE"
- ^execute as_server "sentry equip DIAMOND_LEGGINGS"
- ^execute as_server "sentry equip DIAMOND_BOOTS"
- ^execute as_server "sentry respawn 300"
- ^execute as_server "sentry follow 5"
- ^execute as_server "sentry speed 1.0"
- ^execute as_server "sentry healrate 10"
- ^execute as_server "npc assignment --set BodyguardAssignment"
- ^execute as_server "npc owner <player.name>"
- ^execute as_server "sentry guard <player.name>"
- flag <player.flag[BodyGuard]> "guarding:true"
- narrate "<red>You give <npc.name> $<npc.constant[BodyguardRespawnCost]>"
- narrate "<green><npc.name>:<gold> Your bodyguard will respawn after 5 minutes if it dies."
- wait 1
- narrate "<green><npc.name>:<gold> Right click on him to enter order mode"
- disengage
}
3:
trigger: <gold>I am interested in purchasing a bodyguard that /instantly/ respawns.
script:
- engage
- narrate "<green><npc.name>:<gold> Alright that will be $<npc.constant[BodyGuardInstant]>."
- if <player.money> < <npc.constant[BodyGuardInstant]> {
- narrate "<green><npc.name>:<gold> You do not have enough money, please come back when you have enough."
- disengage
} else {
- take money qty:<npc.constant[BodyGuardInstant]>
- flag player Bodyguard3
- create player BodyGuard save:BodyGuard
- flag player Bodyguard:<entry[BodyGuard].created_npc>
- ^execute as_server "npc sel <player.flag[BodyGuard].replace[n@]>"
- ^spawn <player.flag[BodyGuard]> <player.location>
- ^execute as_server "trait sentry"
- ^execute as_server "sentry armor 2"
- ^execute as_server "sentry equip DIAMOND_HELMET"
- ^equip <entry[BodyGuard].created_npc> hand:i@BodyguardSword
- ^execute as_server "sentry equip DIAMOND_CHESTPLATE"
- ^execute as_server "sentry equip DIAMOND_LEGGINGS"
- ^execute as_server "sentry equip DIAMOND_BOOTS"
- ^execute as_server "sentry respawn 1"
- ^execute as_server "sentry follow 5"
- ^execute as_server "sentry speed 1.0"
- ^execute as_server "sentry healrate 5"
- ^execute as_server "npc assignment --set BodyguardAssignment"
- ^execute as_server "npc owner <player.name>"
- ^execute as_server "sentry guard <player.name>"
- flag <player.flag[BodyGuard]> "guarding:true"
- narrate "<red>You give <npc.name> $<npc.constant[BodyGuardInstant]>"
- narrate "<green><npc.name>:<gold> Your bodyguard will respawn right away if it dies."
- wait 1
- narrate "<green><npc.name>:<gold> Right click on him to enter order mode"
- disengage
}
4:
trigger: <gold>/No/, I dont want a bodyguard right now
script:
- engage
- random {
- narrate "<green><npc.name>:<gold> Alright come back if you change your mind."
- narrate "<green><npc.name>:<gold> You know where to find me if you get yourself in over your head"
}
- disengage
BodyguardAssignment:
type: assignment
debug: false
interact scripts:
- 10 BgInteractions
actions:
on death:
- if player.flag[Bodyguard1] {
- narrate "<red> Your bodyguard has died!" targets:<npc.owner>
- flag player Bodyguard:!
- flag player Bodyguard1:!
- flag npc guarding:!
} elseif player.flag[Bodyguard2] {
- narrate "<red> Your bodyguard has died!" targets:<npc.owner>
- wait 300s
- teleport npc location:<npc.owner.location>
} else player.flag[Bodyguard3] {
- narrate "<red> Your bodyguard has died!" targets:<npc.owner>
- wait 1s
- teleport npc location:<npc.owner.location>
}
BgInteractions:
type: interact
steps:
1:
click trigger:
script:
- if <npc.owner> != <player> {
- narrate "<green><npc.name>:<gold> Im sorry im not your bodyguard."
} else {
- narrate "<green><npc.name>:<gold> What would you like me to do?"
- narrate "<green><npc.name>:<gold> <red>Stand <gold>Guard, <red>Follow <gold>You, Change <red>Equipment<gold>, <red>Rename<gold> or <red>Reskin<gold>?"
- narrate "<green><npc.name>:<gold> Right click me again to cancel"
- narrate "<red>Entering Order Mode."
- ^zap step:2
}
2:
click trigger:
script:
- narrate "<red>Exiting Order Mode."
- zap step:1
chat trigger:
1:
trigger: <gold>/Follow/ me.
script:
- narrate "<green><npc.name>:<gold> Alright i will follow you"
- ^execute as_npc "npc sel <npc.id>"
- ^execute as_npc "sentry guard <player.name>"
- ^flag npc "guarding:true"
- narrate "<red>Exiting Order Mode."
- zap step:1
2:
trigger: <gold>/Stand/ here.
script:
- narrate "<green><npc.name>:<gold> I will guard this spot, talk to me again if you wish for me to follow you again."
- ^execute as_npc "npc sel <npc.id>"
- ^execute as_npc "sentry guard"
- ^flag npc "Guarding:false"
- narrate "<red>Exiting Order Mode."
- zap step:1
3:
trigger: <gold>Id like to /Rename/ you.
script:
- narrate "<green><npc.name>:<gold> Alright what would you like to rename me as?"
- narrate "<red>Exiting Order Mode and Opening Rename Mode"
- zap step:3
4:
trigger: I want to change your /Reskin/
script:
- narrate "<green><npc.name>:<gold> Alright what would you like to change my skin to?"
- narrate "<red>Exiting Order Mode and Opening Reskin Mode"
- zap step:4
5:
trigger: <gold> I want to change your /Equipment/.
script:
- narrate "<green><npc.name>:<gold> Keep in mind if you dont have a respawning bodyguard equipment will be lost on its death"
- execute as_op "npc sel <player.flag[BodyGuard].replace[n@]>"
- execute as_op "npc equip"
- narrate "<red>Equip Mode will end in 30 seconds."
- wait 30
- execute as_op "npc equip"
- zap step:1
3:
chat trigger:
1:
trigger: <gold>I want your new name to be /regex:.+/.
script:
- execute as_server "npc sel <player.flag[BodyGuard].replace[n@]>"
- execute as_server "npc rename <context.message>"
- narrate "<red>Exiting Rename Mode."
- zap step:1
4:
chat trigger:
1:
trigger: <gold> I want you to take the skin of /regex:.+/.
script:
- execute as_server "npc sel <player.flag[BodyGuard].replace[n@]>"
- execute as_server "npc skin <context.message>"
- narrate "<red>Exiting Reskin Mode."
- zap step:1
BodyguardSword:
type: item
material: DIAMOND_SWORD
enchantments:
- KNOCKBACK:2