-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patheventDuel.ser
More file actions
195 lines (169 loc) · 6.81 KB
/
Copy patheventDuel.ser
File metadata and controls
195 lines (169 loc) · 6.81 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
# Event Pack worker. Start through the `event` command from eventManager.ser.
func PrepareDuelLoadout with @loadoutTargets $loadoutWeapon
ClearInventory @loadoutTargets destroy
GiveItem @loadoutTargets $loadoutWeapon
ForceEquip @loadoutTargets $loadoutWeapon
end
if {VarExists $serPackActive} is false
Print "Event Pack rejected a direct run of eventDuel. Use the 'event' command."
stop
end
if {VarExists $serPackName} is false
Print "Event Pack rejected a direct run of eventDuel. Use the 'event' command."
stop
end
if $serPackActive is false or $serPackName isnt "Duel"
Print "Event Pack rejected a direct run of eventDuel. Use the 'event' command."
stop
end
if {VarExists @eventParticipants} is false
Print "Event Pack rejected a direct run of eventDuel. Use the 'event' command."
stop
end
attempt
global $serPackPhase = "Preparing round"
SetRoundLock true
SetLobbyLock false
SetFriendlyFire true
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>DUEL CANCELLED</b></color><br>Fewer than two participants remain connected. The round will restart."
wait 5s
RestartRound
stop
end
SetRole @all Spectator None
wait 500ms
LockDoor Lcz173 AdminCommand
@queue = @eventParticipants
@champion = Take @queue 1
@queue = Except @queue @champion
$duelNumber = 0
Broadcast @all 8s "<size=32><color=#ff9f43><b>DUEL</b></color></size><br>Weapon: {$eventWeapon}<br>The winner stays in the arena to face the next challenger."
while {AmountOf @queue} > 0
@connectedChampion = Intersect @champion @all
if {AmountOf @connectedChampion} is 0
@champion = Take @queue 1
@queue = Except @queue @champion
continue
end
@challenger = Take @queue 1
@queue = Except @queue @challenger
@connectedChallenger = Intersect @challenger @all
if {AmountOf @connectedChallenger} is 0
continue
end
$duelNumber = $duelNumber + 1
global $serPackPhase = "Duel {$duelNumber}"
@duelists = Join @champion @challenger
SetRole @duelists ClassD None
wait 500ms
SetMaxHealth @duelists 100
SetHealth @duelists 100
SetGodMode @duelists true
GiveEffect @duelists Ensnared 7s
SetCustomInfo @champion "<color=#feca57>DUEL | DEFENDER</color>"
SetCustomInfo @challenger "<color=#54a0ff>DUEL | CHALLENGER</color>"
run PrepareDuelLoadout @duelists $eventWeapon
TPRoom @champion Lcz173 -3 1 0
TPRoom @challenger Lcz173 3 1 0
Broadcast @all 6s "<color=#ff9f43><b>DUEL {$duelNumber}</b></color><br>{@champion -> name} versus {@challenger -> name}"
Countdown @duelists 6s "<color=#ff9f43><b>STARTING IN %seconds%...</b></color>"
wait 6s
ClearEffect @duelists Ensnared
SetGodMode @duelists false
ClearCountdown @duelists
$duelSeconds = 0
while $duelSeconds < 90
wait 1s
$duelSeconds = $duelSeconds + 1
@connectedDuelists = Intersect @duelists @all
@aliveDuelists = Filter @connectedDuelists isAlive true
@intruders = Except @alivePlayers @aliveDuelists
if {AmountOf @intruders} > 0
SetRole @intruders Spectator None
end
if {AmountOf @aliveDuelists} < 2
break
end
end
@connectedDuelists = Intersect @duelists @all
@aliveDuelists = Filter @connectedDuelists isAlive true
if {AmountOf @aliveDuelists} > 1
Broadcast @all 5s "<color=#ff6b6b><b>TIME LIMIT REACHED</b></color><br>The duelist with more HP wins."
$championHealth = @champion -> health
$challengerHealth = @challenger -> health
if $championHealth > $challengerHealth
@duelWinner = @champion
elif $challengerHealth > $championHealth
@duelWinner = @challenger
else
@duelWinner = Take @aliveDuelists 1
Broadcast @all 4s "<color=#ffb347>HP is tied — the duel winner was selected at random.</color>"
end
@duelLoser = Except @aliveDuelists @duelWinner
Kill @duelLoser "Duel: lost on time"
wait 1s
@champion = @duelWinner
elif {AmountOf @aliveDuelists} is 1
@champion = @aliveDuelists
elif {AmountOf @connectedDuelists} > 0
@champion = Take @connectedDuelists 1
SetRole @champion ClassD None
wait 500ms
Broadcast @all 4s "<color=#ffb347>Both duelists died — the advancing player was selected at random.</color>"
else
@champion = @empty
end
@connectedChampion = Intersect @champion @all
if {AmountOf @connectedChampion} is 1
@connectedEliminated = Except @connectedDuelists @champion
if {AmountOf @connectedEliminated} > 0
SetCustomInfo @connectedEliminated ""
end
SetGodMode @champion true
SetMaxHealth @champion 100
SetHealth @champion 100
SetCustomInfo @champion "<color=#feca57>DUEL | WAITING</color>"
Broadcast @all 4s "<color=#2ed573>{@champion -> name} wins duel {$duelNumber}.</color>"
wait 3s
end
end
global $serPackPhase = "Finishing"
@connectedChampion = Intersect @champion @all
if {AmountOf @connectedChampion} is 1
SetGodMode @champion true
SetCustomInfo @champion "<color=#2ed573><b>DUEL WINNER</b></color>"
Broadcast @all 9s "<size=34><color=#2ed573><b>DUEL WINNER</b></color></size><br>{@champion -> name}"
else
Broadcast @all 8s "<color=#ff6b6b><b>DUEL ENDED WITHOUT A WINNER</b></color>"
end
wait 9s
SetCustomInfo @all ""
RestartRound
on_error with $eventError $eventErrorType
global $serPackPhase = "Failure — restarting"
Print "Event Pack Duel error ({$eventErrorType}): {$eventError}" Red
Broadcast @all 7s "<color=#ff6b6b><b>DUEL 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