Paste #26739: Untitled Paste

Date: 2015/12/23 06:08:02 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


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
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760


# Zombie Survival

ZS_DefaultData:
    type: yaml data
    config: 
        help:
        - "&8--- &d&lZombie Survival Arena Help &8---"
        - "&a/zs help &8- &9shows this help information."
        - "&a/zs list &8- &9Lists all arenas."
        - "&a/zs create (name) &8- &9Creates a new arena."
        - "&a/zs remove (arena) &8- &9Deletes an entire arena."
        - "&a/zs check (arena) &8- &9Checks if the arena is ready."
        - "&a/zs status (arena) (Open/Closed) &8- &9Makes an arena joinable."
        - "&a/zs end (arena) &8- &9Forces a close on a running arena."
        - "&a/zs addlobby (arena)"
        - "&a/zs addspawn (arena)"
        - "&a/zs delspawn (arena) (number)"
        - "&a/zs addstart (arena)"
        - "&a/zs delstart (arena) (number)"
        - "&a/zs resetspawn (arena)"
        - "&a/zs resetstart (arena)"
        - "&8--- &8--- &8---"
        npcid:
            Squad1: 41
            Squad2: 39
            Squad3: 40
            Squad4: 38

# Call: <s@ZS_DefaultData.yaml_key[config.help]>

### Arena Flags:
## MapName - (Already defined when calling) (Default)
## Map Status - Status:Open/Running/Closed
## Map Lobby - Lobby:<player.location>
## Spawn locations for mobs - SpawnLocs:<dList>
## Start Positions for players - StartLocs:<dList>
## Wave counter - WaveCounter:21
## Players left in arena - PlayersInArena:<dList>
## Players Spectating - PlayersSpec:<dList>
## Arena Cuboid - ArenaCuboid:<dCuboid>

### Player Flags:
## If they are in a Arena - Survivor:Default
## If they are a spectator - Spec:Default
## Their Coins - Coins:1257
## Highest Record - Highest_Wave:28
## Zombies Total Killed - Zombies_Killed:328

### Main Flags:
## Lobby/Hub - Main_Lobby:<player.location>
## Total_Mobs_Slain:3215
## All Arenas - List_Arenas:<dList>

