Date: 2016/09/12 12:35:42 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
# CTF_Red_Team
# CTF_Blue_Team
# CTF_None_Team
# CTF_Playing
# CTF_Current_Lobby
# CTF_Current_Red_Spawns
# CTF_Current_Red_Flag
# CTF_Current_Blue_Spawns
# CTF_Current_Blue_Flag
CTF_Map_Events:
type: world
debug: false
events:
on server start:
- inject CTF_Load_Data
on reload scripts:
- inject CTF_Load_Data
on player right clicks STANDING_BANNER:
- narrate "Should take"
on player left clicks STANDING_BANNER:
- narrate "Should take"
on player enters Red_Flag:
- narrate "in radius of red flag"
on player enters Blue_Flag:
- narrate "in radius of blue flag"
CTF_Map_Load_Map:
type: task
definitions: map
script:
- define Lobby <yaml[ctf_data].read[ctf.maps.<def[map]>.lobby]>
- define Red_Spawns <yaml[ctf_data].read[ctf.maps.<def[map]>.teams.red.spawns]>
- define Blue_Spawns <yaml[ctf_data].read[ctf.maps.<def[map]>.teams.blue.spawns]>
- define Red_Flag <yaml[ctf_data].read[ctf.maps.<def[map]>.teams.red.flag]>
- define Blue_Flag <yaml[ctf_data].read[ctf.maps.<def[map]>.teams.blue.flag]>
- flag server CTF_Current_Lobby:<def[Lobby]>
- flag server CTF_Current_Red_Spawns:!
- flag server CTF_Current_Blue_Spawns:!
- foreach <def[Red_Spawns]> {
- flag server CTF_Current_Red_Spawns:->:<def[value]>
}
- foreach <def[Blue_Spawns]> {
- flag server CTF_Current_Blue_Spawns:->:<def[value]>
}
- flag server CTF_Current_Red_Flag:<def[Red_Flag]>
- flag server CTF_Current_Blue_Flag:<def[Blue_Flag]>
- note cu@<def[Red_Flag].as_location.add[-1,-1,-1]>|<def[Red_Flag].as_location.add[1,2,1]> as:Red_Flag
- note cu@<def[Blue_Flag].as_location.add[-1,-1,-1]>|<def[Blue_Flag].as_location.add[1,2,1]> as:Blue_Flag
CTF_Map_Load_Data:
type: task
script:
- if <server.has_file[data/CTF/data.yml].not> {
- yaml create id:ctf_data
- define path "ctf.maps.test.title"
- define text "Test Banen"
- yaml id:ctf_data set <def[path]>:<def[text]>
- define path "ctf.maps.test.lobby"
- define text "pos"
- yaml id:ctf_data set <def[path]>:<def[text]>
- define path "ctf.maps.test.teams.red.flag"
- define text "pos"
- yaml id:ctf_data set <def[path]>:<def[text]>
- define path "ctf.maps.test.teams.blue.flag"
- define text "pos"
- yaml id:ctf_data set <def[path]>:<def[text]>
- define path "ctf.maps.test.teams.red.spawns"
- define text "pos"
- yaml id:ctf_data set <def[path]>:->:<def[text]>
- define path "ctf.maps.test.teams.blue.spawns"
- define text "pos"
- yaml id:ctf_data set <def[path]>:->:<def[text]>
- yaml id:ctf_data "savefile:data/CTF/data.yml"
}
else {
- yaml "load:data/CTF/data.yml" id:ctf_data
}
CTF_Map_Command:
type: command
name: ctf
description: Commands for ctf.
usage: /ctf
debug: false
aliases:
- capturetheflag
permission: qmod.admin
permission message: Sorry, <player.name>, you don't have the permission '<permission>'!
script:
- if <context.args.size> >= 1 {
# Help
- if <context.args.get[1]> == "create" {
- if <context.args.size> < 3 {
- narrate "No map display name specified"
- queue clear
}
- define map <context.args.get[2]>
- define title <context.args.get[3]>
- define path "ctf.maps.<def[map]>.title"
- define text "<def[title]>"
- yaml id:ctf_data set <def[path]>:<def[text]>
- define path "ctf.maps.<def[map]>.lobby"
- define text "pos"
- yaml id:ctf_data set <def[path]>:<def[text]>
- define path "ctf.maps.<def[map]>.teams.red.flag"
- define text "pos"
- yaml id:ctf_data set <def[path]>:<def[text]>
- define path "ctf.maps.<def[map]>.teams.blue.flag"
- define text "pos"
- yaml id:ctf_data set <def[path]>:<def[text]>
- define path "ctf.maps.<def[map]>.teams.red.spawns"
- define text "pos"
- yaml id:ctf_data set <def[path]>:->:<def[text]>
- yaml id:ctf_data set <def[path]>:<-:<def[text]>
- define path "ctf.maps.<def[map]>.teams.blue.spawns"
- define text "pos"
- yaml id:ctf_data set <def[path]>:->:<def[text]>
- yaml id:ctf_data set <def[path]>:<-:<def[text]>
- yaml id:ctf_data "savefile:data/CTF/data.yml"
- narrate "<&a>Successfully created map <&e><def[title]>"
}
else if <context.args.get[1]> == "set" {
- if <context.args.size> < 3 {
- narrate "No map name specified"
- queue clear
}
- define map <context.args.get[3]>
- if <yaml[ctf_data].list_keys[ctf.maps].contains[<def[map]>].not> {
- narrate "<&c>Ingen map fundet"
- queue clear
}
- if <context.args.get[2]> == "lobby" {
- define path "ctf.maps.<def[map]>.lobby"
- define text "<player.location.simple>"
- yaml id:ctf_data set <def[path]>:<def[text]>
- narrate "<&a>Successfully set lobby position at <&b><player.location.simple> in <def[map]>"
}
else if <context.args.get[2]> == "flag" {
- if <context.args.size> < 4 {
- queue clear
}
- define loc <player.location.simple>
- define map <context.args.get[3]>
- define team <context.args.get[4]>
- if <yaml[ctf_data].list_keys[ctf.maps.<def[map]>.teams].contains[<def[team]>].not> {
- narrate "<&c>Ingen team fundet"
}
- define path "ctf.maps.<def[map]>.teams.<def[team]>.flag"
- define text "<def[loc]>"
- yaml id:ctf_data set <def[path]>:<def[text]>
- narrate "<&a>Successfully set flag position at <&b><def[loc]> <&a>for <&b><def[team]> <&a>team in <def[map]>"
}
else if <context.args.get[2]> == "spawn" {
- if <context.args.size> < 4 {
- queue clear
}
- define loc <player.location.simple>
- define map <context.args.get[3]>
- define team <context.args.get[4]>
- if <yaml[ctf_data].list_keys[ctf.maps.<def[map]>.teams].contains[<def[team]>].not> {
- narrate "<&c>Ingen team fundet"
}
- define path "ctf.maps.<def[map]>.teams.<def[team]>.spawns"
- define text "<def[loc]>"
- yaml id:ctf_data set <def[path]>:->:<def[text]>
- narrate "<&a>Successfully set spawn position at <&b><def[loc]> <&a>for <&b><def[team]> <&a>team in <def[map]>"
}
else {
- narrate "<&c>No type found..."
- queue clear
}
- yaml id:ctf_data "savefile:data/CTF/data.yml"
}
else if <context.args.get[1]> == "remove" {
- if <context.args.size> < 3 {
- queue clear
}
- define map <context.args.get[3]>
- if <yaml[ctf_data].list_keys[ctf.maps].contains[<def[map]>].not> {
- narrate "<&c>Ingen map fundet"
- queue clear
}
- if <context.args.get[2]> == "spawn" {
- if <context.args.size> < 5 {
- queue clear
}
- define team <context.args.get[4]>
- if <yaml[ctf_data].list_keys[ctf.maps.<def[map]>.teams].contains[<def[team]>].not> {
- narrate "<&c>Ingen team fundet"
}
- define number <context.args.get[5]>
- define loc <yaml[ctf_data].read[ctf.maps.<def[map]>.teams.<def[team]>.spawns].get[<def[number]>]>
- define path "ctf.maps.<def[map]>.teams.<def[team]>.spawns"
- define text "<def[loc]>"
- yaml id:ctf_data set <def[path]>:<-:<def[text]>
- narrate "<&a>Successfully removed spawn position at <&b><def[loc]> <&a>for <&b><def[team]> <&a>team in <def[map]>"
}
else {
- narrate "<&c>No type found..."
- queue clear
}
- yaml id:ctf_data "savefile:data/CTF/data.yml"
}
else if <context.args.get[1]> == "check" {
- if <context.args.size> < 2 {
- narrate "<&c>Not enough arguments"
- queue clear
}
- define map <context.args.get[2]>
- if <yaml[ctf_data].list_keys[ctf.maps].contains[<def[map]>].not> {
- narrate "<&c>Map not found"
- queue clear
}
- define Lobby <yaml[ctf_data].read[ctf.maps.<def[map]>.lobby].as_location.add[0.5,-0.5,0.5]>
- define Red_Spawns <yaml[ctf_data].read[ctf.maps.<def[map]>.teams.red.spawns].parse[as_location.add[0.5,-0.5,0.5]]>
- define Blue_Spawns <yaml[ctf_data].read[ctf.maps.<def[map]>.teams.blue.spawns].parse[as_location.add[0.5,-0.5,0.5]]>
- define Red_Flag <yaml[ctf_data].read[ctf.maps.<def[map]>.teams.red.flag].as_location.add[0.5,-0.5,0.5]>
- define Blue_Flag <yaml[ctf_data].read[ctf.maps.<def[map]>.teams.blue.flag].as_location.add[0.5,-0.5,0.5]>
- narrate "<&b>There are <&e><def[Red_Spawns].size> <&b>spawns for Red"
- narrate "<&b>There are <&e><def[Blue_Spawns].size> <&b>spawns for Blue"
- repeat 20 {
- foreach <def[Blue_Spawns]> {
- playeffect <def[value]> effect:RED_DUST qty:5 data:0 offset:0.1
}
- foreach <def[Red_Spawns]> {
- playeffect <def[value]> effect:RED_DUST qty:5 data:0 offset:0.1
}
- playeffect <def[Lobby]> effect:MOB_SPELL qty:3 data:0 offset:0.1
- playeffect <def[Red_Flag]> effect:HAPPY_VILLAGER qty:3 data:0 offset:0.1
- playeffect <def[Blue_Flag]> effect:HAPPY_VILLAGER qty:3 data:0 offset:0.1
- wait 5t
}
}
}
else {
- inject CTF_Command_Help
}
CTF_Map_Command_Help:
type: task
script:
- narrate "<&b>/ctf create (map)"
- narrate "<&b>/ctf set (lobby/flag/spawn) (map) (team)"
- narrate "<&b>/ctf remove spawn (map) (team) (number)"
- narrate "<&b>/ctf check (map)"