Date: 2023/08/30 01:15:10 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
NemesisSystemArmor:
type: task
script:
- foreach <player.item_in_hand.trim> key:key as:val:
- narrate "<[key]> is set as <[val]>"
#EquipHelmet:
# type: task
# script:
OrcGruntEquip:
debug: false
type: world
events:
on husk||stray||ZOMBIFIED_PIGLIN||PIGLIN||WITHER_SKELETON spawns:
- define headgear:<list[leather_helmet|chainmail_helmet|golden_helmet|iron_helmet|diamond_helmet|netherite_helmet|air].random>
- define material:<script[AllEnchants].data_key[Trims].get[Material].random>
- define pattern:<script[AllEnchants].data_key[Trims].get[Pattern].random>
- if <util.random_chance[50]>:
- equip <context.entity> head:<[headgear]>
- else:
- equip <context.entity> head:<item[<[headgear]>].with[trim=<map[material=<[Material]>;pattern=<[Pattern]>]>]>
- if <util.random_chance[4]>:
- define modifier <util.random.int[1].to[5]>
- equip <context.entity> head:<[headgear]>[enchantments=<script[AllEnchants].data_key[Enchants].get[Armor].random>,<[modifier]>]
- define chestgear:<list[leather_chestplate|chainmail_chestplate|golden_chestplate|iron_chestplate|diamond_chestplate|netherite_chestplate|AIR].random>
- define material:<script[AllEnchants].data_key[Trims].get[Material].random>
- define pattern:<script[AllEnchants].data_key[Trims].get[Pattern].random>
- if <util.random_chance[50]>:
- equip <context.entity> chest:<[chestgear]>
- else:
- equip <context.entity> chest:<item[<[chestgear]>].with[trim=<map[material=<[Material]>;pattern=<[Pattern]>]>]>
- if <util.random_chance[4]>:
- define modifier <util.random.int[1].to[5]>
- equip <context.entity> chest:<[chestgear]>[enchantments=<script[AllEnchants].data_key[Enchants].get[Armor].random>,<[modifier]>]
- define leggear:<list[leather_leggings|chainmail_leggings|golden_leggings|iron_leggings|diamond_leggings|netherite_leggings|AIR].random>
- define material:<script[AllEnchants].data_key[Trims].get[Material].random>
- define pattern:<script[AllEnchants].data_key[Trims].get[Pattern].random>
- if <util.random_chance[50]>:
- equip <context.entity> legs:<[leggear]>
- else:
- equip <context.entity> legs:<item[<[leggear]>].with[trim=<map[material=<[Material]>;pattern=<[Pattern]>]>]>
- if <util.random_chance[4]>:
- define modifier <util.random.int[1].to[5]>
- equip <context.entity> legs:<[leggear]>[enchantments=<script[AllEnchants].data_key[Enchants].get[Armor].random>,<[modifier]>]
- define bootgear:<list[leather_boots|chainmail_boots|golden_boots|iron_boots|diamond_boots|netherite_boots|AIR].random>
- define material:<script[AllEnchants].data_key[Trims].get[Material].random>
- define pattern:<script[AllEnchants].data_key[Trims].get[Pattern].random>
- if <util.random_chance[50]>:
- equip <context.entity> boots:<[bootgear]>
- else:
- equip <context.entity> boots:<item[<[bootgear]>].with[trim=<map[material=<[Material]>;pattern=<[Pattern]>]>]>
- if <util.random_chance[4]>:
- define modifier <util.random.int[1].to[5]>
- equip <context.entity> boots:<[bootgear]>[enchantments=<script[AllEnchants].data_key[Enchants].get[Armor].random>,<[modifier]>]
- if <context.entity> matches stray:
- if <util.random_chance[10]>:
- random:
- mount stray|phantom <context.location>
- mount stray|chicken <context.location>
- mount stray|spider <context.location>
- if <util.random_chance[8]>:
- define modifier <util.random.int[1].to[5]>
- equip <context.entity> hand:bow[enchantments=<script[AllEnchants].data_key[Enchants].get[bow].random>,<[modifier]>]
- stop
- if <context.entity> matches wither_skeleton:
- if <util.random_chance[15]>:
- random:
- mount wither_skeleton|phantom <context.location>
- mount wither_skeleton|chicken <context.location>
- mount wither_skeleton|spider <context.location>
- mount wither_skeleton|wither_skeleton <context.location>
- if <util.random_chance[20]>:
- define modifier <util.random.int[1].to[5]>
- equip <context.entity> hand:bow[enchantments=<script[AllEnchants].data_key[Enchants].get[bow].random>,<[modifier]>]
- stop
- random:
- random:
- repeat 1:
- if <util.random_chance[18]>:
- equip <context.entity> offhand:shield
- cast slow <context.entity> duration:infinite amplifier:0
- else:
- cast speed <context.entity> duration:infinite amplifier:0
- if <util.random_chance[8]>:
- define modifier <util.random.int[1].to[5]>
- equip <context.entity> hand:wooden_sword[enchantments=<script[AllEnchants].data_key[Enchants].get[NormalMelee].random>,<[modifier]>]
- repeat 1:
- equip <context.entity> hand:stone_sword
- if <util.random_chance[18]>:
- equip <context.entity> offhand:shield
- cast slow <context.entity> duration:infinite amplifier:0
- else:
- cast speed <context.entity> duration:infinite amplifier:0
- if <util.random_chance[8]>:
- define modifier <util.random.int[1].to[5]>
- equip <context.entity> hand:stone_sword[enchantments=<script[AllEnchants].data_key[Enchants].get[NormalMelee].random>,<[modifier]>]
- repeat 1:
- equip <context.entity> hand:golden_sword
- if <util.random_chance[18]>:
- equip <context.entity> offhand:shield
- cast slow <context.entity> duration:infinite amplifier:0
- else:
- cast speed <context.entity> duration:infinite amplifier:0
- if <util.random_chance[8]>:
- define modifier <util.random.int[1].to[5]>
- equip <context.entity> hand:golden_sword[enchantments=<script[AllEnchants].data_key[Enchants].get[NormalMelee].random>,<[modifier]>]
- repeat 1:
- equip <context.entity> hand:iron_sword
- if <util.random_chance[18]>:
- equip <context.entity> offhand:shield
- cast slow <context.entity> duration:infinite amplifier:0
- else:
- cast speed <context.entity> duration:infinite amplifier:0
- if <util.random_chance[8]>:
- define modifier <util.random.int[1].to[5]>
- equip <context.entity> hand:iron_sword[enchantments=<script[AllEnchants].data_key[Enchants].get[NormalMelee].random>,<[modifier]>]
- repeat 1:
- equip <context.entity> hand:diamond_sword
- if <util.random_chance[18]>:
- equip <context.entity> offhand:shield
- cast slow <context.entity> duration:infinite amplifier:0
- else:
- cast speed <context.entity> duration:infinite amplifier:0
- if <util.random_chance[8]>:
- define modifier <util.random.int[1].to[5]>
- equip <context.entity> hand:diamond_sword[enchantments=<script[AllEnchants].data_key[Enchants].get[NormalMelee].random>,<[modifier]>]
- repeat 1:
- equip <context.entity> hand:netherite_sword
- if <util.random_chance[18]>:
- equip <context.entity> offhand:shield
- cast slow <context.entity> duration:infinite amplifier:0
- else:
- cast speed <context.entity> duration:infinite amplifier:0
- if <util.random_chance[8]>:
- define modifier <util.random.int[1].to[5]>
- equip <context.entity> hand:netherite_sword[enchantments=<script[AllEnchants].data_key[Enchants].get[NormalMelee].random>,<[modifier]>]
- random:
- repeat 1:
- equip <context.entity> hand:wooden_axe
- equip <context.entity> offhand:wooden_axe
- repeat 1:
- equip <context.entity> hand:stone_axe
- equip <context.entity> offhand:stone_axe
- repeat 1:
- equip <context.entity> hand:golden_axe
- equip <context.entity> offhand:golden_axe
- repeat 1:
- equip <context.entity> hand:iron_axe
- equip <context.entity> offhand:iron_axe
- repeat 1:
- equip <context.entity> hand:diamond_axe
- equip <context.entity> offhand:diamond_axe
- repeat 1:
- equip <context.entity> hand:netherite_axe
- equip <context.entity> offhand:netherite_axe
- equip <context.entity> hand:trident
OrcGruntSpearThrow:
type: world
events:
on husk||ZOMBIFIED_PIGLIN||PIGLIN||WITHER_SKELETON targets entity:
- if <context.entity.item_in_hand> matches trident:
- while <context.entity.location.distance[<context.target.location>]> >= 5 && <context.entity.location.distance[<context.target.location>]> <= 27:
- wait 1s
- if <util.random_chance[15]>:
- shoot trident origin:<context.entity.eye_location> shooter:<context.entity> destination:<context.target.eye_location> speed:3 spread:5
- else if <[loop_index]> <= 50:
- wait 3s
- else:
- stop
#OrcGruntAxeAttack:
# type: world
# events:
# on husk||ZOMBIFIED_PIGLIN||PIGLIN damages entity with:*_axe:
# - determine <context.damage.mul[1.1]>
PlayerStunAttack:
type: world
events:
on player right clicks husk||stray||iron_golem||spider||creeper||ZOMBIFIED_PIGLIN||PIGLIN||MAGMA_CUBE||WITHER_SKELETON||NPC:
- ratelimit <player> 2s
- if <context.entity.eye_location.facing[<player>]> && <context.entity.item_in_offhand> matches shield:
- narrate "<&6>Stun failed! The enemy was facing the shield towards you!"
- stop
- narrate "<&b>Enemy Stunned!"
- flag <context.entity> Stunned expire:8s
- playsound sound:ENTITY_BLAZE_HURT <player.location>
- hurt 2 <context.entity> source:<player>
- cast slow <context.entity> duration:8s amplifier:4
BackStabAttack:
type: world
events:
on player damages husk||ZOMBIFIED_PIGLIN||PIGLIN||WITHER_SKELETON||NPC:
- if <player.item_in_hand> matches bow:
- stop
- if <player.location.distance[<context.entity.location>]> >= 4.5:
- stop
- if <context.entity.item_in_hand> matches *_axe || <context.entity.item_in_offhand> matches shield:
- if <context.entity.eye_location.facing[<player>]>:
- if !<context.entity.has_flag[Stunned]>:
- narrate "Stun a dual axe-wielding/shield-bearing enemy <&c>(right click) <&f>or attack them from behind to damage them!"
- if <util.random_chance[25]>:
- hurt 2 <player>
- if <context.entity.item_in_offhand> matches shield:
- animate <context.entity> animation:SHIELD_BLOCK
- determine cancelled
- if <context.entity.item_in_offhand> matches *_axe:
- hurt 1 <player>
NemesisMake:
type: world
events:
on player dies by:husk||stray||ZOMBIFIED_PIGLIN||PIGLIN||WITHER_SKELETON:
- announce "Death at <player.location.simple>"
- create <context.damager.entity_type> Nemesis <player.location> traits:Sentinel save:NCreate
- flag server NemesisList:->:<entry[NCreate].created_npc>
- equip <entry[NCreate].created_npc> head:<context.damager.equipment.get[4]>
- equip <entry[NCreate].created_npc> legs:<context.damager.equipment.get[2]>
- equip <entry[NCreate].created_npc> chest:<context.damager.equipment.get[3]>
- equip <entry[NCreate].created_npc> boots:<context.damager.equipment.get[1]>
- equip <entry[NCreate].created_npc> hand:<context.damager.item_in_hand>
- equip <entry[NCreate].created_npc> offhand:<context.damager.item_in_offhand>
- execute as_server "npc sel <entry[NCreate].created_npc.id>"
- execute as_server "sentinel addtarget PLAYER"
- execute as_server "sentinel respawntime -1"
- execute as_server "sentinel enemydrops"
- define health <util.random.decimal[20].to[40]>
- execute as_server "sentinel health <[health]>"
- define reach <util.random.decimal[2].to[4.5]>
- execute as_server "sentinel reach <[reach]>"
- execute as_server "sentinel range 55"
- define attackrate <util.random.decimal[0.4].to[7.6]>
- execute as_server "sentinel attackrate <[attackrate]> 'ranged'"
- define attackrate <util.random.decimal[0.4].to[7.6]>
- execute as_server "sentinel attackrate <[attackrate]>"
- define speed <util.random.decimal[1].to[1.4]>
- execute as_server "sentinel speed <[speed]>"
- execute as_server "sentinel addtarget NPC:Spawn_Protector"
- execute as_server "sentinel chaseranged"
- if <util.random_chance[50]>:
- despawn <entry[NCreate].created_npc>
- if <util.random_chance[50]>:
- execute as_server "sentinel addtarget NPC:Nemesis"
- flag server <entry[NCreate].created_npc>Hand:<context.damager.item_in_hand>
- flag server <entry[NCreate].created_npc>OffHand:<context.damager.item_in_offhand>
- flag server <entry[NCreate].created_npc>Helmet:<context.damager.equipment.get[4]>
- flag server <entry[NCreate].created_npc>Leggings:<context.damager.equipment.get[2]>
- flag server <entry[NCreate].created_npc>Chestplate:<context.damager.equipment.get[3]>
- flag server <entry[NCreate].created_npc>Boots:<context.damager.equipment.get[1]>
NemesisBuff:
type: world
events:
on player dies by:NPC:
- if <context.damager.item_in_hand> matches *_sword||*_axe:
- define modifier <util.random.int[1].to[5]>
- define RNGEnchant <script[AllEnchants].data_key[Enchants].get[NormalMelee].random>
- equip <context.damager> hand:<context.damager.item_in_hand>[enchantments=<[RNGEnchant]>,<[modifier]>]
- narrate "<&4><context.damager.name> got the enchant of <&e><[RNGEnchant]> <&4>with a level of <&e><[modifier]><&4> on their main hand!"
- flag server <context.damager>Hand:<context.damager.item_in_hand>
- if <context.damager.item_in_hand> matches bow:
- define modifier <util.random.int[1].to[5]>
- define RNGEnchant <script[AllEnchants].data_key[Enchants].get[bow].random>
- equip <context.damager> hand:<context.damager.item_in_hand>[enchantments=<[RNGEnchant]>,<[modifier]>]
- narrate "<&4><context.damager.name> got the enchant of <&e><[RNGEnchant]> <&4>with a level of <&e><[modifier]><&4> on their main hand!"
- flag server <context.damager>Hand:<context.damager.item_in_hand>
- if <util.random_chance[50]>:
- define modifier <util.random.int[1].to[5]>
- define RNGEnchant <script[AllEnchants].data_key[Enchants].get[Armor].random>
- equip <context.damager> chest:<context.damager.equipment.get[3]>[enchantments=<[RNGEnchant]>,<[modifier]>]
- narrate "<&4><context.damager.name> got the enchant of <&e><[RNGEnchant]> <&4>with a level of <&e><[modifier]><&4> on their chestplate!"
- flag server <context.damager>Chestplate:<context.damager.equipment.get[3]>
- if <util.random_chance[50]>:
- define modifier <util.random.int[1].to[5]>
- define RNGEnchant <script[AllEnchants].data_key[Enchants].get[Armor].random>
- equip <context.damager> legs:<context.damager.equipment.get[2]>[enchantments=<[RNGEnchant]>,<[modifier]>]
- narrate "<&4><context.damager.name> got the enchant of <&e><[RNGEnchant]> <&4>with a level of <&e><[modifier]><&4> on their leggings!"
- flag server <context.damager>Leggings:<context.damager.equipment.get[2]>
- if <util.random_chance[50]>:
- define modifier <util.random.int[1].to[5]>
- define RNGEnchant <script[AllEnchants].data_key[Enchants].get[Armor].random>
- equip <context.damager> head:<context.damager.equipment.get[4]>[enchantments=<[RNGEnchant]>,<[modifier]>]
- narrate "<&4><context.damager.name> got the enchant of <&e><[RNGEnchant]> <&4>with a level of <&e><[modifier]><&4> on their helmet!"
- flag server <context.damager>Helmet:<context.damager.equipment.get[4]>
- if <util.random_chance[50]>:
- define modifier <util.random.int[1].to[5]>
- define RNGEnchant <script[AllEnchants].data_key[Enchants].get[Armor].random>
- equip <context.damager> boots:<context.damager.equipment.get[1]>[enchantments=<[RNGEnchant]>,<[modifier]>]
- narrate "<&4><context.damager.name> got the enchant of <&e><[RNGEnchant]> <&4>with a level of <&e><[modifier]><&4> on their boots!"
- flag server <context.damager>Boots:<context.damager.equipment.get[1]>
- if <util.random_chance[10]>:
- if <context.damager.has_flag[PoisonDamage]> || <context.damager.has_flag[WitherDamage]> || <context.damager.has_flag[HungerDamage]> :
- stop
- define Ability <list[PoisonDamage|WitherDamage|HungerDamage].random>
- flag <context.damager> <[Ability]>
- narrate "<&4><context.damager.name> Learned <&e><[Ability]>!"
NemesisPoisonAttack:
type: world
events:
on NPC_flagged:PoisonDamage damages entity:
- if <npc.has_flag[Stunned]>:
- stop
- cast poison <context.entity> amplifier:0 duration:8s
NemesisWitherAttack:
type: world
events:
on NPC_flagged:WitherDamage damages entity:
- if <npc.has_flag[Stunned]>:
- stop
- cast wither <context.entity> amplifier:0 duration:8s
NemesisHungerAttack:
type: world
events:
on NPC_flagged:HungerDamage damages entity:
- if <npc.has_flag[Stunned]>:
- stop
- cast hunger <context.entity> amplifier:0 duration:8s
NemesisDie:
type: world
events:
on NPC dies:
- random:
- drop <server.flag[<npc>Hand]>|<server.flag[<npc>Offhand]>|<server.flag[<npc>Helmet]>|<server.flag[<npc>Chestplate]>|<server.flag[<npc>Leggings]>|<server.flag[<npc>Boots]> <npc.location>
- drop <server.flag[<npc>Hand]> <NPC.location>
- drop <list[<server.flag[<npc>Hand]>|<server.flag[<npc>Offhand]>|<server.flag[<npc>Helmet]>|<server.flag[<npc>Chestplate]>|<server.flag[<npc>Leggings]>|<server.flag[<npc>Boots]>].random> <npc.location>
# - announce <context.drops>
- flag server NemesisList:<-:<npc>
- wait 1t
# - flag server Hand<npc.id>:!
# - flag server OffHand<npc.id>:!
# - flag server Helmet<npc.id>:!
# - flag server Leggings<npc.id>:!
# - flag server Chestplate<npc.id>:!
# - flag server Boots<npc.id>:!
NemesisTarget:
debug: false
type: world
events:
after NPC targets entity:
- while <context.entity.location.distance[<context.target.location>]> >= 0.2 && <context.entity.location.distance[<context.target.location>]> <= 20:
- wait 1s
- if <util.random_chance[50]>:
- adjust <context.entity> velocity:0,0.45,0
- else if <[loop_index]> <= 50:
- wait 5s
- else:
- stop
NemesisSpawn:
type: world
debug: false
events:
on system time secondly every:1:
- foreach <server.online_players> as:p:
- if <util.random_chance[0.2]> && <[p].gamemode> == SURVIVAL && !<[p].has_flag[NemesisNear]>:
- narrate "<&c>Careful <[p].name>! A Nemesis has spawned near you!" targets:<[p]>
- define px <util.random.int[-25].to[25]>
- define py <util.random.int[-25].to[25]>
- define pz <util.random.int[-25].to[25]>
- while !<[p].location.add[<[px]>,<[py]>,<[pz]>].is_spawnable>:
- define px <util.random.int[-25].to[25]>
- define py <util.random.int[-25].to[25]>
- define pz <util.random.int[-25].to[25]>
- define RandomNemesis:<server.flag[NemesisList].random>
- despawn <[RandomNemesis]>
- wait 1s
- spawn <[RandomNemesis]> <[p].location.add[<[px]>,<[py]>,<[pz]>]>
- flag <player> NemesisNear expire:2m
AttackWhileStunnedCancel:
type: world
events:
on entity_flagged:Stunned damages entity:
- determine cancelled
SpawnHusk:
debug: false
type: world
events:
on zombie spawns:
- determine passively cancelled
- spawn husk <context.location>
SpawnStray:
debug: false
type: world
events:
on skeleton spawns:
- determine passively cancelled
- spawn stray <context.location>