ZS_Events:
    type: world
    events:
        on player join:
        - if <server.has_file[/ZS/players/<player.uuid>.yml].not> {
            - yaml create id:<player>
            # Setup Basics
            - yaml id:<player> set Coins:0
            - yaml id:<player> set Highest_Wave:0
            - yaml id:<player> set Zombies_Killed:0
            - yaml id:<player> "savefile:/ZS/players/<player.uuid>.yml"
        }
        else {
            - yaml "load:/ZS/players/<player.uuid>.yml" id:<player>
        }

        on player quit:
        - yaml id:<player> "savefile:/ZS/players/<player.uuid>.yml"
        - yaml unload id:<player>

        on server start:
        - inject ZS_LoadConfig

        on script reload:
        - inject ZS_LoadConfig

        on shutdown:
        - yaml unload id:ZS_config

        on resource pack status:
            - if <context.status> == SUCCESSFULLY_LOADED {
                - narrate "<&a>Your resource pack was loaded succesfully!"
                - playsound <player> sound:QuestDone volume:0.5 pitch:1.0 custom
            }
            # else if <context.status> == ACCEPTED {
                # - narrate "<&a>Thank you for using our resource pack!"
                # - narrate "<&7>Your download should begin shortly..."
            # }
            else if <context.status> == DECLINED {
                - wait 5t
                - execute as_server "kick <player.name> Zombie Survival requires Server Resource Pack!"
            }
            else if <context.status> == FAILED_DOWNLOAD {
                - wait 5t
                - execute as_server "kick <player.name> Your resource pack failed to download... try again."
            }

        on entity targets:
        - if <context.target||null> == null || <context.reason> == FORGOT_TARGET {
            - flag <context.entity> Targeting:!
        }
        - flag <context.entity> Targeting:<context.target>

        # - spawn e@zombie[max_health=2;health=2;speed=0.5] <context.location>
        on zombie death:
        - if <context.damager.is_player||false>  {
            - define player "<context.damager>"
        }
        else if <context.damager.shooter.is_player||false> {
            - define player "<context.damager.shooter>"
        }
        - if <server.has_flag[Zombie_Call]> queue clear
        - define Players <context.entity.location.find.players.within[50].random||null>
        - if <def[Players]> == null queue clear
        - flag server Zombie_Call:True duration:15s
        - foreach <context.entity.location.find.entities[ZOMBIE|SKELETON].within[50]> {
            - if <def[value].has_flag[Targeting].not> {
                - attack <def[value]> target:<def[Players].as_list.random>
            }
        }

        ##- remove <context.projectile>
        on player throws egg:
        - determine cancelled passively
        - repeat 10 {
            - playeffect <context.egg.location.below> effect:lava qty:1 data:1 offset:0 
            - wait 2t
        }
        - hurt 6 <context.egg.location.find.living_entities.within[6]> source:<player> 
        - explode power:3 <context.egg.location>



        on player right clicks with ZSHealthPack:
        - if <player.has_flag[ZSUsedPack]> {
            - narrate "<&7>Wait <player.flag[ZSUsedPack].expiration.formatted> to use the it again."
        }
        else if <player.health.as_int> >= <player.health.max.as_int> {
            - narrate "<&7>You already have fuld health!"
        }
        else {
            - take <context.item>
            - narrate "<&b>You used a Health Pack"
            - heal 15
            - flag player ZSUsedPack:True duration:20s
        }

        on player right clicks with ZSMachineGun:
        - if <player.has_flag[ZSSpamClick]> {
            - flag player ZSSpamClick:True duration:2t
            - queue clear
        }
        - flag player ZSSpamClick:True duration:2t
        - if <player.inventory.contains.material[arrow]> {
            - playsound <player.location> sound:SHOOT_ARROW volume:1 pitch:1
            - shoot arrow "origin:<player>" "speed:5.0" "spread:3.0" "gravity:0.0" "shooter:<player>"
            - take arrow quantity:1
            - wait 1t
            - define loc1 <player.location.cursor_on>
            - define loc2 <player.location.above>
            - define len <def[loc1].as_location.distance[<def[loc2]>]>
            - define jump <def[loc1].sub[<def[loc2]>].div[<def[len]>]>
            - if <def[len]> > 10 {
                - define len 10
            }
            - repeat <def[len].div[2]> {
                - playeffect <def[loc2].add[<def[jump].mul[<def[value].mul[2]>]>]> effect:LARGE_SMOKE qty:3 data:0 offset:0.0 
            }
        }
        else {
            - narrate "<&7>No ammo!"
        }

        on player right clicks with ZSShotGun:
        - if <player.has_flag[ZSReloadTimeShotGun]> {
            - queue clear
        }
        - flag player ZSReloadTimeShotGun:True duration:25t
        - if <player.inventory.contains.material[arrow]> {
            - take arrow quantity:3
            - repeat 10 {
                - shoot arrow "origin:<player>" "speed:5.0" "spread:15.0" "gravity:0" "shooter:<player>"
            }
            - playsound <player.location> sound:SHOOT_ARROW volume:1 pitch:1
            - playeffect <player.location.above> effect:LARGE_SMOKE qty:10 data:0 offset:0.3

        }
        else {
            - narrate "<&7>No ammo!"
        }

        on player right clicks with ZSLauncher:
        - if <player.has_flag[ZSReloadTimeLauncher]> {
            - queue clear
        }
        - flag player ZSReloadTimeLauncher:True duration:50t
        - if <player.inventory.contains.material[egg]> {
            - take egg quantity:1
            - shoot arrow "origin:<player>" "speed:5.0" "spread:0.3" "gravity:0" "shooter:<player>" save:projectiles
            - foreach <entry[projectiles].shot_entities> {
                - flag %value% grenade_launcher
            }
            - playsound <player.location> sound:EXPLODE volume:1 pitch:1
            - playeffect <player.location.above> effect:LARGE_SMOKE qty:100 data:2 offset:0.5
            - repeat 5 {
                - playeffect <player.location.above> effect:LARGE_SMOKE qty:3 data:0 offset:0.5
                - wait 1t
            }
        }
        else {
            - narrate "<&7>No ammo!"
        }

        on projectile hits block:
        - if <context.projectile.has_flag[grenade_launcher]> {
            - determine cancelled passively
            - remove <context.projectile>
            - hurt 6 <context.projectile.location.find.living_entities.within[6]> source:<context.projectile.shooter> 
            - explode power:3 <context.projectile.location.above>
        }

        on player shoots bow:
        - if <context.force> == 3.0 {
            - remove <context.projectile>
            - shoot arrow "origin:<player>" "speed:25.0" "spread:0.0" "gravity:0.0" "shooter:<player>"
            - wait 1t
            - define loc1 <player.location.cursor_on>
            - define loc2 <player.location.above>
            - define len <def[loc1].as_location.distance[<def[loc2]>]>
            - define jump <def[loc1].sub[<def[loc2]>].div[<def[len]>]>
            - if <def[len]> > 10 {
                - define len 10
            }
            - repeat <def[len].div[2]> {
                - playeffect <def[loc2].add[<def[jump].mul[<def[value].mul[2]>]>]> effect:LARGE_SMOKE qty:3 data:0 offset:0.0 
            }

        }
        else {
            - determine cancelled passively
            - narrate "<&7>You need to charge the rifle fully in order to "
        }

        on entity kills PIG_ZOMBIE:
        - explode power:3 <context.entity.location>

        on PIG_ZOMBIE damages player:
        - explode power:3 <context.damager.location>

        on player damaged:
        - if <context.cause> == BLOCK_EXPLOSION {
            - determine 2
        }
        - if <player.inventory.contains[i@ZSPersonalShield]> && <player.health> <= 15 && !<player.has_flag[Shield_Cooldown]> {
            - flag player Shield_Cooldown:kage duration:2m
            - cast ABSORPTION duration:20s power:14 
            - narrate "<&b>Shield Activated!"
        }

