author | sheepluva |
Tue, 16 Apr 2013 12:24:13 +0200 | |
branch | 0.9.19 |
changeset 8896 | fea1993ded33 |
parent 8349 | a1dbe148f10f |
child 9093 | 4114ce5d885d |
permissions | -rw-r--r-- |
4786 | 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 |
|
8349
a1dbe148f10f
move onNewTurn, onGameTick and onGameTick20 to try and avoid ParseCommand breakage after nextturn call. Needs testing, but should be safe for most scripts. Also fix locale loading.
nemo
parents:
7838
diff
changeset
|
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 |
|
108 |
||
4871 | 109 |
local ropeGear = nil |
110 |
||
4786 | 111 |
-------------------------- |
112 |
-- hog and team tracking variales |
|
113 |
-------------------------- |
|
114 |
||
115 |
local numhhs = 0 -- store number of hedgehogs |
|
116 |
local hhs = {} -- store hedgehog gears |
|
117 |
||
118 |
local numTeams -- store the number of teams in the game |
|
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 |
|
122 |
||
123 |
------------------- |
|
124 |
-- flag variables |
|
125 |
------------------- |
|
126 |
||
127 |
local fGear = {} -- pointer to the case gears that represent the flag |
|
128 |
local fThief = {} -- pointer to the hogs who stole the flags |
|
129 |
local fIsMissing = {} -- have the flags been destroyed or captured |
|
130 |
local fNeedsRespawn = {} -- do the flags need to be respawned |
|
131 |
local fCaptures = {} -- the team "scores" how many captures |
|
132 |
local fSpawnX = {} -- spawn X for flags |
|
133 |
local fSpawnY = {} -- spawn Y for flags |
|
134 |
||
135 |
local fThiefX = {} |
|
136 |
local fThiefY = {} |
|
137 |
local FTTC = 0 -- flag thief tracker counter |
|
138 |
--local fThiefsHealed = false |
|
139 |
||
140 |
local fSpawnC = {} |
|
141 |
local fCirc = {} -- flag/carrier marker circles |
|
142 |
local fCol = {} -- colour of the clans |
|
143 |
||
144 |
local vCircX = {} |
|
145 |
local vCircY = {} |
|
146 |
local vCircMinA = {} |
|
147 |
local vCircMaxA = {} |
|
148 |
local vCircType = {} |
|
149 |
local vCircPulse = {} |
|
150 |
local vCircFuckAll = {} |
|
151 |
local vCircRadius = {} |
|
152 |
local vCircWidth = {} |
|
153 |
local vCircCol = {} |
|
154 |
||
155 |
||
156 |
-------------------------------- |
|
157 |
--zone and teleporter variables |
|
158 |
-------------------------------- |
|
159 |
||
160 |
local redTel |
|
161 |
local orangeTel |
|
162 |
--local areaArr = {} -- no longer used |
|
163 |
||
164 |
local zXMin = {} |
|
165 |
local zWidth = {} |
|
166 |
local zYMin = {} |
|
167 |
local zHeight = {} |
|
168 |
local zOccupied = {} |
|
169 |
local zCount = 0 |
|
170 |
||
171 |
------------------------ |
|
172 |
-- zone methods |
|
173 |
------------------------ |
|
174 |
-- see on gameTick also |
|
175 |
||
176 |
function ManageTeleporterEffects() |
|
177 |
effectTimer = effectTimer + 1 |
|
178 |
if effectTimer > 50 then -- 100 |
|
179 |
effectTimer = 0 |
|
4843 | 180 |
|
181 |
for i = 0,1 do |
|
4786 | 182 |
eX = 10 + zXMin[i] + GetRandom(zWidth[i]-10) |
183 |
eY = 50 + zYMin[i] + GetRandom(zHeight[i]-110) |
|
184 |
||
4843 | 185 |
-- steam and smoke and DUST look good, smokering looks trippy |
4786 | 186 |
-- smoketrace and eviltrace are not effected by wind? |
187 |
-- chunk is a LR falling gear |
|
188 |
tempE = AddVisualGear(eX, eY, vgtDust, 0, false) |
|
189 |
if tempE ~= 0 then |
|
190 |
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
|
191 |
SetVisualGearValues(tempE, eX, eY, g3, g4, g5, g6, g7, g8, g9, fCol[i]) |
|
192 |
end |
|
193 |
end |
|
4843 | 194 |
end |
4786 | 195 |
end |
196 |
||
197 |
function CreateZone(xMin, yMin, width, height) |
|
198 |
||
199 |
||
200 |
zXMin[zCount] = xMin |
|
201 |
zYMin[zCount] = yMin |
|
202 |
zWidth[zCount] = width |
|
203 |
zHeight[zCount] = height |
|
204 |
zOccupied[zCount] = false |
|
205 |
zCount = zCount + 1 |
|
206 |
||
207 |
return (zCount-1) |
|
208 |
||
209 |
end |
|
210 |
||
211 |
function GearIsInZone(gear, zI) |
|
212 |
||
213 |
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 |
|
214 |
zOccupied[zI] = true |
|
215 |
else |
|
216 |
zOccupied[zI] = false |
|
217 |
end |
|
218 |
||
219 |
return zOccupied[zI] |
|
220 |
||
221 |
end |
|
222 |
||
223 |
------------------------ |
|
224 |
--flag methods |
|
225 |
------------------------ |
|
226 |
||
227 |
function CheckScore(teamID) |
|
228 |
||
229 |
if teamID == 0 then |
|
230 |
alt = 1 |
|
231 |
winner = "Red" |
|
232 |
||
233 |
elseif teamID == 1 then |
|
234 |
alt = 0 |
|
235 |
winner = "Blue" |
|
236 |
end |
|
237 |
||
4843 | 238 |
if fCaptures[teamID] == 3 then |
4786 | 239 |
for i = 0, (numhhs-1) do |
240 |
if GetHogClan(hhs[i]) == alt then |
|
7838 | 241 |
SetEffect(hhs[i], heResurrectable, 0) |
4786 | 242 |
SetHealth(hhs[i],0) |
243 |
end |
|
244 |
end |
|
245 |
--ShowMission("GAME OVER!", "Victory for the " .. winner .. " Team!", "Hooray!", 0, 0) |
|
246 |
ShowMission(loc("GAME OVER!"), loc("Victory for the ") .. GetHogTeamName(CurrentHedgehog), loc("Hooray!"), 0, 0) |
|
247 |
end |
|
248 |
||
249 |
end |
|
250 |
||
251 |
function HandleRespawns() |
|
252 |
||
253 |
for i = 0, 1 do |
|
254 |
||
255 |
if fNeedsRespawn[i] == true then |
|
256 |
fGear[i] = SpawnAmmoCrate(fSpawnX[i],fSpawnY[i],amSkip) |
|
257 |
--fGear[i] = SpawnHealthCrate(fSpawnX[i],fSpawnY[i]) |
|
258 |
fNeedsRespawn[i] = false |
|
259 |
fIsMissing[i] = false -- new, this should solve problems of a respawned flag being "returned" when a player tries to score |
|
260 |
AddCaption(loc("Flag respawned!")) |
|
261 |
end |
|
262 |
||
263 |
end |
|
264 |
||
265 |
end |
|
266 |
||
267 |
function FlagDeleted(gear) |
|
268 |
||
269 |
if (gear == fGear[0]) then |
|
270 |
wtf = 0 |
|
271 |
bbq = 1 |
|
272 |
elseif (gear == fGear[1]) then |
|
273 |
wtf = 1 |
|
274 |
bbq = 0 |
|
275 |
end |
|
276 |
||
277 |
--ShowMission("OH HAI!", "FlagDeleted was called", "Oh noes!", -amBazooka, 0) |
|
278 |
||
279 |
if CurrentHedgehog ~= nil then |
|
280 |
||
281 |
--ShowMission("GUESS WAT?", "I'm not nil", "Oh noes!", -amBazooka, 0) |
|
282 |
--if the player picks up the flag |
|
283 |
if CheckDistance(CurrentHedgehog, fGear[wtf]) < 1600 then |
|
284 |
||
285 |
fGear[wtf] = nil -- the flag has now disappeared and we shouldnt be pointing to it |
|
286 |
||
287 |
-- player has successfully captured the enemy flag |
|
288 |
if (GetHogClan(CurrentHedgehog) == wtf) and (CurrentHedgehog == fThief[bbq]) and (fIsMissing[wtf] == false) then |
|
289 |
fIsMissing[wtf] = false |
|
290 |
fNeedsRespawn[wtf] = true |
|
291 |
fIsMissing[bbq] = false |
|
292 |
fNeedsRespawn[bbq] = true |
|
293 |
fCaptures[wtf] = fCaptures[wtf] +1 --fCaptures[wtf] |
|
4843 | 294 |
|
5325
261b79ba22b1
Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents:
4953
diff
changeset
|
295 |
--ShowMission(LOC_NOT("You have SCORED!!"), "Red Team: " .. fCaptures[0], "Blue Team: " .. fCaptures[1], -amBazooka, 0) |
4786 | 296 |
ShowMission(loc("You have SCORED!!"), GetHogTeamName(CurrentHedgehog) .. ": " .. fCaptures[wtf], loc("Opposing Team: ") .. fCaptures[bbq], 0, 0) |
297 |
||
298 |
PlaySound(sndVictory) |
|
299 |
--SetEffect(fThief[bbq], hePoisoned, false) |
|
300 |
fThief[bbq] = nil -- player no longer has the enemy flag |
|
301 |
CheckScore(wtf) |
|
302 |
||
303 |
--if the player is returning the flag |
|
304 |
elseif GetHogClan(CurrentHedgehog) == wtf then |
|
305 |
||
306 |
fNeedsRespawn[wtf] = true |
|
307 |
||
308 |
-- NEW ADDIITON, does this work? Should make it possible to return your flag and then score in the same turn |
|
309 |
if fIsMissing[wtf] == true then |
|
310 |
HandleRespawns() -- this will set fIsMissing[wtf] to false :) |
|
311 |
AddCaption(loc("Flag returned!")) |
|
312 |
elseif fIsMissing[wtf] == false then |
|
313 |
AddCaption(loc("That was pointless.") .. loc("The flag will respawn next round.")) |
|
314 |
end |
|
315 |
||
316 |
--fIsMissing[wtf] = false |
|
317 |
--ShowMission("Flag returned!", "Hooray", "", -amBazooka, 0) |
|
318 |
||
319 |
--if the player is taking the enemy flag |
|
320 |
elseif GetHogClan(CurrentHedgehog) == bbq then |
|
321 |
fIsMissing[wtf] = true |
|
322 |
for i = 0,numhhs-1 do |
|
323 |
if CurrentHedgehog == hhs[i] then |
|
324 |
fThief[wtf] = hhs[i] |
|
325 |
--SetEffect(fThief[wtf], hePoisoned, true) |
|
326 |
end |
|
327 |
end |
|
328 |
||
329 |
AddCaption(loc("Flag captured!")) |
|
330 |
||
331 |
else --below line doesnt usually get called |
|
332 |
AddCaption("Hmm... that wasn't supposed to happen...") |
|
333 |
||
334 |
end |
|
335 |
||
336 |
-- if flag has been destroyed, probably |
|
337 |
else |
|
338 |
||
339 |
if GetY(fGear[wtf]) > 2025 then |
|
340 |
fGear[wtf] = nil |
|
341 |
fIsMissing[wtf] = true |
|
342 |
fNeedsRespawn[wtf] = true |
|
343 |
HandleRespawns() |
|
344 |
else |
|
345 |
fGear[wtf] = nil |
|
346 |
fIsMissing[wtf] = true |
|
347 |
fNeedsRespawn[wtf] = true |
|
348 |
AddCaption(loc("Boom!") .. " " .. loc("The flag will respawn next round.")) |
|
349 |
end |
|
350 |
||
351 |
end |
|
352 |
||
353 |
-- if flag has been destroyed deep underwater and player is now nil |
|
354 |
-- probably only gets called if the flag thief drowns himself |
|
355 |
-- otherwise the above one will work fine |
|
356 |
else |
|
357 |
--ShowMission("NIL PLAYER!", "Oh snap", "Oh noes!", -amBazooka, 0) |
|
358 |
fGear[wtf] = nil |
|
359 |
fIsMissing[wtf] = true |
|
360 |
fNeedsRespawn[wtf] = true |
|
361 |
AddCaption(loc("The flag will respawn next round.")) |
|
362 |
end |
|
363 |
||
364 |
end |
|
365 |
||
366 |
function FlagThiefDead(gear) |
|
367 |
||
368 |
if (gear == fThief[0]) then |
|
369 |
wtf = 0 |
|
370 |
bbq = 1 |
|
371 |
elseif (gear == fThief[1]) then |
|
372 |
wtf = 1 |
|
373 |
bbq = 0 |
|
374 |
end |
|
375 |
||
376 |
if fThief[wtf] ~= nil then |
|
4871 | 377 |
|
378 |
if fThiefY[wtf] > 2040 then |
|
379 |
fGear[wtf] = SpawnAmmoCrate(fThiefX[wtf],(fThiefY[wtf]+10),amSkip) |
|
380 |
else |
|
381 |
fGear[wtf] = SpawnAmmoCrate(fThiefX[wtf],(fThiefY[wtf]-50),amSkip) |
|
382 |
end |
|
383 |
||
4786 | 384 |
AddVisualGear(fThiefX[wtf], fThiefY[wtf], vgtBigExplosion, 0, false) |
385 |
fThief[wtf] = nil |
|
386 |
end |
|
387 |
||
388 |
end |
|
389 |
||
390 |
function HandleCircles() |
|
4843 | 391 |
|
4786 | 392 |
for i = 0, 1 do |
393 |
if fIsMissing[i] == false then -- draw a circle at the flag's spawning place |
|
394 |
--SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
|
395 |
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
|
396 |
elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then |
|
397 |
if fThief[i] ~= nil then -- draw circle round flag carrier |
|
398 |
--SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
|
399 |
SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
|
400 |
elseif fThief[i] == nil then -- draw cirle round dropped flag |
|
401 |
--SetVisualGearValues(fCirc[i], GetX(fGear[i]), GetY(fGear[i]), 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
|
402 |
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]) |
|
403 |
end |
|
404 |
end |
|
4843 | 405 |
|
4786 | 406 |
if fNeedsRespawn[i] == true then -- if the flag has been destroyed, no need for a circle |
407 |
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 0, 0, fCol[i]) |
|
408 |
end |
|
409 |
end |
|
410 |
||
411 |
end |
|
412 |
||
413 |
------------------------ |
|
414 |
-- general methods |
|
415 |
------------------------ |
|
416 |
||
417 |
function CheckDistance(gear1, gear2) |
|
418 |
||
419 |
g1X, g1Y = GetGearPosition(gear1) |
|
420 |
g2X, g2Y = GetGearPosition(gear2) |
|
421 |
||
422 |
g1X = g1X - g2X |
|
423 |
g1Y = g1Y - g2Y |
|
424 |
z = (g1X*g1X) + (g1Y*g1Y) |
|
425 |
||
426 |
--dist = math.sqrt(z) |
|
427 |
||
428 |
dist = z |
|
429 |
||
430 |
return dist |
|
431 |
||
432 |
end |
|
433 |
||
434 |
function CheckTeleporters() |
|
435 |
||
436 |
teleportActive = false |
|
437 |
||
438 |
if (GearIsInZone(CurrentHedgehog, redTel) == true) and (GetHogClan(CurrentHedgehog) == 0) then |
|
439 |
teleportActive = true |
|
440 |
destinationX = 1402 |
|
441 |
destinationY = 321 |
|
442 |
elseif (GearIsInZone(CurrentHedgehog, orangeTel) == true) and (GetHogClan(CurrentHedgehog) == 1) then |
|
443 |
teleportActive = true |
|
444 |
destinationX = 2692 |
|
445 |
destinationY = 321 |
|
446 |
end |
|
447 |
||
448 |
if teleportActive == true then |
|
449 |
if actionReset == 0 then |
|
4871 | 450 |
if ropeGear ~= nil then |
451 |
if GetGearElasticity(ropeGear) ~= 0 then |
|
452 |
SetGearMessage(CurrentHedgehog, gmAttack) |
|
453 |
end |
|
454 |
end |
|
4786 | 455 |
--AddCaption(actionReset .. ";" .. "attack") |
456 |
elseif actionReset == 10 then |
|
457 |
SetGearMessage(CurrentHedgehog, 0) |
|
458 |
--AddCaption(actionReset .. ";" .. "reset") |
|
459 |
elseif actionReset == 20 then |
|
460 |
AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false) |
|
461 |
SetGearPosition(CurrentHedgehog,destinationX,destinationY) |
|
462 |
AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false) |
|
463 |
--AddCaption(actionReset .. ";" .. "teleport") |
|
464 |
end |
|
465 |
||
466 |
actionReset = actionReset + 1 |
|
467 |
if actionReset >= 30 then |
|
468 |
actionReset = 0 |
|
469 |
end |
|
470 |
||
471 |
end |
|
472 |
||
473 |
end |
|
474 |
||
475 |
function RebuildTeamInfo() |
|
476 |
||
477 |
||
478 |
-- 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
|
479 |
for i = 0, (TeamsCount-1) do |
4786 | 480 |
teamNameArr[i] = i |
481 |
teamSize[i] = 0 |
|
482 |
teamIndex[i] = 0 |
|
483 |
end |
|
484 |
numTeams = 0 |
|
485 |
||
486 |
for i = 0, (numhhs-1) do |
|
487 |
||
488 |
z = 0 |
|
489 |
unfinished = true |
|
490 |
while(unfinished == true) do |
|
491 |
||
492 |
newTeam = true |
|
493 |
tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name |
|
494 |
||
495 |
if tempHogTeamName == teamNameArr[z] then |
|
496 |
newTeam = false |
|
497 |
unfinished = false |
|
498 |
end |
|
499 |
||
500 |
z = z + 1 |
|
501 |
||
502 |
if z == TeamsCount then |
|
503 |
unfinished = false |
|
504 |
if newTeam == true then |
|
505 |
teamNameArr[numTeams] = tempHogTeamName |
|
506 |
numTeams = numTeams + 1 |
|
507 |
end |
|
508 |
end |
|
509 |
||
510 |
end |
|
511 |
||
512 |
end |
|
513 |
||
514 |
-- find out how many hogs per team, and the index of the first hog in hhs |
|
515 |
for i = 0, numTeams-1 do |
|
516 |
||
517 |
for z = 0, numhhs-1 do |
|
518 |
if GetHogTeamName(hhs[z]) == teamNameArr[i] then |
|
519 |
if teamSize[i] == 0 then |
|
520 |
teamIndex[i] = z -- should give starting index |
|
521 |
end |
|
522 |
teamSize[i] = teamSize[i] + 1 |
|
523 |
--add a pointer so this hog appears at i in hhs |
|
524 |
end |
|
525 |
end |
|
526 |
||
527 |
end |
|
528 |
||
529 |
end |
|
530 |
||
531 |
function HandleCrateDrops() |
|
532 |
||
533 |
roundsCounter = roundsCounter +1 |
|
534 |
||
535 |
if roundsCounter == 5 then |
|
536 |
||
537 |
roundsCounter = 0 |
|
538 |
||
539 |
r = GetRandom(8) |
|
540 |
if r == 0 then |
|
541 |
SpawnUtilityCrate(0,0,amSwitch) |
|
542 |
elseif r == 1 then |
|
543 |
SpawnUtilityCrate(0,0,amTeleport) |
|
544 |
elseif r == 2 then |
|
545 |
SpawnUtilityCrate(0,0,amJetpack) |
|
546 |
elseif r == 3 then |
|
547 |
SpawnUtilityCrate(0,0,amExtraTime) |
|
548 |
elseif r == 4 then |
|
549 |
SpawnUtilityCrate(0,0,amGirder) |
|
550 |
elseif r == 5 then |
|
551 |
SpawnAmmoCrate(0,0,amDynamite) |
|
552 |
elseif r == 6 then |
|
553 |
SpawnAmmoCrate(0,0,amFlamethrower) |
|
554 |
elseif r == 7 then |
|
555 |
SpawnUtilityCrate(0,0,amPortalGun) |
|
556 |
end |
|
557 |
||
558 |
end |
|
559 |
||
560 |
end |
|
561 |
||
562 |
------------------------ |
|
563 |
-- game methods |
|
564 |
------------------------ |
|
565 |
||
566 |
function onGameInit() |
|
567 |
||
568 |
-- Things we don't modify here will use their default values. |
|
569 |
GameFlags = gfDivideTeams -- Game settings and rules |
|
570 |
TurnTime = 30000 -- (was 30) The time the player has to move each round (in ms) |
|
571 |
CaseFreq = 0 -- The frequency of crate drops |
|
572 |
MinesNum = 0 -- The number of mines being placed |
|
573 |
MinesTime = 2000 |
|
574 |
Explosives = 0 -- The number of explosives being placed |
|
575 |
Delay = 10 -- The delay between each round |
|
5821
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5328
diff
changeset
|
576 |
WaterRise = 0 -- I sure hope this works |
afb988c1a2fe
Allow limited form of SuddenDeath (WaterRise = 0) in both CTF modes
mikade
parents:
5328
diff
changeset
|
577 |
--SuddenDeathTurns = 99 -- suddendeath is off, effectively |
4786 | 578 |
Map = "Blizzard" -- The map to be played |
579 |
Theme = "Snow" -- The theme to be used "Nature" |
|
580 |
||
581 |
end |
|
582 |
||
583 |
||
584 |
function onGameStart() |
|
585 |
||
5328 | 586 |
ShowMission("CTF_BLIZZARD", "", loc(" - Return the enemy flag to your base to score | - First team to 3 captures wins | - You may only score when your flag is in your base | - Hogs will drop the flag if killed, or drowned | - Dropped flags may be returned or recaptured | - Hogs respawn when killed"), 0, 0) |
4786 | 587 |
|
588 |
||
589 |
-- initialize teleporters |
|
590 |
redTel = CreateZone(342,1316,42,449) -- red teleporter |
|
591 |
orangeTel = CreateZone(3719,1330,45,449) -- orange teleporter |
|
592 |
||
593 |
||
594 |
--new improved placement schematics aw yeah |
|
595 |
RebuildTeamInfo() |
|
596 |
--ShowMission("Team Info Rebuilt", "Here you go:", "TeamCount: " .. TeamsCount .. "|" .. teamNameArr[0] .. ": " .. teamSize[0] .. " Hogs|" .. teamNameArr[1] .. ": " .. teamSize[1] .. " Hogs|" .. teamNameArr[2] .. ": " .. teamSize[2] .. " Hogs|", 0, 0) |
|
597 |
team1Placed = 0 |
|
598 |
team2Placed = 0 |
|
599 |
for i = 0, (TeamsCount-1) do |
|
600 |
for g = teamIndex[i], (teamIndex[i]+teamSize[i]-1) do |
|
601 |
if GetHogClan(hhs[g]) == 0 then |
|
602 |
SetGearPosition(hhs[g],1403+ ((team1Placed+1)*50),1570) |
|
603 |
team1Placed = team1Placed +1 |
|
604 |
if team1Placed > 6 then |
|
605 |
team1Placed = 0 |
|
606 |
end |
|
607 |
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
|
608 |
SetGearPosition(hhs[g],2691- ((team2Placed+1)*50),1570) |
4786 | 609 |
team2Placed = team2Placed +1 |
610 |
if team2Placed > 6 then |
|
611 |
team2Placed = 0 |
|
612 |
end |
|
613 |
end |
|
614 |
end |
|
615 |
end |
|
616 |
||
617 |
||
618 |
||
619 |
--spawn starting ufos and or super weapons |
|
620 |
SpawnAmmoCrate(2048,1858,amJetpack) |
|
621 |
--SpawnUtilityCrate(2048,1858,amExtraTime) |
|
622 |
||
623 |
--set flag spawn points and spawn the flags |
|
624 |
fSpawnX[0] = 957 |
|
625 |
fSpawnY[0] = 1747 |
|
626 |
fSpawnX[1] = 3123 |
|
627 |
fSpawnY[1] = 1747 |
|
628 |
||
629 |
for i = 0, 1 do |
|
630 |
fGear[i] = SpawnAmmoCrate(fSpawnX[i],fSpawnY[i],amSkip) |
|
631 |
fCirc[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
|
4843 | 632 |
fCol[i] = GetClanColor(i) |
4786 | 633 |
|
634 |
fSpawnC[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
|
4843 | 635 |
SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 10, 200, 1, 10, 0, 300, 5, fCol[i]) |
636 |
||
637 |
||
4786 | 638 |
fIsMissing[i] = false |
639 |
fNeedsRespawn[i] = false |
|
640 |
fCaptures[i] = 0 |
|
641 |
||
642 |
vCircMinA[i] = 20 |
|
643 |
vCircMaxA[i] = 255 |
|
644 |
vCircType[i] = 1 |
|
645 |
vCircPulse[i] = 10 |
|
646 |
vCircFuckAll[i] = 0 |
|
647 |
vCircRadius[i] = 150 |
|
648 |
vCircWidth[i] = 5 |
|
649 |
vCircCol[i] = fCol[i] |
|
650 |
||
651 |
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
|
652 |
||
653 |
end |
|
654 |
||
655 |
end |
|
656 |
||
657 |
||
658 |
function onNewTurn() |
|
659 |
||
660 |
if lastTeam ~= GetHogTeamName(CurrentHedgehog) then |
|
661 |
lastTeam = GetHogTeamName(CurrentHedgehog) |
|
662 |
end |
|
663 |
||
664 |
for i = 0, 1 do |
|
665 |
if fThief[i] ~= nil then |
|
666 |
--adjust = 5 + GetHealth(fThief[i]) |
|
667 |
--SetHealth(fThief[i], adjust) |
|
668 |
--AddCaption('Helped out the flag poisoned flag thiefs') |
|
669 |
end |
|
670 |
end |
|
671 |
||
672 |
--AddCaption("Handling respawns") |
|
673 |
HandleRespawns() |
|
674 |
HandleCrateDrops() |
|
675 |
||
676 |
--myC = AddVisualGear(GetX(CurrentHedgehog),GetY(CurrentHedgehog),vgtCircle,0,true) |
|
4843 | 677 |
--SetVisualGearValues(myC, GetX(CurrentHedgehog),GetY(CurrentHedgehog), 20, 200, 0, 0, 100, 50, 3, GetClanColor(GetHogClan(CurrentHedgehog))) |
4786 | 678 |
|
679 |
end |
|
680 |
||
681 |
function onGameTick() |
|
682 |
||
683 |
-- onRessurect calls AFTER you have resurrected, |
|
684 |
-- so keeping track of x,y a few milliseconds before |
|
685 |
-- is useful |
|
686 |
--FTTC = FTTC + 1 |
|
687 |
--if FTTC == 100 then |
|
688 |
-- FTTC = 0 |
|
689 |
for i = 0,1 do |
|
690 |
if fThief[i] ~= nil then |
|
691 |
fThiefX[i] = GetX(fThief[i]) |
|
692 |
fThiefY[i] = GetY(fThief[i]) |
|
693 |
end |
|
694 |
end |
|
695 |
--end |
|
696 |
||
697 |
-- things we wanna check often |
|
698 |
if (CurrentHedgehog ~= nil) then |
|
699 |
--AddCaption(GetX(CurrentHedgehog) .. "; " .. GetY(CurrentHedgehog)) |
|
700 |
--AddCaption("Checking Teleporters") |
|
701 |
CheckTeleporters() |
|
702 |
end |
|
703 |
||
704 |
HandleCircles() |
|
705 |
ManageTeleporterEffects() |
|
706 |
||
707 |
end |
|
708 |
||
709 |
||
710 |
function onAmmoStoreInit() |
|
711 |
||
712 |
SetAmmo(amDrill,9,0,0,0) |
|
713 |
SetAmmo(amMortar,9,0,0,0) |
|
714 |
||
715 |
SetAmmo(amGrenade,9,0,0,0) |
|
716 |
SetAmmo(amClusterBomb,4,0,0,0) |
|
717 |
||
718 |
--SetAmmo(amDEagle, 4, 0, 0, 0) |
|
719 |
SetAmmo(amShotgun, 9, 0, 0, 0) |
|
720 |
SetAmmo(amFlamethrower, 1, 0, 0, 1) |
|
721 |
||
722 |
SetAmmo(amFirePunch, 9, 0, 0, 0) |
|
723 |
SetAmmo(amBaseballBat, 2, 0, 0, 0) |
|
4953
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
724 |
--SetAmmo(amKamikaze, 2, 0, 0, 0) |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
725 |
|
4786 | 726 |
|
727 |
SetAmmo(amDynamite,2,0,0,1) |
|
728 |
SetAmmo(amSMine,4,0,0,0) |
|
729 |
||
730 |
SetAmmo(amBlowTorch, 9, 0, 0, 0) |
|
731 |
SetAmmo(amPickHammer, 9, 0, 0, 0) |
|
732 |
SetAmmo(amGirder, 2, 0, 0, 2) |
|
733 |
SetAmmo(amPortalGun, 2, 0, 0, 2) |
|
734 |
||
735 |
SetAmmo(amParachute, 9, 0, 0, 0) |
|
736 |
SetAmmo(amRope, 9, 0, 0, 0) |
|
4843 | 737 |
SetAmmo(amTeleport, 0, 0, 0, 1) |
4786 | 738 |
SetAmmo(amJetpack, 1, 0, 0, 1) |
739 |
||
740 |
SetAmmo(amSwitch, 2, 0, 0, 1) |
|
741 |
SetAmmo(amExtraTime,1,0,0,1) |
|
742 |
SetAmmo(amLowGravity,1,0,0,0) |
|
743 |
SetAmmo(amSkip, 9, 0, 0, 0) |
|
744 |
||
745 |
end |
|
746 |
||
747 |
||
748 |
function onGearResurrect(gear) |
|
749 |
||
750 |
--AddCaption("A gear has been resurrected!") |
|
751 |
||
752 |
-- mark the flag thief as dead if he needed a respawn |
|
753 |
for i = 0,1 do |
|
754 |
if gear == fThief[i] then |
|
755 |
FlagThiefDead(gear) |
|
756 |
end |
|
757 |
end |
|
758 |
||
759 |
-- place hogs belonging to each clan either left or right side of map |
|
760 |
if GetHogClan(gear) == 0 then |
|
761 |
FindPlace(gear, false, 0, 2048) |
|
762 |
elseif GetHogClan(gear) == 1 then |
|
763 |
FindPlace(gear, false, 2048, LAND_WIDTH) |
|
764 |
end |
|
4843 | 765 |
|
4786 | 766 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
767 |
||
768 |
end |
|
769 |
||
770 |
function onGearDamage(gear, damage) |
|
771 |
||
4843 | 772 |
-- >_< damn, occurs too fast, before the hog has finished moving / updated his health |
4786 | 773 |
--if GetGearType(gear) == gtHedgehog then |
774 |
-- if damage > GetHealth(gear) then |
|
4843 | 775 |
-- AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) |
4786 | 776 |
-- end |
777 |
--end |
|
778 |
||
779 |
end |
|
780 |
||
781 |
function onGearAdd(gear) |
|
782 |
||
783 |
if GetGearType(gear) == gtHedgehog then |
|
784 |
||
785 |
hhs[numhhs] = gear |
|
786 |
numhhs = numhhs + 1 |
|
7838 | 787 |
SetEffect(gear, heResurrectable, 1) |
4786 | 788 |
|
789 |
end |
|
790 |
||
4871 | 791 |
if GetGearType(gear) == gtRope then |
792 |
ropeGear = gear |
|
793 |
end |
|
794 |
||
4786 | 795 |
end |
796 |
||
797 |
function onGearDelete(gear) |
|
798 |
||
799 |
if (gear == fGear[0]) or (gear == fGear[1]) then |
|
800 |
FlagDeleted(gear) |
|
801 |
end |
|
802 |
||
4871 | 803 |
if GetGearType(gear) == gtRope then |
804 |
ropeGear = nil |
|
805 |
end |
|
806 |
||
4953
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
807 |
if GetGearType(gear) == gtHedgehog then |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
808 |
for i = 0, (numhhs-1) do |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
809 |
if gear == hhs[i] then |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
810 |
|
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
811 |
for k = 0,1 do |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
812 |
if gear == fThief[k] then |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
813 |
FlagThiefDead(gear) |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
814 |
end |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
815 |
end |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
816 |
hhs[i] = nil |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
817 |
end |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
818 |
end |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
819 |
end |
ebd3dae634ca
Fixed scoring exploit on Control and removed user branding from the map
mikade
parents:
4871
diff
changeset
|
820 |
|
4786 | 821 |
end |