author | nemo |
Sun, 24 Mar 2024 14:19:02 -0400 | |
branch | 1.0.0 |
changeset 16023 | fcc98c953b5e |
parent 15088 | d59da429d22c |
permissions | -rw-r--r-- |
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
1 |
------------------------------- |
5821
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5328
diff
changeset
|
2 |
-- CTF_BLIZZARD 0.9 |
4786 | 3 |
-------------------------------- |
4 |
||
5 |
--------- |
|
6 |
-- 0.2 |
|
7 |
--------- |
|
8 |
||
9 |
-- disabled super weapons |
|
10 |
||
11 |
-- theme modifications |
|
12 |
||
13 |
-- improved hog placement system: teams can now be put |
|
14 |
-- in any order and be of any size |
|
15 |
||
16 |
--------- |
|
17 |
-- 0.3 |
|
18 |
--------- |
|
19 |
||
20 |
-- In this version: |
|
21 |
||
22 |
-- changed starting weapons |
|
23 |
-- changed crate drop contents and rate of drops |
|
24 |
||
25 |
-- completely removed super weapons and super weapon scripts |
|
26 |
||
27 |
-- removed custom respawning |
|
28 |
-- removed set respawn points |
|
29 |
||
30 |
-- added AIRespawn-esque respawning |
|
31 |
-- added simple left vs right respawn points |
|
32 |
||
33 |
-- added non-lethal poison to flag carriers as an indicator |
|
34 |
||
35 |
-- improved flag mechanics and player-flag feedback |
|
36 |
-- flag now instantly respawns if you kill enemy hog and return it, |
|
37 |
-- or if the flag falls in water, _BUT_ not if it is blown up |
|
38 |
||
39 |
--------- |
|
40 |
-- 0.4 |
|
41 |
--------- |
|
42 |
||
43 |
-- tweaked crate drop rates and crate contents |
|
44 |
-- improved the teleporters, they should now be able to handle rope... hopefully |
|
45 |
-- updated SetEffect calls to be in line with 0.9.15 definitions |
|
46 |
-- added visual gears when hogs respawn |
|
47 |
-- added visual gears when hogs teleport |
|
48 |
-- added visual gear to track flag and flag carriers |
|
49 |
-- removed poisoning of flag carriers |
|
50 |
-- removed health adjustments for flag carriers due to aforementioned poisons |
|
51 |
||
52 |
--------- |
|
53 |
-- 0.5 |
|
54 |
--------- |
|
55 |
||
56 |
-- added translation support, hopefully |
|
57 |
-- added ctf rules |
|
58 |
-- added effects to the teleporters |
|
59 |
-- added aura round spawning area |
|
60 |
-- changed the aura around the flag carrier / flag to an aura and added some support for this |
|
61 |
-- changed things so the seed is no longer always the same... |
|
62 |
||
4843 | 63 |
--------- |
64 |
-- 0.6 |
|
65 |
--------- |
|
66 |
||
67 |
-- removed branding and version number |
|
68 |
-- removed teleport from starting weapons |
|
69 |
-- increased captures to 3 |
|
4786 | 70 |
|
5821
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5328
diff
changeset
|
71 |
------------ |
4871 | 72 |
-- 0.7 |
73 |
------------ |
|
74 |
||
75 |
-- hopefully fixed a bug with the teleporters |
|
4953
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
76 |
-- added a fix for crate possibly getting imbedded in land when it was near the water line |
4871 | 77 |
|
5821
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5328
diff
changeset
|
78 |
------------ |
4953
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
79 |
-- 0.8 |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
80 |
------------ |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
81 |
|
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
82 |
-- fixed version control fail with missing check on onGearDelete |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
83 |
|
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
84 |
-- changed hog placements code so that they start in the same place for both teams |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
85 |
-- and hogs move in the same order, not backwards to each other. |
4871 | 86 |
|
5821
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5328
diff
changeset
|
87 |
----------- |
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5328
diff
changeset
|
88 |
-- 0.9 |
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5328
diff
changeset
|
89 |
------------ |
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5328
diff
changeset
|
90 |
|
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5328
diff
changeset
|
91 |
-- add support for more players |
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5328
diff
changeset
|
92 |
-- re-enable sudden death, but set water rise to 0 |
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5328
diff
changeset
|
93 |
|
9093 | 94 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
4786 | 95 |
|
96 |
--------------------------------------------------------------- |
|
97 |
----------lots of bad variables and things |
|
98 |
----------because someone is too lazy |
|
99 |
----------to read about tables properly |
|
100 |
------------------ "Oh well, they probably have the memory" |
|
101 |
||
102 |
local actionReset = 0 -- used in CheckTeleporters() |
|
103 |
||
104 |
local roundsCounter = 0 -- used to determine when to spawn more crates |
|
105 |
-- currently every 6 TURNS, should this work |
|
106 |
-- on ROUNDS instead? |
|
107 |
local effectTimer = 0 |
|
14999
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
108 |
local gameEnded = false |
4786 | 109 |
|
4871 | 110 |
local ropeGear = nil |
111 |
||
4786 | 112 |
-------------------------- |
113 |
-- hog and team tracking variales |
|
114 |
-------------------------- |
|
115 |
||
116 |
local numhhs = 0 -- store number of hedgehogs |
|
117 |
local hhs = {} -- store hedgehog gears |
|
118 |
||
119 |
local teamNameArr = {} -- store the list of teams |
|
120 |
local teamSize = {} -- store how many hogs per team |
|
121 |
local teamIndex = {} -- at what point in the hhs{} does each team begin |
|
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
122 |
local clanTeams = {} -- list of teams per clan |
4786 | 123 |
|
14999
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
124 |
local mostCapturesHogName = nil -- name of hog who holds the record of most flags captured |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
125 |
local mostCapturesHogTeam = nil -- name of team who holds the record of most flags captured |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
126 |
local mostCaptures = 0 -- number of most per-hog captures |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
127 |
local capturesPerHog = {} |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
128 |
|
4786 | 129 |
------------------- |
130 |
-- flag variables |
|
131 |
------------------- |
|
132 |
||
133 |
local fGear = {} -- pointer to the case gears that represent the flag |
|
134 |
local fThief = {} -- pointer to the hogs who stole the flags |
|
135 |
local fIsMissing = {} -- have the flags been destroyed or captured |
|
136 |
local fNeedsRespawn = {} -- do the flags need to be respawned |
|
137 |
local fCaptures = {} -- the team "scores" how many captures |
|
138 |
local fSpawnX = {} -- spawn X for flags |
|
139 |
local fSpawnY = {} -- spawn Y for flags |
|
140 |
||
141 |
local fThiefX = {} |
|
142 |
local fThiefY = {} |
|
143 |
||
144 |
local fSpawnC = {} |
|
145 |
local fCirc = {} -- flag/carrier marker circles |
|
146 |
local fCol = {} -- colour of the clans |
|
147 |
||
148 |
local vCircX = {} |
|
149 |
local vCircY = {} |
|
150 |
local vCircMinA = {} |
|
151 |
local vCircMaxA = {} |
|
152 |
local vCircType = {} |
|
153 |
local vCircPulse = {} |
|
154 |
local vCircFuckAll = {} |
|
155 |
local vCircRadius = {} |
|
156 |
local vCircWidth = {} |
|
157 |
local vCircCol = {} |
|
158 |
||
159 |
||
160 |
-------------------------------- |
|
161 |
--zone and teleporter variables |
|
162 |
-------------------------------- |
|
163 |
||
14995
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
164 |
local leftTel |
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
165 |
local rightTel |
4786 | 166 |
|
167 |
local zXMin = {} |
|
168 |
local zWidth = {} |
|
169 |
local zYMin = {} |
|
170 |
local zHeight = {} |
|
171 |
local zOccupied = {} |
|
172 |
local zCount = 0 |
|
173 |
||
174 |
------------------------ |
|
175 |
-- zone methods |
|
176 |
------------------------ |
|
177 |
-- see on gameTick also |
|
178 |
||
179 |
function ManageTeleporterEffects() |
|
180 |
effectTimer = effectTimer + 1 |
|
13116
3b7cd18c4a06
CTF_Blizzard: Dump dead code / out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
181 |
if effectTimer > 50 then |
4786 | 182 |
effectTimer = 0 |
4843 | 183 |
|
14995
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
184 |
local i = GetHogClan(CurrentHedgehog) |
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
185 |
if i ~= 0 and i ~= 1 then |
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
186 |
return |
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
187 |
end |
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
188 |
local eX = 10 + zXMin[i] + GetRandom(zWidth[i]-10) |
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
189 |
local eY = 50 + zYMin[i] + GetRandom(zHeight[i]-110) |
4786 | 190 |
|
14995
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
191 |
-- steam and smoke and DUST look good, smokering looks trippy |
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
192 |
-- smoketrace and eviltrace are not effected by wind? |
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
193 |
-- chunk is a LR falling gear |
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
194 |
local tempE = AddVisualGear(eX, eY, vgtDust, 0, false) |
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
195 |
SetVisualGearValues(tempE, eX, eY, nil, nil, nil, nil, nil, nil, nil, fCol[i]) |
4843 | 196 |
end |
4786 | 197 |
end |
198 |
||
199 |
function CreateZone(xMin, yMin, width, height) |
|
200 |
||
201 |
||
202 |
zXMin[zCount] = xMin |
|
203 |
zYMin[zCount] = yMin |
|
204 |
zWidth[zCount] = width |
|
205 |
zHeight[zCount] = height |
|
206 |
zOccupied[zCount] = false |
|
207 |
zCount = zCount + 1 |
|
208 |
||
209 |
return (zCount-1) |
|
210 |
||
211 |
end |
|
212 |
||
213 |
function GearIsInZone(gear, zI) |
|
214 |
||
215 |
if (GetX(gear) > zXMin[zI]) and (GetX(gear) < (zXMin[zI]+zWidth[zI])) and (GetY(gear) > zYMin[zI]) and (GetY(gear) < (zYMin[zI]+zHeight[zI])) then |
|
216 |
zOccupied[zI] = true |
|
217 |
else |
|
218 |
zOccupied[zI] = false |
|
219 |
end |
|
220 |
||
221 |
return zOccupied[zI] |
|
222 |
||
223 |
end |
|
224 |
||
225 |
------------------------ |
|
226 |
--flag methods |
|
227 |
------------------------ |
|
228 |
||
229 |
function CheckScore(teamID) |
|
230 |
||
13116
3b7cd18c4a06
CTF_Blizzard: Dump dead code / out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
231 |
local alt |
4786 | 232 |
if teamID == 0 then |
233 |
alt = 1 |
|
234 |
||
235 |
elseif teamID == 1 then |
|
236 |
alt = 0 |
|
237 |
end |
|
238 |
||
14999
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
239 |
if fCaptures[teamID] == 3 and not gameEnded then |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
240 |
gameEnded = true |
4786 | 241 |
for i = 0, (numhhs-1) do |
242 |
if GetHogClan(hhs[i]) == alt then |
|
7838 | 243 |
SetEffect(hhs[i], heResurrectable, 0) |
4786 | 244 |
SetHealth(hhs[i],0) |
245 |
end |
|
246 |
end |
|
14998
1e21dfd7f9b5
CTF_Blizzard: Fix the mission text, remove string concatenation stuff
Wuzzy <Wuzzy2@mail.ru>
parents:
14996
diff
changeset
|
247 |
local victoryMsg = string.format(loc("Victory for %s!"), GetHogTeamName(CurrentHedgehog)) |
1e21dfd7f9b5
CTF_Blizzard: Fix the mission text, remove string concatenation stuff
Wuzzy <Wuzzy2@mail.ru>
parents:
14996
diff
changeset
|
248 |
AddCaption(victoryMsg, capcolDefault, capgrpGameState) |
14999
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
249 |
|
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
250 |
-- Calculate team rankings |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
251 |
local teamList = {} |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
252 |
for i=0, TeamsCount-1 do |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
253 |
local name = GetTeamName(i) |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
254 |
local clan = GetTeamClan(name) |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
255 |
if fCaptures[clan] ~= nil then |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
256 |
table.insert(teamList, { score = fCaptures[clan], name = name, clan = clan }) |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
257 |
end |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
258 |
end |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
259 |
local teamRank = function(a, b) |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
260 |
return a.score > b.score |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
261 |
end |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
262 |
table.sort(teamList, teamRank) |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
263 |
|
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
264 |
for i=1, #teamList do |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
265 |
SendStat(siPointType, "!POINTS") |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
266 |
SendStat(siPlayerKills, tostring(teamList[i].score), teamList[i].name) |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
267 |
end |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
268 |
if mostCaptures >= 2 then |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
269 |
SendStat(siCustomAchievement, string.format(loc("%s (%s) has captured the flag %d times."), mostCapturesHogName, mostCapturesHogTeam, mostCaptures)) |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
270 |
end |
4786 | 271 |
end |
272 |
||
273 |
end |
|
274 |
||
275 |
function HandleRespawns() |
|
276 |
||
277 |
for i = 0, 1 do |
|
278 |
||
279 |
if fNeedsRespawn[i] == true then |
|
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
280 |
fGear[i] = SpawnFakeAmmoCrate(fSpawnX[i],fSpawnY[i],false,false) |
4786 | 281 |
fNeedsRespawn[i] = false |
282 |
fIsMissing[i] = false -- new, this should solve problems of a respawned flag being "returned" when a player tries to score |
|
14994 | 283 |
AddCaption(loc("Flag respawned!"), capcolDefault, capgrpAmmoinfo) |
4786 | 284 |
end |
285 |
||
286 |
end |
|
287 |
||
288 |
end |
|
289 |
||
290 |
function FlagDeleted(gear) |
|
291 |
||
13116
3b7cd18c4a06
CTF_Blizzard: Dump dead code / out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
292 |
local wtf, bbq |
4786 | 293 |
if (gear == fGear[0]) then |
294 |
wtf = 0 |
|
295 |
bbq = 1 |
|
296 |
elseif (gear == fGear[1]) then |
|
297 |
wtf = 1 |
|
298 |
bbq = 0 |
|
299 |
end |
|
300 |
||
301 |
if CurrentHedgehog ~= nil then |
|
302 |
||
303 |
--if the player picks up the flag |
|
14994 | 304 |
if band(GetGearMessage(gear), gmDestroy) ~= 0 then |
4786 | 305 |
|
306 |
fGear[wtf] = nil -- the flag has now disappeared and we shouldnt be pointing to it |
|
307 |
||
308 |
-- player has successfully captured the enemy flag |
|
309 |
if (GetHogClan(CurrentHedgehog) == wtf) and (CurrentHedgehog == fThief[bbq]) and (fIsMissing[wtf] == false) then |
|
14994 | 310 |
PlaySound(sndShotgunReload) |
4786 | 311 |
fIsMissing[wtf] = false |
312 |
fNeedsRespawn[wtf] = true |
|
313 |
fIsMissing[bbq] = false |
|
314 |
fNeedsRespawn[bbq] = true |
|
13116
3b7cd18c4a06
CTF_Blizzard: Dump dead code / out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
315 |
fCaptures[wtf] = fCaptures[wtf] +1 |
4843 | 316 |
|
13643 | 317 |
AddCaption(string.format(loc("%s has scored!"), GetHogTeamName(CurrentHedgehog)), capcolDefault, capgrpGameState) |
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
318 |
for i=1, #clanTeams[wtf] do |
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
319 |
SetTeamLabel(clanTeams[wtf][i], fCaptures[wtf]) |
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
320 |
end |
4786 | 321 |
|
14999
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
322 |
capturesPerHog[CurrentHedgehog] = capturesPerHog[CurrentHedgehog] + 1 |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
323 |
if capturesPerHog[CurrentHedgehog] > mostCaptures then |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
324 |
mostCaptures = capturesPerHog[CurrentHedgehog] |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
325 |
mostCapturesHogName = GetHogName(CurrentHedgehog) |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
326 |
mostCapturesHogTeam = GetHogTeamName(CurrentHedgehog) |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
327 |
end |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
328 |
|
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
329 |
PlaySound(sndHomerun) |
4786 | 330 |
fThief[bbq] = nil -- player no longer has the enemy flag |
331 |
CheckScore(wtf) |
|
332 |
||
333 |
--if the player is returning the flag |
|
334 |
elseif GetHogClan(CurrentHedgehog) == wtf then |
|
14994 | 335 |
PlaySound(sndShotgunReload) |
4786 | 336 |
fNeedsRespawn[wtf] = true |
337 |
||
338 |
-- NEW ADDIITON, does this work? Should make it possible to return your flag and then score in the same turn |
|
339 |
if fIsMissing[wtf] == true then |
|
340 |
HandleRespawns() -- this will set fIsMissing[wtf] to false :) |
|
14994 | 341 |
AddCaption(loc("Flag returned!"), capcolDefault, capgrpAmmoinfo) |
4786 | 342 |
elseif fIsMissing[wtf] == false then |
12426
9f3387907e06
Fix even more bad/broken loc()'s in scripts (hopefully the last one)
Wuzzy <almikes@aol.com>
parents:
12079
diff
changeset
|
343 |
AddCaption(loc("That was pointless. The flag will respawn next round.")) |
4786 | 344 |
end |
345 |
||
346 |
--if the player is taking the enemy flag |
|
347 |
elseif GetHogClan(CurrentHedgehog) == bbq then |
|
14994 | 348 |
PlaySound(sndShotgunReload) |
4786 | 349 |
fIsMissing[wtf] = true |
350 |
for i = 0,numhhs-1 do |
|
351 |
if CurrentHedgehog == hhs[i] then |
|
352 |
fThief[wtf] = hhs[i] |
|
353 |
end |
|
354 |
end |
|
355 |
||
356 |
AddCaption(loc("Flag captured!")) |
|
357 |
||
358 |
else --below line doesnt usually get called |
|
359 |
AddCaption("Hmm... that wasn't supposed to happen...") |
|
360 |
||
361 |
end |
|
362 |
||
14994 | 363 |
-- if flag has been destroyed |
4786 | 364 |
else |
365 |
||
366 |
if GetY(fGear[wtf]) > 2025 then |
|
367 |
fGear[wtf] = nil |
|
368 |
fIsMissing[wtf] = true |
|
369 |
fNeedsRespawn[wtf] = true |
|
370 |
HandleRespawns() |
|
371 |
else |
|
372 |
fGear[wtf] = nil |
|
373 |
fIsMissing[wtf] = true |
|
374 |
fNeedsRespawn[wtf] = true |
|
375 |
AddCaption(loc("Boom!") .. " " .. loc("The flag will respawn next round.")) |
|
376 |
end |
|
377 |
||
378 |
end |
|
379 |
||
380 |
-- if flag has been destroyed deep underwater and player is now nil |
|
381 |
-- probably only gets called if the flag thief drowns himself |
|
382 |
-- otherwise the above one will work fine |
|
383 |
else |
|
384 |
fGear[wtf] = nil |
|
385 |
fIsMissing[wtf] = true |
|
386 |
fNeedsRespawn[wtf] = true |
|
387 |
AddCaption(loc("The flag will respawn next round.")) |
|
388 |
end |
|
389 |
||
390 |
end |
|
391 |
||
392 |
function FlagThiefDead(gear) |
|
393 |
||
13116
3b7cd18c4a06
CTF_Blizzard: Dump dead code / out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
394 |
local wtf, bbq |
4786 | 395 |
if (gear == fThief[0]) then |
396 |
wtf = 0 |
|
397 |
bbq = 1 |
|
398 |
elseif (gear == fThief[1]) then |
|
399 |
wtf = 1 |
|
400 |
bbq = 0 |
|
401 |
end |
|
402 |
||
403 |
if fThief[wtf] ~= nil then |
|
4871 | 404 |
|
405 |
if fThiefY[wtf] > 2040 then |
|
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
406 |
fGear[wtf] = SpawnFakeAmmoCrate(fThiefX[wtf],(fThiefY[wtf]+10),false,false) |
4871 | 407 |
else |
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
408 |
fGear[wtf] = SpawnFakeAmmoCrate(fThiefX[wtf],(fThiefY[wtf]-50),false,false) |
4871 | 409 |
end |
14994 | 410 |
AddCaption(string.format(loc("%s has dropped the flag!"), GetHogName(gear)), capcolDefault, capgrpAmmoinfo) |
4871 | 411 |
|
4786 | 412 |
AddVisualGear(fThiefX[wtf], fThiefY[wtf], vgtBigExplosion, 0, false) |
413 |
fThief[wtf] = nil |
|
414 |
end |
|
415 |
||
416 |
end |
|
417 |
||
418 |
function HandleCircles() |
|
4843 | 419 |
|
4786 | 420 |
for i = 0, 1 do |
421 |
if fIsMissing[i] == false then -- draw a circle at the flag's spawning place |
|
422 |
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
|
423 |
elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then |
|
424 |
if fThief[i] ~= nil then -- draw circle round flag carrier |
|
425 |
SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
|
426 |
elseif fThief[i] == nil then -- draw cirle round dropped flag |
|
427 |
SetVisualGearValues(fCirc[i], GetX(fGear[i]),GetY(fGear[i]), vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
|
428 |
end |
|
429 |
end |
|
4843 | 430 |
|
4786 | 431 |
if fNeedsRespawn[i] == true then -- if the flag has been destroyed, no need for a circle |
432 |
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 0, 0, fCol[i]) |
|
433 |
end |
|
434 |
end |
|
435 |
||
436 |
end |
|
437 |
||
438 |
------------------------ |
|
439 |
-- general methods |
|
440 |
------------------------ |
|
441 |
||
442 |
function CheckTeleporters() |
|
443 |
||
13116
3b7cd18c4a06
CTF_Blizzard: Dump dead code / out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
444 |
local teleportActive = false |
4786 | 445 |
|
14995
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
446 |
if (GearIsInZone(CurrentHedgehog, leftTel) == true) and (GetHogClan(CurrentHedgehog) == 0) then |
4786 | 447 |
teleportActive = true |
448 |
destinationX = 1402 |
|
449 |
destinationY = 321 |
|
14995
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
450 |
elseif (GearIsInZone(CurrentHedgehog, rightTel) == true) and (GetHogClan(CurrentHedgehog) == 1) then |
4786 | 451 |
teleportActive = true |
452 |
destinationX = 2692 |
|
453 |
destinationY = 321 |
|
454 |
end |
|
455 |
||
456 |
if teleportActive == true then |
|
457 |
if actionReset == 0 then |
|
4871 | 458 |
if ropeGear ~= nil then |
459 |
if GetGearElasticity(ropeGear) ~= 0 then |
|
460 |
SetGearMessage(CurrentHedgehog, gmAttack) |
|
461 |
end |
|
462 |
end |
|
4786 | 463 |
elseif actionReset == 10 then |
464 |
SetGearMessage(CurrentHedgehog, 0) |
|
465 |
elseif actionReset == 20 then |
|
466 |
AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false) |
|
467 |
SetGearPosition(CurrentHedgehog,destinationX,destinationY) |
|
14996
fdfe8bf91b8b
CTF_Blizzard: Warp sound when using teleporter
Wuzzy <Wuzzy2@mail.ru>
parents:
14995
diff
changeset
|
468 |
PlaySound(sndWarp) |
4786 | 469 |
AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false) |
470 |
end |
|
471 |
||
472 |
actionReset = actionReset + 1 |
|
473 |
if actionReset >= 30 then |
|
474 |
actionReset = 0 |
|
475 |
end |
|
476 |
||
477 |
end |
|
478 |
||
479 |
end |
|
480 |
||
481 |
function RebuildTeamInfo() |
|
482 |
||
483 |
||
484 |
-- make a list of individual team names |
|
5821
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5328
diff
changeset
|
485 |
for i = 0, (TeamsCount-1) do |
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
486 |
teamNameArr[i] = GetTeamName(i) |
4786 | 487 |
teamSize[i] = 0 |
488 |
teamIndex[i] = 0 |
|
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
489 |
SetTeamLabel(teamNameArr[i], "0") |
4786 | 490 |
end |
491 |
||
492 |
-- find out how many hogs per team, and the index of the first hog in hhs |
|
13116
3b7cd18c4a06
CTF_Blizzard: Dump dead code / out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
493 |
for i = 0, TeamsCount-1 do |
4786 | 494 |
|
495 |
for z = 0, numhhs-1 do |
|
496 |
if GetHogTeamName(hhs[z]) == teamNameArr[i] then |
|
497 |
if teamSize[i] == 0 then |
|
498 |
teamIndex[i] = z -- should give starting index |
|
499 |
end |
|
500 |
teamSize[i] = teamSize[i] + 1 |
|
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
501 |
|
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
502 |
local clan = GetHogClan(hhs[z]) |
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
503 |
-- Also remember the clan to which the team belongs to |
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
504 |
if not clanTeams[clan] then |
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
505 |
clanTeams[clan] = {} |
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
506 |
end |
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
507 |
table.insert(clanTeams[clan], teamNameArr[i]) |
4786 | 508 |
end |
509 |
end |
|
510 |
||
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
511 |
|
4786 | 512 |
end |
513 |
||
514 |
end |
|
515 |
||
516 |
function HandleCrateDrops() |
|
517 |
||
518 |
roundsCounter = roundsCounter +1 |
|
519 |
||
520 |
if roundsCounter == 5 then |
|
521 |
||
522 |
roundsCounter = 0 |
|
523 |
||
524 |
r = GetRandom(8) |
|
525 |
if r == 0 then |
|
12933
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12426
diff
changeset
|
526 |
SpawnSupplyCrate(0,0,amSwitch) |
4786 | 527 |
elseif r == 1 then |
12933
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12426
diff
changeset
|
528 |
SpawnSupplyCrate(0,0,amTeleport) |
4786 | 529 |
elseif r == 2 then |
12933
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12426
diff
changeset
|
530 |
SpawnSupplyCrate(0,0,amJetpack) |
4786 | 531 |
elseif r == 3 then |
12933
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12426
diff
changeset
|
532 |
SpawnSupplyCrate(0,0,amExtraTime) |
4786 | 533 |
elseif r == 4 then |
12933
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12426
diff
changeset
|
534 |
SpawnSupplyCrate(0,0,amGirder) |
4786 | 535 |
elseif r == 5 then |
12933
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12426
diff
changeset
|
536 |
SpawnSupplyCrate(0,0,amDynamite) |
4786 | 537 |
elseif r == 6 then |
12933
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12426
diff
changeset
|
538 |
SpawnSupplyCrate(0,0,amFlamethrower) |
4786 | 539 |
elseif r == 7 then |
12933
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12426
diff
changeset
|
540 |
SpawnSupplyCrate(0,0,amPortalGun) |
4786 | 541 |
end |
14994 | 542 |
PlaySound(sndReinforce, CurrentHedgehog) |
4786 | 543 |
|
544 |
end |
|
545 |
||
546 |
end |
|
547 |
||
548 |
------------------------ |
|
549 |
-- game methods |
|
550 |
------------------------ |
|
551 |
||
552 |
function onGameInit() |
|
553 |
||
554 |
-- Things we don't modify here will use their default values. |
|
555 |
GameFlags = gfDivideTeams -- Game settings and rules |
|
13117
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
556 |
TurnTime = 30000 -- The time the player has to move each round (in ms) |
4786 | 557 |
CaseFreq = 0 -- The frequency of crate drops |
558 |
MinesNum = 0 -- The number of mines being placed |
|
559 |
Explosives = 0 -- The number of explosives being placed |
|
12079
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
12077
diff
changeset
|
560 |
-- Disable Sudden Death |
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
12077
diff
changeset
|
561 |
WaterRise = 0 |
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
12077
diff
changeset
|
562 |
HealthDecrease = 0 |
4786 | 563 |
Map = "Blizzard" -- The map to be played |
13117
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
564 |
Theme = "Snow" -- The theme to be used |
4786 | 565 |
|
14999
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
566 |
SendHealthStatsOff() |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
567 |
SendRankingStatsOff() |
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
568 |
|
4786 | 569 |
end |
570 |
||
571 |
||
572 |
function onGameStart() |
|
573 |
||
14994 | 574 |
ShowMission(loc("CTF_Blizzard"), loc("Capture The Flag"), |
575 |
loc("- Return the enemy flag to your base to score") .."|".. |
|
576 |
string.format(loc("- First clan to score %d captures wins"), 3) .. "|".. |
|
577 |
loc("- You may only score when your flag is in your base") .."|".. |
|
578 |
loc("- Hogs will drop the flag when killed") .."|".. |
|
579 |
loc("- Dropped flags may be returned or recaptured").."|".. |
|
580 |
loc("- Hogs will be revived") .."|".. |
|
15088
d59da429d22c
Add 2 mission panel icons: hedgehog and flags
Wuzzy <Wuzzy2@mail.ru>
parents:
14999
diff
changeset
|
581 |
loc("- Touch the sparkles near your base to teleport"), 11, 0) |
4786 | 582 |
|
583 |
-- initialize teleporters |
|
14995
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
584 |
leftTel = CreateZone(342,1316,42,449) -- left teleporter (clan 0) |
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
585 |
rightTel = CreateZone(3719,1330,45,449) -- right teleporter (clan 1) |
4786 | 586 |
|
587 |
||
588 |
--new improved placement schematics aw yeah |
|
589 |
RebuildTeamInfo() |
|
13116
3b7cd18c4a06
CTF_Blizzard: Dump dead code / out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
590 |
local team1Placed = 0 |
3b7cd18c4a06
CTF_Blizzard: Dump dead code / out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
591 |
local team2Placed = 0 |
4786 | 592 |
for i = 0, (TeamsCount-1) do |
593 |
for g = teamIndex[i], (teamIndex[i]+teamSize[i]-1) do |
|
594 |
if GetHogClan(hhs[g]) == 0 then |
|
595 |
SetGearPosition(hhs[g],1403+ ((team1Placed+1)*50),1570) |
|
596 |
team1Placed = team1Placed +1 |
|
597 |
if team1Placed > 6 then |
|
598 |
team1Placed = 0 |
|
599 |
end |
|
600 |
elseif GetHogClan(hhs[g]) == 1 then |
|
4953
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
601 |
SetGearPosition(hhs[g],2691- ((team2Placed+1)*50),1570) |
4786 | 602 |
team2Placed = team2Placed +1 |
603 |
if team2Placed > 6 then |
|
604 |
team2Placed = 0 |
|
605 |
end |
|
606 |
end |
|
607 |
end |
|
608 |
end |
|
609 |
||
610 |
||
611 |
||
612 |
--spawn starting ufos and or super weapons |
|
12933
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12426
diff
changeset
|
613 |
SpawnSupplyCrate(2048,1858,amJetpack) |
4786 | 614 |
|
615 |
--set flag spawn points and spawn the flags |
|
616 |
fSpawnX[0] = 957 |
|
617 |
fSpawnY[0] = 1747 |
|
618 |
fSpawnX[1] = 3123 |
|
619 |
fSpawnY[1] = 1747 |
|
620 |
||
13798
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13687
diff
changeset
|
621 |
if ClansCount < 2 then |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13687
diff
changeset
|
622 |
return |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13687
diff
changeset
|
623 |
end |
e874bfe563c7
Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents:
13687
diff
changeset
|
624 |
|
4786 | 625 |
for i = 0, 1 do |
13019
880662cf41ee
Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
626 |
fGear[i] = SpawnFakeAmmoCrate(fSpawnX[i],fSpawnY[i],false,false) |
4786 | 627 |
fCirc[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
4843 | 628 |
fCol[i] = GetClanColor(i) |
4786 | 629 |
|
630 |
fSpawnC[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
|
4843 | 631 |
SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 10, 200, 1, 10, 0, 300, 5, fCol[i]) |
632 |
||
633 |
||
4786 | 634 |
fIsMissing[i] = false |
635 |
fNeedsRespawn[i] = false |
|
636 |
fCaptures[i] = 0 |
|
637 |
||
638 |
vCircMinA[i] = 20 |
|
639 |
vCircMaxA[i] = 255 |
|
640 |
vCircType[i] = 1 |
|
641 |
vCircPulse[i] = 10 |
|
642 |
vCircFuckAll[i] = 0 |
|
643 |
vCircRadius[i] = 150 |
|
644 |
vCircWidth[i] = 5 |
|
645 |
vCircCol[i] = fCol[i] |
|
646 |
||
647 |
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
|
648 |
||
649 |
end |
|
650 |
||
651 |
end |
|
652 |
||
653 |
||
654 |
function onNewTurn() |
|
655 |
||
656 |
HandleRespawns() |
|
14993
7d63665cc38b
CTF_Blizzard: Use onCaseDrop function
Wuzzy <Wuzzy2@mail.ru>
parents:
13798
diff
changeset
|
657 |
|
7d63665cc38b
CTF_Blizzard: Use onCaseDrop function
Wuzzy <Wuzzy2@mail.ru>
parents:
13798
diff
changeset
|
658 |
end |
7d63665cc38b
CTF_Blizzard: Use onCaseDrop function
Wuzzy <Wuzzy2@mail.ru>
parents:
13798
diff
changeset
|
659 |
|
7d63665cc38b
CTF_Blizzard: Use onCaseDrop function
Wuzzy <Wuzzy2@mail.ru>
parents:
13798
diff
changeset
|
660 |
function onCaseDrop() |
7d63665cc38b
CTF_Blizzard: Use onCaseDrop function
Wuzzy <Wuzzy2@mail.ru>
parents:
13798
diff
changeset
|
661 |
|
4786 | 662 |
HandleCrateDrops() |
663 |
||
664 |
end |
|
665 |
||
666 |
function onGameTick() |
|
667 |
||
668 |
-- onRessurect calls AFTER you have resurrected, |
|
669 |
-- so keeping track of x,y a few milliseconds before |
|
670 |
-- is useful |
|
13116
3b7cd18c4a06
CTF_Blizzard: Dump dead code / out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
671 |
|
3b7cd18c4a06
CTF_Blizzard: Dump dead code / out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
672 |
for i = 0,1 do |
3b7cd18c4a06
CTF_Blizzard: Dump dead code / out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
673 |
if fThief[i] ~= nil then |
3b7cd18c4a06
CTF_Blizzard: Dump dead code / out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
674 |
fThiefX[i] = GetX(fThief[i]) |
3b7cd18c4a06
CTF_Blizzard: Dump dead code / out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
675 |
fThiefY[i] = GetY(fThief[i]) |
4786 | 676 |
end |
13116
3b7cd18c4a06
CTF_Blizzard: Dump dead code / out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
13019
diff
changeset
|
677 |
end |
4786 | 678 |
|
679 |
-- things we wanna check often |
|
680 |
if (CurrentHedgehog ~= nil) then |
|
681 |
CheckTeleporters() |
|
682 |
end |
|
683 |
||
684 |
HandleCircles() |
|
14995
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
685 |
if (CurrentHedgehog ~= nil) then |
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
686 |
ManageTeleporterEffects() |
2eea2c370389
CTF_Blizzard: Disable sparkles for inactive teleporters
Wuzzy <Wuzzy2@mail.ru>
parents:
14994
diff
changeset
|
687 |
end |
4786 | 688 |
|
689 |
end |
|
690 |
||
691 |
||
692 |
function onAmmoStoreInit() |
|
693 |
||
694 |
SetAmmo(amDrill,9,0,0,0) |
|
695 |
SetAmmo(amMortar,9,0,0,0) |
|
696 |
||
697 |
SetAmmo(amGrenade,9,0,0,0) |
|
698 |
SetAmmo(amClusterBomb,4,0,0,0) |
|
699 |
||
700 |
SetAmmo(amShotgun, 9, 0, 0, 0) |
|
701 |
SetAmmo(amFlamethrower, 1, 0, 0, 1) |
|
702 |
||
703 |
SetAmmo(amFirePunch, 9, 0, 0, 0) |
|
704 |
SetAmmo(amBaseballBat, 2, 0, 0, 0) |
|
705 |
||
706 |
SetAmmo(amDynamite,2,0,0,1) |
|
707 |
SetAmmo(amSMine,4,0,0,0) |
|
708 |
||
709 |
SetAmmo(amBlowTorch, 9, 0, 0, 0) |
|
710 |
SetAmmo(amPickHammer, 9, 0, 0, 0) |
|
711 |
SetAmmo(amGirder, 2, 0, 0, 2) |
|
712 |
SetAmmo(amPortalGun, 2, 0, 0, 2) |
|
713 |
||
714 |
SetAmmo(amParachute, 9, 0, 0, 0) |
|
715 |
SetAmmo(amRope, 9, 0, 0, 0) |
|
4843 | 716 |
SetAmmo(amTeleport, 0, 0, 0, 1) |
4786 | 717 |
SetAmmo(amJetpack, 1, 0, 0, 1) |
718 |
||
719 |
SetAmmo(amSwitch, 2, 0, 0, 1) |
|
720 |
SetAmmo(amExtraTime,1,0,0,1) |
|
721 |
SetAmmo(amLowGravity,1,0,0,0) |
|
722 |
SetAmmo(amSkip, 9, 0, 0, 0) |
|
723 |
||
724 |
end |
|
725 |
||
726 |
||
13630
fe7d2bbf5f3f
Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
727 |
function onGearResurrect(gear, vGear) |
4786 | 728 |
|
729 |
-- mark the flag thief as dead if he needed a respawn |
|
730 |
for i = 0,1 do |
|
731 |
if gear == fThief[i] then |
|
732 |
FlagThiefDead(gear) |
|
733 |
end |
|
734 |
end |
|
735 |
||
736 |
-- place hogs belonging to each clan either left or right side of map |
|
737 |
if GetHogClan(gear) == 0 then |
|
738 |
FindPlace(gear, false, 0, 2048) |
|
739 |
elseif GetHogClan(gear) == 1 then |
|
740 |
FindPlace(gear, false, 2048, LAND_WIDTH) |
|
741 |
end |
|
4843 | 742 |
|
13630
fe7d2bbf5f3f
Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
743 |
if vGear then |
fe7d2bbf5f3f
Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
744 |
SetVisualGearValues(vGear, GetX(gear), GetY(gear)) |
fe7d2bbf5f3f
Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents:
13117
diff
changeset
|
745 |
end |
4786 | 746 |
|
747 |
end |
|
748 |
||
13117
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
749 |
local excessHogsWarning = false |
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
750 |
|
4786 | 751 |
function onGearAdd(gear) |
752 |
||
753 |
if GetGearType(gear) == gtHedgehog then |
|
754 |
||
14999
fe8b4f2da9aa
CTF_Blizzard: Display scores in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
755 |
capturesPerHog[gear] = 0 |
13117
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
756 |
if GetHogClan(gear) > 1 then |
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
757 |
DeleteGear(gear) |
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
758 |
if not excessHogsWarning then |
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
759 |
WriteLnToChat(loc("Only two clans allowed! Excess hedgehogs will be removed.")) |
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
760 |
excessHogsWarning = true |
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
761 |
end |
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
762 |
else |
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
763 |
hhs[numhhs] = gear |
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
764 |
numhhs = numhhs + 1 |
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
765 |
SetEffect(gear, heResurrectable, 1) |
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
766 |
end |
4786 | 767 |
|
13117
cd1561b0337f
CTF_Blizzard: Force clan limit of 2. Auto-remove excess hogs
Wuzzy <Wuzzy2@mail.ru>
parents:
13116
diff
changeset
|
768 |
elseif GetGearType(gear) == gtRope then |
4871 | 769 |
ropeGear = gear |
770 |
end |
|
771 |
||
4786 | 772 |
end |
773 |
||
774 |
function onGearDelete(gear) |
|
775 |
||
776 |
if (gear == fGear[0]) or (gear == fGear[1]) then |
|
777 |
FlagDeleted(gear) |
|
778 |
end |
|
779 |
||
4871 | 780 |
if GetGearType(gear) == gtRope then |
781 |
ropeGear = nil |
|
782 |
end |
|
783 |
||
4953
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
784 |
if GetGearType(gear) == gtHedgehog then |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
785 |
for i = 0, (numhhs-1) do |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
786 |
if gear == hhs[i] then |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
787 |
|
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
788 |
for k = 0,1 do |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
789 |
if gear == fThief[k] then |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
790 |
FlagThiefDead(gear) |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
791 |
end |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
792 |
end |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
793 |
hhs[i] = nil |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
794 |
end |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
795 |
end |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
796 |
end |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
797 |
|
4786 | 798 |
end |