ZS_LoadConfig:
    type: task
    script:
    - if <server.has_file[/ZS/config.yml].not> {
    - yaml create id:ZS_config
    # Setup Basics
    - yaml id:ZS_config set Main_Lobby:l@0.0,70.0,0.0,world
    - yaml id:ZS_config set Total_Mobs_Slain:0

    # Add Arena and its template
    - yaml id:ZS_config set List_Arenas:->:Test
    - define ArenaName <yaml[ZS_config].read[List_Arenas].get[0]>
    # Status
    - define path Arenas.<def[ArenaName]>.Status
    - yaml id:ZS_config set <def[path]>:Closed
    # Cuboid cu@<position_1>|<position_2>
    - define path Arenas.<def[ArenaName]>.ArenaCuboid
    - yaml id:ZS_config set <def[path]>:cu@l@10.0,62.0,10.0,world|l@-10.0,68.0,-10.0,world
    # Lobby Location
    - define path Arenas.<def[ArenaName]>.Lobby
    - yaml id:ZS_config set <def[path]>:l@0.0,68.0,0.0,world
    # SpawnLocs
    - define path Arenas.<def[ArenaName]>.SpawnLocs
    - yaml id:ZS_config set <def[path]>:->:l@5.0,64.0,0.0,world
    - yaml id:ZS_config set <def[path]>:->:l@0.0,64.0,0.0,world
    - yaml id:ZS_config set <def[path]>:->:l@-5.0,64.0,0.0,world
    # StartLocs
    - define path Arenas.<def[ArenaName]>.StartLocs
    - yaml id:ZS_config set <def[path]>:->:l@5.0,64.0,5.0,world
    - yaml id:ZS_config set <def[path]>:->:l@0.0,64.0,5.0,world
    - yaml id:ZS_config set <def[path]>:->:l@-5.0,64.0,5.0,world
    # CurrentWave
    - define path Arenas.<def[ArenaName]>.CurrentWave
    - yaml id:ZS_config set <def[path]>:0
    # PlayersInArena
    - define path Arenas.<def[ArenaName]>.PlayersInArena
    - yaml id:ZS_config set <def[path]>:->:p@User_Name
    - yaml id:ZS_config set <def[path]>:<-:p@User_Name
    # PlayersSpec
    - define path Arenas.<def[ArenaName]>.PlayersSpec
    - yaml id:ZS_config set <def[path]>:->:p@User_Name
    - yaml id:ZS_config set <def[path]>:<-:p@User_Name
    # Save Template
    - yaml id:ZS_config "savefile:/ZS/config.yml"
}
else {
    - yaml "load:/ZS/config.yml" id:ZS_config
}

