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