4678
|
1 |
--------------------------------
|
|
2 |
-- CTF_BLIZZARD 0.4
|
|
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 |
--game text
|
|
54 |
--------------
|
|
55 |
|
|
56 |
local caption = {
|
|
57 |
["en"] = "CTF: Blizzard v0.4"
|
|
58 |
}
|
|
59 |
|
|
60 |
local subcaption = {
|
|
61 |
["en"] = "by Mikade"
|
|
62 |
}
|
|
63 |
|
|
64 |
local goal = {
|
|
65 |
["en"] = "Capture the enemy flag."
|
|
66 |
}
|
|
67 |
|
|
68 |
-- To handle missing texts we define a small wrapper function that
|
|
69 |
-- we'll use to retrieve text.
|
|
70 |
local function loc(text)
|
|
71 |
if text == nil then return "**missing**"
|
|
72 |
elseif text[L] == nil then return text["en"]
|
|
73 |
else return text[L]
|
|
74 |
end
|
|
75 |
end
|
|
76 |
|
|
77 |
---------------------------------------------------------------
|
|
78 |
----------lots of bad variables and things
|
|
79 |
----------because someone is too lazy
|
|
80 |
----------to read about tables properly
|
|
81 |
------------------ "Oh well, they probably have the memory"
|
|
82 |
|
|
83 |
local actionReset = 0 -- used in CheckTeleporters()
|
|
84 |
|
|
85 |
local roundsCounter = 0 -- used to determine when to spawn more crates
|
|
86 |
-- currently every 6 TURNS, should this work
|
|
87 |
-- on ROUNDS instead?
|
|
88 |
|
|
89 |
--------------------------
|
|
90 |
-- hog and team tracking variales
|
|
91 |
--------------------------
|
|
92 |
|
|
93 |
local numhhs = 0 -- store number of hedgehogs
|
|
94 |
local hhs = {} -- store hedgehog gears
|
|
95 |
|
|
96 |
local numTeams -- store the number of teams in the game
|
|
97 |
local teamNameArr = {} -- store the list of teams
|
|
98 |
local teamSize = {} -- store how many hogs per team
|
|
99 |
local teamIndex = {} -- at what point in the hhs{} does each team begin
|
|
100 |
|
|
101 |
-------------------
|
|
102 |
-- flag variables
|
|
103 |
-------------------
|
|
104 |
|
|
105 |
local fGear = {} -- pointer to the case gears that represent the flag
|
|
106 |
local fThief = {} -- pointer to the hogs who stole the flags
|
|
107 |
local fIsMissing = {} -- have the flags been destroyed or captured
|
|
108 |
local fNeedsRespawn = {} -- do the flags need to be respawned
|
|
109 |
local fCaptures = {} -- the team "scores" how many captures
|
|
110 |
local fSpawnX = {} -- spawn X for flags
|
|
111 |
local fSpawnY = {} -- spawn Y for flags
|
|
112 |
|
|
113 |
local fThiefX = {}
|
|
114 |
local fThiefY = {}
|
|
115 |
local FTTC = 0 -- flag thief tracker counter
|
|
116 |
--local fThiefsHealed = false
|
|
117 |
|
|
118 |
local fCirc = {} -- flag/carrier marker circles
|
|
119 |
local fCol = {} -- colour of the clans
|
|
120 |
|
|
121 |
--------------------------------
|
|
122 |
--zone and teleporter variables
|
|
123 |
--------------------------------
|
|
124 |
|
|
125 |
local redTel
|
|
126 |
local orangeTel
|
|
127 |
--local areaArr = {} -- no longer used
|
|
128 |
|
|
129 |
local zXMin = {}
|
|
130 |
local zWidth = {}
|
|
131 |
local zYMin = {}
|
|
132 |
local zHeight = {}
|
|
133 |
local zOccupied = {}
|
|
134 |
local zCount = 0
|
|
135 |
|
|
136 |
------------------------
|
|
137 |
-- zone methods
|
|
138 |
------------------------
|
|
139 |
-- see on gameTick also
|
|
140 |
|
|
141 |
function CreateZone(xMin, yMin, width, height)
|
|
142 |
|
|
143 |
|
|
144 |
zXMin[zCount] = xMin
|
|
145 |
zYMin[zCount] = yMin
|
|
146 |
zWidth[zCount] = width
|
|
147 |
zHeight[zCount] = height
|
|
148 |
zOccupied[zCount] = false
|
|
149 |
zCount = zCount + 1
|
|
150 |
|
|
151 |
return (zCount-1)
|
|
152 |
|
|
153 |
end
|
|
154 |
|
|
155 |
function GearIsInZone(gear, zI)
|
|
156 |
|
|
157 |
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
|
|
158 |
zOccupied[zI] = true
|
|
159 |
else
|
|
160 |
zOccupied[zI] = false
|
|
161 |
end
|
|
162 |
|
|
163 |
return zOccupied[zI]
|
|
164 |
|
|
165 |
end
|
|
166 |
|
|
167 |
------------------------
|
|
168 |
--flag methods
|
|
169 |
------------------------
|
|
170 |
|
|
171 |
function CheckScore(teamID)
|
|
172 |
|
|
173 |
if teamID == 0 then
|
|
174 |
alt = 1
|
|
175 |
winner = "Red"
|
|
176 |
|
|
177 |
elseif teamID == 1 then
|
|
178 |
alt = 0
|
|
179 |
winner = "Blue"
|
|
180 |
end
|
|
181 |
|
|
182 |
if fCaptures[teamID] == 3 then
|
|
183 |
for i = 0, (numhhs-1) do
|
|
184 |
if GetHogClan(hhs[i]) == alt then
|
|
185 |
SetEffect(hhs[i], heResurrectable, false)
|
|
186 |
SetHealth(hhs[i],0)
|
|
187 |
end
|
|
188 |
end
|
|
189 |
ShowMission("GAME OVER!", "Victory for the " .. winner .. " Team!", "Hooray!", 0, 0)
|
|
190 |
end
|
|
191 |
|
|
192 |
end
|
|
193 |
|
|
194 |
function HandleRespawns()
|
|
195 |
|
|
196 |
for i = 0, 1 do
|
|
197 |
|
|
198 |
if fNeedsRespawn[i] == true then
|
|
199 |
fGear[i] = SpawnAmmoCrate(fSpawnX[i],fSpawnY[i],amSkip)
|
|
200 |
--fGear[i] = SpawnHealthCrate(fSpawnX[i],fSpawnY[i])
|
|
201 |
fNeedsRespawn[i] = false
|
|
202 |
fIsMissing[i] = false -- new, this should solve problems of a respawned flag being "returned" when a player tries to score
|
|
203 |
AddCaption("Flag respawned!")
|
|
204 |
end
|
|
205 |
|
|
206 |
end
|
|
207 |
|
|
208 |
end
|
|
209 |
|
|
210 |
function FlagDeleted(gear)
|
|
211 |
|
|
212 |
if (gear == fGear[0]) then
|
|
213 |
wtf = 0
|
|
214 |
bbq = 1
|
|
215 |
elseif (gear == fGear[1]) then
|
|
216 |
wtf = 1
|
|
217 |
bbq = 0
|
|
218 |
end
|
|
219 |
|
|
220 |
--ShowMission("OH HAI!", "FlagDeleted was called", "Oh noes!", -amBazooka, 0)
|
|
221 |
|
|
222 |
if CurrentHedgehog ~= nil then
|
|
223 |
|
|
224 |
--ShowMission("GUESS WAT?", "I'm not nil", "Oh noes!", -amBazooka, 0)
|
|
225 |
--if the player picks up the flag
|
|
226 |
if CheckDistance(CurrentHedgehog, fGear[wtf]) < 1600 then
|
|
227 |
|
|
228 |
fGear[wtf] = nil -- the flag has now disappeared and we shouldnt be pointing to it
|
|
229 |
|
|
230 |
-- player has successfully captured the enemy flag
|
|
231 |
if (GetHogClan(CurrentHedgehog) == wtf) and (CurrentHedgehog == fThief[bbq]) and (fIsMissing[wtf] == false) then
|
|
232 |
fIsMissing[wtf] = false
|
|
233 |
fNeedsRespawn[wtf] = true
|
|
234 |
fIsMissing[bbq] = false
|
|
235 |
fNeedsRespawn[bbq] = true
|
|
236 |
fCaptures[wtf] = fCaptures[wtf] +1 --fCaptures[wtf]
|
|
237 |
ShowMission("You have SCORED!!", "Red Team: " .. fCaptures[0], "Blue Team: " .. fCaptures[1], -amBazooka, 0)
|
|
238 |
PlaySound(sndVictory)
|
|
239 |
--SetEffect(fThief[bbq], hePoisoned, false)
|
|
240 |
fThief[bbq] = nil -- player no longer has the enemy flag
|
|
241 |
CheckScore(wtf)
|
|
242 |
|
|
243 |
--if the player is returning the flag
|
|
244 |
elseif GetHogClan(CurrentHedgehog) == wtf then
|
|
245 |
|
|
246 |
fNeedsRespawn[wtf] = true
|
|
247 |
|
|
248 |
-- NEW ADDIITON, does this work? Should make it possible to return your flag and then score in the same turn
|
|
249 |
if fIsMissing[wtf] == true then
|
|
250 |
HandleRespawns() -- this will set fIsMissing[wtf] to false :)
|
|
251 |
AddCaption("Flag returned!")
|
|
252 |
elseif fIsMissing[wtf] == false then
|
|
253 |
AddCaption("That was pointless. The flag will respawn next round.")
|
|
254 |
end
|
|
255 |
|
|
256 |
--fIsMissing[wtf] = false
|
|
257 |
--ShowMission("Flag returned!", "Hooray", "", -amBazooka, 0)
|
|
258 |
|
|
259 |
--if the player is taking the enemy flag
|
|
260 |
elseif GetHogClan(CurrentHedgehog) == bbq then
|
|
261 |
fIsMissing[wtf] = true
|
|
262 |
for i = 0,numhhs-1 do
|
|
263 |
if CurrentHedgehog == hhs[i] then
|
|
264 |
fThief[wtf] = hhs[i]
|
|
265 |
--SetEffect(fThief[wtf], hePoisoned, true)
|
|
266 |
end
|
|
267 |
end
|
|
268 |
|
|
269 |
AddCaption("Flag captured!")
|
|
270 |
|
|
271 |
else --below line doesnt usually get called
|
|
272 |
AddCaption("Hmm... that wasn't supposed to happen...")
|
|
273 |
|
|
274 |
end
|
|
275 |
|
|
276 |
-- if flag has been destroyed, probably
|
|
277 |
else
|
|
278 |
|
|
279 |
if GetY(fGear[wtf]) > 2025 then
|
|
280 |
fGear[wtf] = nil
|
|
281 |
fIsMissing[wtf] = true
|
|
282 |
fNeedsRespawn[wtf] = true
|
|
283 |
HandleRespawns()
|
|
284 |
else
|
|
285 |
fGear[wtf] = nil
|
|
286 |
fIsMissing[wtf] = true
|
|
287 |
fNeedsRespawn[wtf] = true
|
|
288 |
AddCaption("Boom! The flag will respawn next round.")
|
|
289 |
end
|
|
290 |
|
|
291 |
end
|
|
292 |
|
|
293 |
-- if flag has been destroyed deep underwater and player is now nil
|
|
294 |
-- probably only gets called if the flag thief drowns himself
|
|
295 |
-- otherwise the above one will work fine
|
|
296 |
else
|
|
297 |
--ShowMission("NIL PLAYER!", "Oh snap", "Oh noes!", -amBazooka, 0)
|
|
298 |
fGear[wtf] = nil
|
|
299 |
fIsMissing[wtf] = true
|
|
300 |
fNeedsRespawn[wtf] = true
|
|
301 |
AddCaption("The flag will respawn next round.")
|
|
302 |
end
|
|
303 |
|
|
304 |
end
|
|
305 |
|
|
306 |
function FlagThiefDead(gear)
|
|
307 |
|
|
308 |
if (gear == fThief[0]) then
|
|
309 |
wtf = 0
|
|
310 |
bbq = 1
|
|
311 |
elseif (gear == fThief[1]) then
|
|
312 |
wtf = 1
|
|
313 |
bbq = 0
|
|
314 |
end
|
|
315 |
|
|
316 |
if fThief[wtf] ~= nil then
|
|
317 |
--SetEffect(fThief[wtf], hePoisoned, false)
|
|
318 |
fGear[wtf] = SpawnAmmoCrate(fThiefX[wtf],fThiefY[wtf]-50,amSkip)
|
|
319 |
AddVisualGear(fThiefX[wtf], fThiefY[wtf], vgtBigExplosion, 0, false)
|
|
320 |
fThief[wtf] = nil
|
|
321 |
end
|
|
322 |
|
|
323 |
end
|
|
324 |
|
|
325 |
function HandleCircles()
|
|
326 |
|
|
327 |
for i = 0, 1 do
|
|
328 |
if fIsMissing[i] == false then -- draw a circle at the flag's spawning place
|
|
329 |
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 33, 2, fCol[i])
|
|
330 |
elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then
|
|
331 |
if fThief[i] ~= nil then -- draw circle round flag carrier
|
|
332 |
SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], 20, 200, 0, 0, 100, 33, 2, fCol[i])
|
|
333 |
elseif fThief[i] == nil then -- draw cirle round dropped flag
|
|
334 |
SetVisualGearValues(fCirc[i], GetX(fGear[i]), GetY(fGear[i]), 20, 200, 0, 0, 100, 33, 2, fCol[i])
|
|
335 |
end
|
|
336 |
end
|
|
337 |
|
|
338 |
if fNeedsRespawn[i] == true then -- if the flag has been destroyed, no need for a circle
|
|
339 |
SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 0, 0, fCol[i])
|
|
340 |
end
|
|
341 |
end
|
|
342 |
|
|
343 |
end
|
|
344 |
|
|
345 |
------------------------
|
|
346 |
-- general methods
|
|
347 |
------------------------
|
|
348 |
|
|
349 |
function CheckDistance(gear1, gear2)
|
|
350 |
|
|
351 |
g1X, g1Y = GetGearPosition(gear1)
|
|
352 |
g2X, g2Y = GetGearPosition(gear2)
|
|
353 |
|
|
354 |
g1X = g1X - g2X
|
|
355 |
g1Y = g1Y - g2Y
|
|
356 |
z = (g1X*g1X) + (g1Y*g1Y)
|
|
357 |
|
|
358 |
--dist = math.sqrt(z)
|
|
359 |
|
|
360 |
dist = z
|
|
361 |
|
|
362 |
return dist
|
|
363 |
|
|
364 |
end
|
|
365 |
|
|
366 |
function CheckTeleporters()
|
|
367 |
|
|
368 |
teleportActive = false
|
|
369 |
|
|
370 |
if (GearIsInZone(CurrentHedgehog, redTel) == true) and (GetHogClan(CurrentHedgehog) == 0) then
|
|
371 |
teleportActive = true
|
|
372 |
destinationX = 1402
|
|
373 |
destinationY = 321
|
|
374 |
elseif (GearIsInZone(CurrentHedgehog, orangeTel) == true) and (GetHogClan(CurrentHedgehog) == 1) then
|
|
375 |
teleportActive = true
|
|
376 |
destinationX = 2692
|
|
377 |
destinationY = 321
|
|
378 |
end
|
|
379 |
|
|
380 |
if teleportActive == true then
|
|
381 |
if actionReset == 0 then
|
|
382 |
SetGearMessage(CurrentHedgehog, gmAttack)
|
|
383 |
--AddCaption(actionReset .. ";" .. "attack")
|
|
384 |
elseif actionReset == 10 then
|
|
385 |
SetGearMessage(CurrentHedgehog, 0)
|
|
386 |
--AddCaption(actionReset .. ";" .. "reset")
|
|
387 |
elseif actionReset == 20 then
|
|
388 |
AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false)
|
|
389 |
SetGearPosition(CurrentHedgehog,destinationX,destinationY)
|
|
390 |
AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false)
|
|
391 |
--AddCaption(actionReset .. ";" .. "teleport")
|
|
392 |
end
|
|
393 |
|
|
394 |
actionReset = actionReset + 1
|
|
395 |
if actionReset >= 30 then
|
|
396 |
actionReset = 0
|
|
397 |
end
|
|
398 |
|
|
399 |
end
|
|
400 |
|
|
401 |
end
|
|
402 |
|
|
403 |
function RebuildTeamInfo()
|
|
404 |
|
|
405 |
|
|
406 |
-- make a list of individual team names
|
|
407 |
for i = 0, 5 do
|
|
408 |
teamNameArr[i] = i
|
|
409 |
teamSize[i] = 0
|
|
410 |
teamIndex[i] = 0
|
|
411 |
end
|
|
412 |
numTeams = 0
|
|
413 |
|
|
414 |
for i = 0, (numhhs-1) do
|
|
415 |
|
|
416 |
z = 0
|
|
417 |
unfinished = true
|
|
418 |
while(unfinished == true) do
|
|
419 |
|
|
420 |
newTeam = true
|
|
421 |
tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name
|
|
422 |
|
|
423 |
if tempHogTeamName == teamNameArr[z] then
|
|
424 |
newTeam = false
|
|
425 |
unfinished = false
|
|
426 |
end
|
|
427 |
|
|
428 |
z = z + 1
|
|
429 |
|
|
430 |
if z == TeamsCount then
|
|
431 |
unfinished = false
|
|
432 |
if newTeam == true then
|
|
433 |
teamNameArr[numTeams] = tempHogTeamName
|
|
434 |
numTeams = numTeams + 1
|
|
435 |
end
|
|
436 |
end
|
|
437 |
|
|
438 |
end
|
|
439 |
|
|
440 |
end
|
|
441 |
|
|
442 |
-- find out how many hogs per team, and the index of the first hog in hhs
|
|
443 |
for i = 0, numTeams-1 do
|
|
444 |
|
|
445 |
for z = 0, numhhs-1 do
|
|
446 |
if GetHogTeamName(hhs[z]) == teamNameArr[i] then
|
|
447 |
if teamSize[i] == 0 then
|
|
448 |
teamIndex[i] = z -- should give starting index
|
|
449 |
end
|
|
450 |
teamSize[i] = teamSize[i] + 1
|
|
451 |
--add a pointer so this hog appears at i in hhs
|
|
452 |
end
|
|
453 |
end
|
|
454 |
|
|
455 |
end
|
|
456 |
|
|
457 |
end
|
|
458 |
|
|
459 |
function HandleCrateDrops()
|
|
460 |
|
|
461 |
roundsCounter = roundsCounter +1
|
|
462 |
|
|
463 |
if roundsCounter == 5 then
|
|
464 |
|
|
465 |
roundsCounter = 0
|
|
466 |
|
|
467 |
r = GetRandom(8)
|
|
468 |
if r == 0 then
|
|
469 |
SpawnAmmoCrate(0,0,amSwitch)
|
|
470 |
elseif r == 1 then
|
|
471 |
SpawnAmmoCrate(0,0,amTeleport)
|
|
472 |
elseif r == 2 then
|
|
473 |
SpawnAmmoCrate(0,0,amJetpack)
|
|
474 |
elseif r == 3 then
|
|
475 |
SpawnUtilityCrate(0,0,amExtraTime)
|
|
476 |
elseif r == 4 then
|
|
477 |
SpawnAmmoCrate(0,0,amGirder)
|
|
478 |
elseif r == 5 then
|
|
479 |
SpawnAmmoCrate(0,0,amDynamite)
|
|
480 |
elseif r == 6 then
|
|
481 |
SpawnAmmoCrate(0,0,amFlamethrower)
|
|
482 |
elseif r == 7 then
|
|
483 |
SpawnAmmoCrate(0,0,amPortalGun)
|
|
484 |
end
|
|
485 |
|
|
486 |
end
|
|
487 |
|
|
488 |
end
|
|
489 |
|
|
490 |
------------------------
|
|
491 |
-- game methods
|
|
492 |
------------------------
|
|
493 |
|
|
494 |
function onGameInit()
|
|
495 |
|
|
496 |
-- Things we don't modify here will use their default values.
|
|
497 |
Seed = 0 -- The base number for the random number generator
|
|
498 |
GameFlags = gfDivideTeams -- Game settings and rules
|
|
499 |
TurnTime = 30000 -- (was 30) The time the player has to move each round (in ms)
|
|
500 |
CaseFreq = 0 -- The frequency of crate drops
|
|
501 |
MinesNum = 0 -- The number of mines being placed
|
|
502 |
MinesTime = 2000
|
|
503 |
Explosives = 0 -- The number of explosives being placed
|
|
504 |
Delay = 10 -- The delay between each round
|
|
505 |
SuddenDeathTurns = 99 -- suddendeath is off, effectively
|
|
506 |
Map = "CTF_Blizzard" -- The map to be played
|
|
507 |
Theme = "Snow" -- The theme to be used "Nature"
|
|
508 |
|
|
509 |
end
|
|
510 |
|
|
511 |
|
|
512 |
function onGameStart()
|
|
513 |
|
|
514 |
ShowMission(loc(caption), loc(subcaption), loc(goal), 0, 0)
|
|
515 |
|
|
516 |
-- initialize teleporters
|
|
517 |
redTel = CreateZone(342,1316,42,449) -- red teleporter
|
|
518 |
orangeTel = CreateZone(3719,1330,45,449) -- orange teleporter
|
|
519 |
|
|
520 |
|
|
521 |
--new improved placement schematics aw yeah
|
|
522 |
RebuildTeamInfo()
|
|
523 |
--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)
|
|
524 |
team1Placed = 0
|
|
525 |
team2Placed = 0
|
|
526 |
for i = 0, (TeamsCount-1) do
|
|
527 |
for g = teamIndex[i], (teamIndex[i]+teamSize[i]-1) do
|
|
528 |
if GetHogClan(hhs[g]) == 0 then
|
|
529 |
SetGearPosition(hhs[g],1403+ ((team1Placed+1)*50),1570)
|
|
530 |
team1Placed = team1Placed +1
|
|
531 |
if team1Placed > 6 then
|
|
532 |
team1Placed = 0
|
|
533 |
end
|
|
534 |
elseif GetHogClan(hhs[g]) == 1 then
|
|
535 |
SetGearPosition(hhs[g],2230+ ((team2Placed+1)*50),1570)
|
|
536 |
team2Placed = team2Placed +1
|
|
537 |
if team2Placed > 6 then
|
|
538 |
team2Placed = 0
|
|
539 |
end
|
|
540 |
end
|
|
541 |
end
|
|
542 |
end
|
|
543 |
|
|
544 |
|
|
545 |
|
|
546 |
--spawn starting ufos and or super weapons
|
|
547 |
SpawnAmmoCrate(2048,1858,amJetpack)
|
|
548 |
--SpawnUtilityCrate(2048,1858,amExtraTime)
|
|
549 |
|
|
550 |
--set flag spawn points and spawn the flags
|
|
551 |
fSpawnX[0] = 957
|
|
552 |
fSpawnY[0] = 1747
|
|
553 |
fSpawnX[1] = 3123
|
|
554 |
fSpawnY[1] = 1747
|
|
555 |
|
|
556 |
for i = 0, 1 do
|
|
557 |
fGear[i] = SpawnAmmoCrate(fSpawnX[i],fSpawnY[i],amSkip)
|
|
558 |
fCirc[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true)
|
|
559 |
fCol[i] = GetClanColor(i)
|
|
560 |
fIsMissing[i] = false
|
|
561 |
fNeedsRespawn[i] = false
|
|
562 |
fCaptures[i] = 0
|
|
563 |
end
|
|
564 |
|
|
565 |
end
|
|
566 |
|
|
567 |
|
|
568 |
function onNewTurn()
|
|
569 |
|
|
570 |
if lastTeam ~= GetHogTeamName(CurrentHedgehog) then
|
|
571 |
lastTeam = GetHogTeamName(CurrentHedgehog)
|
|
572 |
end
|
|
573 |
|
|
574 |
for i = 0, 1 do
|
|
575 |
if fThief[i] ~= nil then
|
|
576 |
--adjust = 5 + GetHealth(fThief[i])
|
|
577 |
--SetHealth(fThief[i], adjust)
|
|
578 |
--AddCaption('Helped out the flag poisoned flag thiefs')
|
|
579 |
end
|
|
580 |
end
|
|
581 |
|
|
582 |
--AddCaption("Handling respawns")
|
|
583 |
HandleRespawns()
|
|
584 |
HandleCrateDrops()
|
|
585 |
|
|
586 |
--myC = AddVisualGear(GetX(CurrentHedgehog),GetY(CurrentHedgehog),vgtCircle,0,true)
|
|
587 |
--SetVisualGearValues(myC, GetX(CurrentHedgehog),GetY(CurrentHedgehog), 20, 200, 0, 0, 100, 50, 3, GetClanColor(GetHogClan(CurrentHedgehog)))
|
|
588 |
|
|
589 |
end
|
|
590 |
|
|
591 |
function onGameTick()
|
|
592 |
|
|
593 |
-- onRessurect calls AFTER you have resurrected,
|
|
594 |
-- so keeping track of x,y a few milliseconds before
|
|
595 |
-- is useful
|
|
596 |
--FTTC = FTTC + 1
|
|
597 |
--if FTTC == 100 then
|
|
598 |
-- FTTC = 0
|
|
599 |
for i = 0,1 do
|
|
600 |
if fThief[i] ~= nil then
|
|
601 |
fThiefX[i] = GetX(fThief[i])
|
|
602 |
fThiefY[i] = GetY(fThief[i])
|
|
603 |
end
|
|
604 |
end
|
|
605 |
--end
|
|
606 |
|
|
607 |
-- things we wanna check often
|
|
608 |
if (CurrentHedgehog ~= nil) then
|
|
609 |
--AddCaption(GetX(CurrentHedgehog) .. "; " .. GetY(CurrentHedgehog))
|
|
610 |
--AddCaption("Checking Teleporters")
|
|
611 |
CheckTeleporters()
|
|
612 |
end
|
|
613 |
|
|
614 |
HandleCircles()
|
|
615 |
|
|
616 |
end
|
|
617 |
|
|
618 |
|
|
619 |
function onAmmoStoreInit()
|
|
620 |
|
|
621 |
SetAmmo(amDrill,9,0,0,0)
|
|
622 |
SetAmmo(amMortar,9,0,0,0)
|
|
623 |
|
|
624 |
SetAmmo(amGrenade,9,0,0,0)
|
|
625 |
SetAmmo(amClusterBomb,4,0,0,0)
|
|
626 |
|
|
627 |
--SetAmmo(amDEagle, 4, 0, 0, 0)
|
|
628 |
SetAmmo(amShotgun, 9, 0, 0, 0)
|
|
629 |
SetAmmo(amFlamethrower, 1, 0, 0, 1)
|
|
630 |
|
|
631 |
SetAmmo(amFirePunch, 9, 0, 0, 0)
|
|
632 |
SetAmmo(amBaseballBat, 2, 0, 0, 0)
|
|
633 |
|
|
634 |
SetAmmo(amDynamite,2,0,0,1)
|
|
635 |
SetAmmo(amSMine,4,0,0,0)
|
|
636 |
|
|
637 |
SetAmmo(amBlowTorch, 9, 0, 0, 0)
|
|
638 |
SetAmmo(amPickHammer, 9, 0, 0, 0)
|
|
639 |
SetAmmo(amGirder, 2, 0, 0, 2)
|
|
640 |
SetAmmo(amPortalGun, 2, 0, 0, 2)
|
|
641 |
|
|
642 |
SetAmmo(amParachute, 9, 0, 0, 0)
|
|
643 |
SetAmmo(amRope, 9, 0, 0, 0)
|
|
644 |
SetAmmo(amTeleport, 0, 0, 0, 1)
|
|
645 |
SetAmmo(amJetpack, 1, 0, 0, 1)
|
|
646 |
|
|
647 |
SetAmmo(amSwitch, 2, 0, 0, 1)
|
|
648 |
SetAmmo(amExtraTime,1,0,0,1)
|
|
649 |
SetAmmo(amLowGravity,1,0,0,0)
|
|
650 |
SetAmmo(amSkip, 9, 0, 0, 0)
|
|
651 |
|
|
652 |
end
|
|
653 |
|
|
654 |
|
|
655 |
function onGearResurrect(gear)
|
|
656 |
|
|
657 |
--AddCaption("A gear has been resurrected!")
|
|
658 |
|
|
659 |
-- mark the flag thief as dead if he needed a respawn
|
|
660 |
for i = 0,1 do
|
|
661 |
if gear == fThief[i] then
|
|
662 |
FlagThiefDead(gear)
|
|
663 |
end
|
|
664 |
end
|
|
665 |
|
|
666 |
-- place hogs belonging to each clan either left or right side of map
|
|
667 |
if GetHogClan(gear) == 0 then
|
|
668 |
FindPlace(gear, false, 0, 2048)
|
|
669 |
elseif GetHogClan(gear) == 1 then
|
|
670 |
FindPlace(gear, false, 2048, LAND_WIDTH)
|
|
671 |
end
|
|
672 |
|
|
673 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
|
|
674 |
|
|
675 |
end
|
|
676 |
|
|
677 |
function onGearDamage(gear, damage)
|
|
678 |
|
|
679 |
-- >_< damn, occurs too fast, before the hog has finished moving / updated his health
|
|
680 |
--if GetGearType(gear) == gtHedgehog then
|
|
681 |
-- if damage > GetHealth(gear) then
|
|
682 |
-- AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false)
|
|
683 |
-- end
|
|
684 |
--end
|
|
685 |
|
|
686 |
end
|
|
687 |
|
|
688 |
function onGearAdd(gear)
|
|
689 |
|
|
690 |
if GetGearType(gear) == gtHedgehog then
|
|
691 |
|
|
692 |
hhs[numhhs] = gear
|
|
693 |
numhhs = numhhs + 1
|
|
694 |
SetEffect(gear, heResurrectable, true)
|
|
695 |
|
|
696 |
end
|
|
697 |
|
|
698 |
end
|
|
699 |
|
|
700 |
function onGearDelete(gear)
|
|
701 |
|
|
702 |
if (gear == fGear[0]) or (gear == fGear[1]) then
|
|
703 |
FlagDeleted(gear)
|
|
704 |
end
|
|
705 |
|
|
706 |
end
|