ZS_StartGame:
    type: task
    script:
    - 

ZS_EndGame:
    type: task
    script:
    - 

ZS_Command:
    type: command
    name: zs
    description: Zombie Survival setup admin commands
    usage: /zs
    aliases:
    - zombiesurvival
    permission: zs.admin
    permission message: Sorry, <player.name>, you don't have the permission '<permission>'! 
    script:
    # - if !<player.is_op> queue clear
    - if <context.args.size> > 0 {
        - if <context.args.get[1]> == "help" {
            - foreach <s@ZS_DefaultData.yaml_key[config.help]> {
                - narrate "<def[value].parse_color>"
            }
        }
        else if <context.args.get[1]> == "list" {
            - narrate "Arenas available<&co> <&a><yaml[ZS_config].read[List_Arenas].separated_by[<&r>,<&sp><&a>]>"
        }
        else if <context.args.get[1]> == "Create" {
            - if <context.args.size> != 2 {
                - narrate "<&c>Wrong arguments! <&b>/zs help"
                - queue clear
            }
            - define ArenaName <context.args.get[2]>
            # Add Arena and its template
            - yaml id:ZS_config set List_Arenas:->:<def[ArenaName]>
            # Status
            - define path Arenas.<def[ArenaName]>.Status
            - yaml id:ZS_config set <def[path]>:Closed
            # CurrentWave
            - define path Arenas.<def[ArenaName]>.CurrentWave
            - yaml id:ZS_config set <def[path]>:0
            # PlayersInArena
            - define path Arenas.<def[ArenaName]>.PlayersInArena
            - yaml id:ZS_config set <def[path]>:->:p@User_Name
            - yaml id:ZS_config set <def[path]>:<-:p@User_Name
            # PlayersSpec
            - define path Arenas.<def[ArenaName]>.PlayersSpec
            - yaml id:ZS_config set <def[path]>:->:p@User_Name
            - yaml id:ZS_config set <def[path]>:<-:p@User_Name
            # Save Template
            - yaml id:ZS_config "savefile:/ZS/config.yml"
            - narrate "<&a>Succesfully created new arena <def[ArenaName]>"
        }
        else if <context.args.get[1]> == "remove" {
            - if <context.args.size> != 2 {
                - narrate "<&c>Wrong arguments! <&b>/zs help"
                - queue clear
            }
            ## Should remove
            - define ArenaName <context.args.get[2]>
            - if <yaml[ZS_config].read[List_Arenas].contains[<def[ArenaName]>].not> {
                - narrate "<&c>Arena not found! <&b>/zs help"
                - queue clear
            }
            - define path Arenas.<def[ArenaName]>
            - yaml id:ZS_config set <def[path]>:!
            - define path "List_Arenas" 
            - yaml id:ZS_config set <def[path]>:<-:<def[ArenaName]>
            - yaml id:ZS_config "savefile:/ZS/config.yml"
            - narrate "<&a>Succesfully removed arena <def[ArenaName]>"
        }
        else if <context.args.get[1]> == "check" {
            - if <context.args.size> != 2 {
                - narrate "<&c>Wrong arguments! <&b>/zs help"
                - queue clear
            }
            - define ArenaName <context.args.get[2]>
            - if <yaml[ZS_config].read[List_Arenas].contains[<def[ArenaName]>].not> {
                - narrate "<&c>Arena not found! <&b>/zs help"
                - queue clear
            }
            - define check <proc[ZS_CheckArena].context[<context.args.get[2]>]>
            - if <def[check]> == "true" {
                - narrate "<&a><context.args.get[2]> seems to be setup correctly."
                - define path Arenas.<def[ArenaName]>.SpawnLocs
                - define SpawnLocs <yaml[ZS_config].read[<def[path]>]>
                - define path Arenas.<def[ArenaName]>.StartLocs
                - define StartLocs <yaml[ZS_config].read[<def[path]>]>
                - define path Arenas.<def[ArenaName]>.Lobby
                - define Lobby <yaml[ZS_config].read[<def[path]>]>
                - repeat 20 {
                    - foreach <def[SpawnLocs]> {
                        - playeffect <def[value]> effect:RED_DUST qty:3 data:0 offset:0.0 
                    }
                    - foreach <def[StartLocs]> {
                        - playeffect <def[value]> effect:HAPPY_VILLAGER qty:1 data:0 offset:0.0 
                    }
                    - playeffect <def[Lobby]> effect:MOB_SPELL qty:1 data:0 offset:0.0 

                    - wait 5t
                }
            }
            else {
                - narrate "<&c><def[check]> is missing in <context.args.get[2]>!"
            }
        }
        else if <context.args.get[1]> == "AddLobby" {
            - if <context.args.size> != 2 {
                - narrate "<&c>Wrong arguments! <&b>/zs help"
                - queue clear
            }
            - define ArenaName <context.args.get[2]>
            - if <yaml[ZS_config].read[List_Arenas].contains[<def[ArenaName]>].not> {
                - narrate "<&c>Arena not found! <&b>/zs help"
                - queue clear
            }
            - define path Arenas.<def[ArenaName]>.Lobby
            ## Should set lobby Position
            - yaml id:ZS_config set <def[path]>:<player.location.simple.as_location.add[l@0.5,0,0.5,world]>
            - yaml id:ZS_config "savefile:/ZS/config.yml"
            - narrate "<&a>Successfully set lobby position for <def[ArenaName]>"
        }
        else if <context.args.get[1]> == "cuboid" {
            - if <player.has_flag[zs_pos1]> && <player.has_flag[zs_pos2]> {
                - narrate "Sucessfully created cuboid area."
                - flag player zs_pos1:!
                - flag player zs_pos2:!
            }
            else {
                - narrate "<&c>Positions not set! <&b>/zs help"
                - queue clear
            }
        }
        else if <context.args.get[1]> == "pos1" {
            - flag player zs_pos1:<player.location>
        }
        else if <context.args.get[1]> == "pos2" {
            - flag player zs_pos2:<player.location>
        }
        else if <context.args.get[1]> == "AddStart" {
            - if <context.args.size> != 2 {
                - narrate "<&c>Wrong arguments! <&b>/zs help"
                - queue clear
            }
            - define ArenaName <context.args.get[2]>
            - if <yaml[ZS_config].read[List_Arenas].contains[<def[ArenaName]>].not> {
                - narrate "<&c>Arena not found! <&b>/zs help"
                - queue clear
            }
            - define path Arenas.<def[ArenaName]>.StartLocs
            ## Should add Position
            - yaml id:ZS_config set <def[path]>:->:<player.location.simple.as_location.add[l@0.5,0,0.5,world]>
            - define StartLocs <yaml[ZS_config].read[<def[path]>]>
            - yaml id:ZS_config "savefile:/ZS/config.yml"
            - narrate "<&a>Successfully added start location for <def[ArenaName]> (<def[StartLocs].size>)"
        }
        else if <context.args.get[1]> == "AddSpawn" {
            - if <context.args.size> != 2 {
                - narrate "<&c>Wrong arguments! <&b>/zs help"
                - queue clear
            }
            - define ArenaName <context.args.get[2]>
            - if <yaml[ZS_config].read[List_Arenas].contains[<def[ArenaName]>].not> {
                - narrate "<&c>Arena not found! <&b>/zs help"
                - queue clear
            }
            - define path Arenas.<def[ArenaName]>.SpawnLocs
            ## Should add Position
            - yaml id:ZS_config set <def[path]>:->:<player.location.simple.as_location.add[l@0.5,0,0.5,world]>
            - define SpawnLocs <yaml[ZS_config].read[<def[path]>]>
            - yaml id:ZS_config "savefile:/ZS/config.yml"
            - narrate "<&a>Successfully added spawn location for <def[ArenaName]> (<def[SpawnLocs].size>)"
        }
        else if <context.args.get[1]> == "DelStart" {
            - if <context.args.size> != 3 {
                - narrate "<&c>Wrong arguments! <&b>/zs help"
                - queue clear
            }
            - define ArenaName <context.args.get[2]>
            - if <yaml[ZS_config].read[List_Arenas].contains[<def[ArenaName]>].not> {
                - narrate "<&c>Arena not found! <&b>/zs help"
                - queue clear
            }
            - define path Arenas.<def[ArenaName]>.StartLocs
            - if <context.args.get[3].is[matches].to[integer].not> {
                - narrate "<&c>Wrong integer! <&b>/zs help"
                - queue clear
            }
            - if <yaml[ZS_config].contains[<def[path]>].not> {
                - narrate "<&c>Missing path! <&b>/zs help"
                - queue clear
            }
            - define StartLocs <yaml[ZS_config].read[<def[path]>]>
            - if <context.args.get[3]> > <def[StartLocs].size> || <context.args.get[3]> <= 0 {
                - narrate "<&c>Out of index integer! <&b>/zs help"
                - queue clear
            }
            - define path "Arenas.<def[ArenaName]>.StartLocs" 
            - define loc "<def[StartLocs].get[<context.args.get[3]>]>"
            - yaml id:ZS_config set <def[path]>:<-:<def[loc]>
            - yaml id:ZS_config "savefile:/ZS/config.yml"
            - narrate "<&a>Successfully deleted spawn location <context.args.get[3]> for <def[ArenaName]> (<def[StartLocs].size.sub_int[1]>)"
        }
        else if <context.args.get[1]> == "DelSpawn" {
            - if <context.args.size> != 3 {
                - narrate "<&c>Wrong arguments! <&b>/zs help"
                - queue clear
            }
            - define ArenaName <context.args.get[2]>
            - if <yaml[ZS_config].read[List_Arenas].contains[<def[ArenaName]>].not> {
                - narrate "<&c>Arena not found! <&b>/zs help"
                - queue clear
            }
            - define path Arenas.<def[ArenaName]>.SpawnLocs
            - if <context.args.get[3].is[matches].to[integer].not> {
                - narrate "<&c>Wrong integer! <&b>/zs help"
                - queue clear
            }
            - if <yaml[ZS_config].contains[<def[path]>].not> {
                - narrate "<&c>Missing path! <&b>/zs help"
                - queue clear
            }
            - define SpawnLocs <yaml[ZS_config].read[<def[path]>]>
            - if <context.args.get[3]> > <def[SpawnLocs].size> || <context.args.get[3]> <= 0 {
                - narrate "<&c>Out of index integer! <&b>/zs help"
                - queue clear
            }
            - define path "Arenas.<def[ArenaName]>.SpawnLocs" 
            - define loc "<def[SpawnLocs].get[<context.args.get[3]>]>"
            - yaml id:ZS_config set <def[path]>:<-:<def[loc]>
            - yaml id:ZS_config "savefile:/ZS/config.yml"
            - narrate "<&a>Successfully deleted spawn location <context.args.get[3]> for <def[ArenaName]> (<def[SpawnLocs].size.sub_int[1]>)"
        }
        else if <context.args.get[1]> == "ResetSpawn" {
            - if <context.args.size> != 2 {
                - narrate "<&c>Wrong arguments! <&b>/zs help"
                - queue clear
            }
            - define ArenaName <context.args.get[2]>
            - if <yaml[ZS_config].read[List_Arenas].contains[<def[ArenaName]>].not> {
                - narrate "<&c>Arena not found! <&b>/zs help"
                - queue clear
            }
            - define path Arenas.<def[ArenaName]>.SpawnLocs
            - if <yaml[ZS_config].contains[<def[path]>].not> {
                - narrate "<&c>Missing path! <&b>/zs help"
                - queue clear
            }
            ## Should reset Position
            - define SpawnLocs <yaml[ZS_config].read[<def[path]>]>
            - foreach <def[SpawnLocs]> {
                - yaml id:ZS_config set <def[path]>:<-:<def[value]>
            }
            - yaml id:ZS_config "savefile:/ZS/config.yml"
            - narrate "<&a>Successfully reset spawn locations for <def[ArenaName]>"
        }
        else if <context.args.get[1]> == "ResetStart" {
            - if <context.args.size> != 2 {
                - narrate "<&c>Wrong arguments! <&b>/zs help"
                - queue clear
            }
            - define ArenaName <context.args.get[2]>
            - if <yaml[ZS_config].read[List_Arenas].contains[<def[ArenaName]>].not> {
                - narrate "<&c>Arena not found! <&b>/zs help"
                - queue clear
            }
            - define path Arenas.<def[ArenaName]>.StartLocs
            - if <yaml[ZS_config].contains[<def[path]>].not> {
                - narrate "<&c>Missing path! <&b>/zs help"
                - queue clear
            }
            ## Should reset Position
            - define StartLocs <yaml[ZS_config].read[<def[path]>]>
            - foreach <def[StartLocs]> {
                - yaml id:ZS_config set <def[path]>:<-:<def[value]>
            }
            - yaml id:ZS_config "savefile:/ZS/config.yml"
            - narrate "<&a>Successfully reset spawn locations for <def[ArenaName]>"
        }
        else {
            - narrate "<&c>Wrong arguments! <&b>/zs help"
        }
    }
    else {
        - foreach <s@ZS_DefaultData.yaml_key[config.help]> {
            - narrate "<def[value].parse_color>"
        }
    }

    # List arenas
    # Add new arena
    ## set Lobby position to arena (test)
    # Add Spawn Position to arena
    ## Add Start position to arena (test)
    ## Check arena (make effects)
    ## Force-end arena
    ## Close/Open arena

