-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patheventDeathmatch.ser
More file actions
360 lines (321 loc) · 13.4 KB
/
Copy patheventDeathmatch.ser
File metadata and controls
360 lines (321 loc) · 13.4 KB
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
# Event Pack worker. Start through the `event` command from eventManager.ser.
func PrepareDeathmatchLoadout with @loadoutTargets $loadoutWeapon
ClearInventory @loadoutTargets destroy
# Base SER has no reserve-ammo setter. Grant two standard loadouts to add
# all common ammunition, then destroy only the granted items.
GrantLoadout @loadoutTargets NtfCaptain
GrantLoadout @loadoutTargets ChaosConscript
over @loadoutTargets with @loadoutPlayer
ephm &grantedItems = @loadoutPlayer -> inventory
over &grantedItems with *grantedItem
AdvDestroyItem *grantedItem
end
end
GiveItem @loadoutTargets $loadoutWeapon
ForceEquip @loadoutTargets $loadoutWeapon
end
func LockDeathmatchZone with $zoneToLock
if $zoneToLock is "lcz"
LockDoor LczCheckpointA AdminCommand
LockDoor LczCheckpointB AdminCommand
elif $zoneToLock is "hcz"
LockDoor HczCheckpointA AdminCommand
LockDoor HczCheckpointB AdminCommand
LockDoor HczCheckpointToEntranceZone AdminCommand
else
LockDoor EzGateA AdminCommand
LockDoor EzGateB AdminCommand
LockDoor HczCheckpointToEntranceZone AdminCommand
end
end
func SpawnDeathmatchFfa with @spawnTargets $spawnZone
over @spawnTargets with @spawnPlayer $spawnIndex
ephm $spawnSlot = $spawnIndex % 3
if $spawnZone is "lcz"
if $spawnSlot is 1
TPRoom @spawnPlayer Lcz914
elif $spawnSlot is 2
TPRoom @spawnPlayer LczClassDSpawn
else
TPRoom @spawnPlayer LczGreenhouse
end
elif $spawnZone is "hcz"
if $spawnSlot is 1
TPRoom @spawnPlayer Hcz049
elif $spawnSlot is 2
TPRoom @spawnPlayer Hcz939
else
TPRoom @spawnPlayer HczTestroom
end
else
if $spawnSlot is 1
TPRoom @spawnPlayer EzOfficeLarge
elif $spawnSlot is 2
TPRoom @spawnPlayer EzIntercom
else
TPRoom @spawnPlayer EzRedroom
end
end
end
end
func SpawnDeathmatchTeams with @blueTeam @redTeam $spawnZone
if $spawnZone is "lcz"
TPRoom @blueTeam Lcz914
TPRoom @redTeam LczClassDSpawn
elif $spawnZone is "hcz"
TPRoom @blueTeam Hcz049
TPRoom @redTeam Hcz939
else
TPRoom @blueTeam EzOfficeLarge
TPRoom @redTeam EzIntercom
end
end
func SpawnDeathmatchFinal with @finalTargets $finalZone
if $finalZone is "lcz"
TPRoom @finalTargets Lcz173 0 1 0
LockDoor Lcz173 AdminCommand
elif $finalZone is "hcz"
TPRoom @finalTargets Hcz049 0 1 0
LockDoor Hcz049 AdminCommand
else
TPRoom @finalTargets EzOfficeSmall 0 1 0
LockDoor EzOfficeSmall AdminCommand
end
end
if {VarExists $serPackActive} is false
Print "Event Pack rejected a direct run of eventDeathmatch. Use the 'event' command."
stop
end
if {VarExists $serPackName} is false
Print "Event Pack rejected a direct run of eventDeathmatch. Use the 'event' command."
stop
end
if $serPackActive is false or $serPackName isnt "Deathmatch"
Print "Event Pack rejected a direct run of eventDeathmatch. Use the 'event' command."
stop
end
if {VarExists @eventParticipants} is false
Print "Event Pack rejected a direct run of eventDeathmatch. Use the 'event' command."
stop
end
attempt
global $serPackPhase = "Preparing round"
SetRoundLock true
SetLobbyLock false
Decontamination disable
Warhead stop
Warhead lock
WaveRespawnTokens chaosWave set 0
WaveRespawnTokens miniChaosWave set 0
WaveRespawnTokens miniMtfWave set 0
WaveRespawnTokens mtfWave set 0
WaveRespawnTime chaosWave set 1h
WaveRespawnTime miniChaosWave set 1h
WaveRespawnTime miniMtfWave set 1h
WaveRespawnTime mtfWave set 1h
CleanupPickups
CleanupRagdolls
StartRound
wait 1s
@eventParticipants = Intersect @eventParticipants @all
if {AmountOf @eventParticipants} < 2
global $serPackPhase = "Cancelled — restarting"
Broadcast @all 5s "<color=#ff6b6b><b>DEATHMATCH CANCELLED</b></color><br>Fewer than two participants remain connected. The round will restart."
wait 5s
RestartRound
stop
end
@nonParticipants = Except @all @eventParticipants
if {AmountOf @nonParticipants} > 0
SetRole @nonParticipants Spectator None
end
@winner = @empty
if $eventMode is "ffa"
global $serPackPhase = "Deathmatch FFA"
SetFriendlyFire true
SetRole @eventParticipants ClassD None
wait 500ms
SetGodMode @eventParticipants true
GiveEffect @eventParticipants Ensnared 8s
SetMaxHealth @eventParticipants 100
SetHealth @eventParticipants 100
SetCustomInfo @eventParticipants "<color=#ffd166>DEATHMATCH | FFA</color>"
run PrepareDeathmatchLoadout @eventParticipants $eventWeapon
run SpawnDeathmatchFfa @eventParticipants $eventZone
run LockDeathmatchZone $eventZone
Broadcast @all 8s "<size=30><color=#ffd166><b>DEATHMATCH — FFA</b></color></size><br>Zone: {$eventZone} | Weapon: {$eventWeapon}<br>The last player alive wins."
Countdown @eventParticipants 7s "<color=#ffd166><b>FIGHT STARTS IN %seconds%...</b></color>"
wait 7s
ClearEffect @eventParticipants Ensnared
SetGodMode @eventParticipants false
ClearCountdown @eventParticipants
$fightSeconds = 0
while $fightSeconds < 900
wait 1s
$fightSeconds = $fightSeconds + 1
@connectedParticipants = Intersect @eventParticipants @all
@aliveEventPlayers = Filter @connectedParticipants isAlive true
@intruders = Except @alivePlayers @connectedParticipants
if {AmountOf @intruders} > 0
SetRole @intruders Spectator None
end
if {AmountOf @aliveEventPlayers} < 2
@winner = @aliveEventPlayers
break
end
end
if {AmountOf @winner} is 0
@connectedParticipants = Intersect @eventParticipants @all
@aliveEventPlayers = Filter @connectedParticipants isAlive true
if {AmountOf @aliveEventPlayers} > 1
global $serPackPhase = "FFA sudden death"
Broadcast @all 6s "<color=#ff6b6b><b>SUDDEN DEATH</b></color><br>Every remaining player now has 1 HP."
SetMaxHealth @aliveEventPlayers 1
SetHealth @aliveEventPlayers 1
$suddenSeconds = 0
while $suddenSeconds < 60
wait 1s
$suddenSeconds = $suddenSeconds + 1
@connectedParticipants = Intersect @eventParticipants @all
@aliveEventPlayers = Filter @connectedParticipants isAlive true
if {AmountOf @aliveEventPlayers} < 2
break
end
end
end
if {AmountOf @aliveEventPlayers} is 1
@winner = @aliveEventPlayers
elif {AmountOf @aliveEventPlayers} > 1
@winner = Take @aliveEventPlayers 1
Broadcast @all 5s "<color=#ffb347>The time limit expired — the winner was selected at random from the survivors.</color>"
end
end
else
global $serPackPhase = "Team Deathmatch"
SetFriendlyFire false
$participantCount = AmountOf @eventParticipants
$blueCount = Round ($participantCount / 2)
@blueTeam = Take @eventParticipants $blueCount
@redTeam = Except @eventParticipants @blueTeam
SetRole @blueTeam NtfPrivate None
SetRole @redTeam ChaosConscript None
wait 500ms
SetGodMode @eventParticipants true
GiveEffect @eventParticipants Ensnared 8s
SetMaxHealth @eventParticipants 100
SetHealth @eventParticipants 100
SetCustomInfo @blueTeam "<color=#70a1ff>DEATHMATCH | BLUE</color>"
SetCustomInfo @redTeam "<color=#ff6b6b>DEATHMATCH | RED</color>"
run PrepareDeathmatchLoadout @eventParticipants $eventWeapon
run SpawnDeathmatchTeams @blueTeam @redTeam $eventZone
run LockDeathmatchZone $eventZone
Broadcast @all 8s "<size=30><color=#70a1ff><b>DEATHMATCH — TEAM</b></color></size><br>Zone: {$eventZone} | Weapon: {$eventWeapon}<br>The winning team advances to an FFA final."
Countdown @eventParticipants 7s "<color=#70a1ff><b>FIGHT STARTS IN %seconds%...</b></color>"
wait 7s
ClearEffect @eventParticipants Ensnared
SetGodMode @eventParticipants false
ClearCountdown @eventParticipants
$teamFightSeconds = 0
while $teamFightSeconds < 900
wait 1s
$teamFightSeconds = $teamFightSeconds + 1
@connectedBlue = Intersect @blueTeam @all
@connectedRed = Intersect @redTeam @all
@aliveBlue = Filter @connectedBlue isAlive true
@aliveRed = Filter @connectedRed isAlive true
@connectedParticipants = Join @connectedBlue @connectedRed
@intruders = Except @alivePlayers @connectedParticipants
if {AmountOf @intruders} > 0
SetRole @intruders Spectator None
end
if {AmountOf @aliveBlue} is 0 or {AmountOf @aliveRed} is 0
break
end
end
@connectedBlue = Intersect @blueTeam @all
@connectedRed = Intersect @redTeam @all
@aliveBlue = Filter @connectedBlue isAlive true
@aliveRed = Filter @connectedRed isAlive true
$aliveBlueCount = AmountOf @aliveBlue
$aliveRedCount = AmountOf @aliveRed
@finalists = @empty
if $aliveBlueCount > 0 and $aliveRedCount is 0
@finalists = @aliveBlue
elif $aliveRedCount > 0 and $aliveBlueCount is 0
@finalists = @aliveRed
elif $aliveBlueCount > $aliveRedCount
@finalists = @aliveBlue
Broadcast @all 5s "<color=#70a1ff>Blue wins the team stage with more survivors.</color>"
elif $aliveRedCount > $aliveBlueCount
@finalists = @aliveRed
Broadcast @all 5s "<color=#ff6b6b>Red wins the team stage with more survivors.</color>"
elif $aliveBlueCount > 0
@tiePlayer = Take {Join @aliveBlue @aliveRed} 1
if {Contains @aliveBlue @tiePlayer}
@finalists = @aliveBlue
else
@finalists = @aliveRed
end
Broadcast @all 5s "<color=#ffb347>The survivor count is tied — the finalist team was selected at random.</color>"
end
if {AmountOf @finalists} is 1
@winner = @finalists
elif {AmountOf @finalists} > 1
global $serPackPhase = "Winning team final"
SetFriendlyFire true
SetGodMode @finalists true
SetRole @finalists ClassD None
wait 500ms
SetMaxHealth @finalists 100
SetHealth @finalists 100
GiveEffect @finalists Ensnared 8s
SetCustomInfo @finalists "<color=#c56cf0>DEATHMATCH | FFA FINAL</color>"
run PrepareDeathmatchLoadout @finalists $eventWeapon
run SpawnDeathmatchFinal @finalists $eventZone
Broadcast @all 8s "<size=30><color=#c56cf0><b>FFA FINAL</b></color></size><br>The winning team's survivors now fight each other."
Countdown @finalists 7s "<color=#c56cf0><b>FINAL STARTS IN %seconds%...</b></color>"
wait 7s
ClearEffect @finalists Ensnared
SetGodMode @finalists false
ClearCountdown @finalists
$finalSeconds = 0
while $finalSeconds < 600
wait 1s
$finalSeconds = $finalSeconds + 1
@connectedFinalists = Intersect @finalists @all
@aliveFinalists = Filter @connectedFinalists isAlive true
if {AmountOf @aliveFinalists} < 2
break
end
end
@connectedFinalists = Intersect @finalists @all
@aliveFinalists = Filter @connectedFinalists isAlive true
if {AmountOf @aliveFinalists} is 1
@winner = @aliveFinalists
elif {AmountOf @aliveFinalists} > 1
@winner = Take @aliveFinalists 1
Broadcast @all 5s "<color=#ffb347>The final's time limit expired — the winner was selected at random.</color>"
end
end
end
global $serPackPhase = "Finishing"
if {AmountOf @winner} is 1
SetGodMode @winner true
SetCustomInfo @winner "<color=#2ed573><b>DEATHMATCH WINNER</b></color>"
Broadcast @all 9s "<size=34><color=#2ed573><b>DEATHMATCH WINNER</b></color></size><br>{@winner -> name}"
else
Broadcast @all 8s "<color=#ff6b6b><b>DEATHMATCH ENDED WITHOUT A WINNER</b></color>"
end
wait 9s
SetCustomInfo @all ""
RestartRound
on_error with $eventError $eventErrorType
global $serPackPhase = "Failure — restarting"
Print "Event Pack Deathmatch error ({$eventErrorType}): {$eventError}" Red
Broadcast @all 7s "<color=#ff6b6b><b>DEATHMATCH STOPPED</b></color><br>A technical error occurred. The round will restart safely."
SetCustomInfo @all ""
ClearEffect @all Ensnared
SetGodMode @all false
wait 7s
RestartRound
end