Date: 2015/12/19 17:27:54 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
314
315
316
317
# Zombie Survival
ZS_DefaultData:
type: yaml data
config:
help:
- "&a/zs help &8- &9shows this help information."
- "&a/zs check (arena) &8- &9Checks if the arena is ready."
- "&a/zs addspawn (arena)"
- "&a/zs delspawn (arena) (number)"
- "&a/zs resetspawn (arena)"
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:Standby/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:
- if <server.has_file[/ZS/config.yml].not> {
- yaml create id:ZS_config
# Setup Basics
- yaml id:ZS_config set Main_Lobby:l@0,70,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,62,10,world|l@-10,68,-10,world
# Lobby Location
- define path Arenas.<def[ArenaName]>.Lobby
- yaml id:ZS_config set <def[path]>:l@0,68,0,world
# SpawnLocs
- define path Arenas.<def[ArenaName]>.SpawnLocs
- yaml id:ZS_config set <def[path]>:->:l@5,64,0,world
- yaml id:ZS_config set <def[path]>:->:l@0,64,0,world
- yaml id:ZS_config set <def[path]>:->:l@-5,64,0,world
# StartLocs
- define path Arenas.<def[ArenaName]>.StartLocs
- yaml id:ZS_config set <def[path]>:->:l@5,64,5,world
- yaml id:ZS_config set <def[path]>:->:l@0,64,5,world
- yaml id:ZS_config set <def[path]>:->:l@-5,64,5,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
}
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>
}
}
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]> == "check" {
- if <context.args.size> != 2 {
- narrate "<&c>Wrong arguments! <&b>/zs help"
- queue clear
}
## Should check
- 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."
}
else {
- narrate "<&c><def[check]> is missing in <context.args.get[2]>!"
}
}
else if <context.args.get[1]> == "AddSpawn" {
- if <context.args.size> != 2 {
- narrate "<&c>Wrong arguments! <&b>/zs help"
- queue clear
}
## Should add Position
- define ArenaName <context.args.get[2]>
- define SpawnLocs <yaml[ZS_config].read[<path>]>
- define path Arenas.<def[ArenaName]>.SpawnLocs
- yaml id:ZS_config set <def[path]>:->:<player.location>
- 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]> == "DelSpawn" {
- define ArenaName <context.args.get[2]>
- define path Arenas.<def[ArenaName]>.SpawnLocs
- if <context.args.size> != 3 {
- narrate "<&c>Wrong arguments! <&b>/zs help"
- queue clear
}
- if <context.args.get[3].is[matches].to[integer].not> {
- narrate "<&c>Wrong integer! <&b>/zs help"
- queue clear
}
- define SpawnLocs <yaml[ZS_config].read[<def[path]>]>
- announce "<yaml[ZS_config].read[<def[path]>]>"
- announce "<def[SpawnLocs].size>"
- if <context.args.get[3]> >= <def[SpawnLocs].size> || <context.args.get[3]> < 0 {
- narrate "<&c>Out of index integer! <&b>/zs help"
- queue clear
}
## Should delete Position
- define path "Arenas.<def[ArenaName]>.SpawnLocs[<context.args.get[3]>]"
- announce "Arenas.<def[ArenaName]>.SpawnLocs[<context.args.get[3]>]"
### This right here deletes the whole list ###
- yaml id:ZS_config set <def[path]>:!
- yaml id:ZS_config "savefile:/ZS/config.yml"
- narrate "<&a>Successfully deleted spawn location <context.args.get[3]> for <def[ArenaName]> (<def[SpawnLocs].size>)"
}
else {
- narrate "<&c>Wrong arguments! <&b>/zs help"
}
}
else {
- foreach <s@ZS_DefaultData.yaml_key[config.help]> {
- narrate "<def[value].parse_color>"
}
}
## Add new arena (name)
## Add Lobby position to arena
## Add Spawn Position to arena
## Add Start position to arena
## Check arena
## 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]>.StartLocs]>
- 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>]>
#