ZS_CheckArena:
    type: procedure
    definitions: ArenaName
    script:
    - define path Arenas.<def[ArenaName]>.Lobby
    - if <yaml[ZS_config].contains[<def[path]>].not> {
        - determine "Lobby"
    }
    - define path Arenas.<def[ArenaName]>.SpawnLocs
    - if <yaml[ZS_config].contains[<def[path]>].not> {
        - determine "Spawn locations"
    }
    - define path Arenas.<def[ArenaName]>.StartLocs
    - if <yaml[ZS_config].contains[<def[path]>].not> {
        - determine "Start locations"
    }
    - define path Arenas.<def[ArenaName]>.ArenaCuboid
    - if <yaml[ZS_config].contains[<def[path]>].not> {
        - determine "Cuboid"
    }
    - determine "true"

ZS_SpawnZombies:
    type: task
    script:
    - define Amount 5
    - define ArenaName Test
    - define locs <yaml[ZS_config].read[Arenas.<def[ArenaName]>.SpawnLocs]>
    - repeat <def[Amount]> {
        - while <proc[ZS_SpawnZombie].context[<def[locs].random>]> {
            - wait 2t
            - if <yaml[ZS_config].read[Arenas.<def[ArenaName]>.Status]> != Running {
                - queue clear
            }
        }
    }

ZS_SpawnZombie:
    type: procedure
    definitions: Randomloc
    script:
    - define Players <def[Randomloc].as_location.find.players.within[8].filter[has_flag[Survivor]]||null>
    - define Nearby <def[Randomloc].as_location.find.players.within[30].filter[has_flag[Survivor]].random||null>
    - if <def[Players]> == null || <def[Players].is_empty> {
        - if <def[Nearby]> == null {
            - determine true
        }
        else {
            - spawn e@zombie[max_health=2;health=2;speed=0.3] <def[Randomloc]> target:<def[Nearby]>
            - determine false
        }
    }
    - determine true



    # - define cuboid cu@<def[loc].as_location.add[l@-20,0,-20,world]>|<def[loc].as_location.add[l@20,0,20,world]>
    # - define list <def[cuboid].as_cuboid.outline>
    # - repeat <def[Amount]> {
        # - define randomPos <def[list].as_list.random.highest>
        # #- if <def[randomPos].as_location.light> <= 7 {
        # - define Players <def[randomPos].as_location.find.players.within[5].filter[<player.has_flag[Survivor]>]||null>
        # - if <def[Players]> == null {
            # - spawn e@zombie[max_health=2;health=2;speed=0.5] <def[randomPos]> target:<def[randomPos].as_location.find.players.within[30].filter[<player.has_flag[Survivor]>].random>
        # }
        # #}
    # }
    # <l@location.highest>
    # <el@element.mod[<#.#>]>

# <yaml[<id>].contains[<path>]>
# <yaml[<id>].read[<path>]>

# .random[9999] on a list of "one|two|three" could return "one|two|three", "one|three|two", "two|one|three", 
# "two|three|one", "three|two|one", OR "three|one|two" - different each time! 

ZSHealthPack:
    type: item
    material: INK_SACK:1
    display name: <green>Health Pack
    lore:
    - Heals 15 health
    - Has 20 seconds cooldown
    - <&6>Right-click to use

ZSRifle:
    type: item
    material: bow:334
    display name: <green>Rifle
    lore:
    - 100% accuracy!
    - Must be fully charged to shoot
    - <&6>Hold right-click to charge

ZSMachineGun:
    type: item
    material: diamond_spade
    display name: <green>Machine Gun
    lore:
    - Rapid-fire weapon!
    - <&6>Hold right-click to shoot

ZSShotGun:
    type: item
    material: GOLD_AXE
    display name: <green>Shot Gun
    lore:
    - Shoots multiple shoots per shot!
    - Has a small reload time
    - <&6>Right-click to shot

ZSReviveStone:
    type: item
    material: NETHER_STAR
    display name: <green>Revive Stone
    lore:
    - Keeps inventory on death.
    - But removes a Revive Stone.
    - <&6>Activates automatically

ZSPersonalShield:
    type: item
    material: GLOWSTONE_DUST
    display name: <green>Personal Shield
    lore:
    - Gives a temperaily shield for
    - 20 seconds when your health is low
    - Has 2 min cooldown
    - <&6>Activates automatically

# ZSMechaChestplate:
    # type: item
    # material: DIAMOND_CHESTPLATE
    # display name: <green>Mecha Chestplate
    # lore:
    # - Reduces knockback from Zombies
    # - <&6>Activates automatically
    ## Knockback resistance

ZSLauncher:
    type: item
    material: GOLD_SPADE 
    display name: <green>Grenade Launcher
    lore:
    - Uses grenades for ammo!
    - Has a medium reload time
    - Causes an explosion on contact!
    - <&6>Right-click to shot