47 -- added visual gears when hogs teleport |
47 -- added visual gears when hogs teleport |
48 -- added visual gear to track flag and flag carriers |
48 -- added visual gear to track flag and flag carriers |
49 -- removed poisoning of flag carriers |
49 -- removed poisoning of flag carriers |
50 -- removed health adjustments for flag carriers due to aforementioned poisons |
50 -- removed health adjustments for flag carriers due to aforementioned poisons |
51 |
51 |
52 -------------- |
52 --------- |
53 --game text |
53 -- 0.5 |
54 -------------- |
54 --------- |
55 |
55 |
56 local caption = { |
56 -- added translation support, hopefully |
57 ["en"] = "CTF: Blizzard v0.4" |
57 -- added ctf rules |
58 } |
58 -- added effects to the teleporters |
59 |
59 -- added aura round spawning area |
60 local subcaption = { |
60 -- changed the aura around the flag carrier / flag to an aura and added some support for this |
61 ["en"] = "by Mikade" |
61 -- changed things so the seed is no longer always the same... |
62 } |
62 |
63 |
63 |
64 local goal = { |
64 loadfile(GetDataPath() .. "Scripts/Locale.lua")() |
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 |
65 |
77 --------------------------------------------------------------- |
66 --------------------------------------------------------------- |
78 ----------lots of bad variables and things |
67 ----------lots of bad variables and things |
79 ----------because someone is too lazy |
68 ----------because someone is too lazy |
80 ----------to read about tables properly |
69 ----------to read about tables properly |
113 local fThiefX = {} |
103 local fThiefX = {} |
114 local fThiefY = {} |
104 local fThiefY = {} |
115 local FTTC = 0 -- flag thief tracker counter |
105 local FTTC = 0 -- flag thief tracker counter |
116 --local fThiefsHealed = false |
106 --local fThiefsHealed = false |
117 |
107 |
|
108 local fSpawnC = {} |
118 local fCirc = {} -- flag/carrier marker circles |
109 local fCirc = {} -- flag/carrier marker circles |
119 local fCol = {} -- colour of the clans |
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 |
120 |
123 |
121 -------------------------------- |
124 -------------------------------- |
122 --zone and teleporter variables |
125 --zone and teleporter variables |
123 -------------------------------- |
126 -------------------------------- |
124 |
127 |
136 ------------------------ |
139 ------------------------ |
137 -- zone methods |
140 -- zone methods |
138 ------------------------ |
141 ------------------------ |
139 -- see on gameTick also |
142 -- see on gameTick also |
140 |
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 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
|
158 SetVisualGearValues(tempE, eX, eY, g3, g4, g5, g6, g7, g8, g9, fCol[i]) |
|
159 end |
|
160 end |
|
161 end |
|
162 |
141 function CreateZone(xMin, yMin, width, height) |
163 function CreateZone(xMin, yMin, width, height) |
142 |
164 |
143 |
165 |
144 zXMin[zCount] = xMin |
166 zXMin[zCount] = xMin |
145 zYMin[zCount] = yMin |
167 zYMin[zCount] = yMin |
177 elseif teamID == 1 then |
199 elseif teamID == 1 then |
178 alt = 0 |
200 alt = 0 |
179 winner = "Blue" |
201 winner = "Blue" |
180 end |
202 end |
181 |
203 |
182 if fCaptures[teamID] == 3 then |
204 if fCaptures[teamID] == 2 then |
183 for i = 0, (numhhs-1) do |
205 for i = 0, (numhhs-1) do |
184 if GetHogClan(hhs[i]) == alt then |
206 if GetHogClan(hhs[i]) == alt then |
185 SetEffect(hhs[i], heResurrectable, false) |
207 SetEffect(hhs[i], heResurrectable, false) |
186 SetHealth(hhs[i],0) |
208 SetHealth(hhs[i],0) |
187 end |
209 end |
188 end |
210 end |
189 ShowMission("GAME OVER!", "Victory for the " .. winner .. " Team!", "Hooray!", 0, 0) |
211 --ShowMission("GAME OVER!", "Victory for the " .. winner .. " Team!", "Hooray!", 0, 0) |
|
212 ShowMission(loc("GAME OVER!"), loc("Victory for the ") .. GetHogTeamName(CurrentHedgehog), loc("Hooray!"), 0, 0) |
190 end |
213 end |
191 |
214 |
192 end |
215 end |
193 |
216 |
194 function HandleRespawns() |
217 function HandleRespawns() |
198 if fNeedsRespawn[i] == true then |
221 if fNeedsRespawn[i] == true then |
199 fGear[i] = SpawnAmmoCrate(fSpawnX[i],fSpawnY[i],amSkip) |
222 fGear[i] = SpawnAmmoCrate(fSpawnX[i],fSpawnY[i],amSkip) |
200 --fGear[i] = SpawnHealthCrate(fSpawnX[i],fSpawnY[i]) |
223 --fGear[i] = SpawnHealthCrate(fSpawnX[i],fSpawnY[i]) |
201 fNeedsRespawn[i] = false |
224 fNeedsRespawn[i] = false |
202 fIsMissing[i] = false -- new, this should solve problems of a respawned flag being "returned" when a player tries to score |
225 fIsMissing[i] = false -- new, this should solve problems of a respawned flag being "returned" when a player tries to score |
203 AddCaption("Flag respawned!") |
226 AddCaption(loc("Flag respawned!")) |
204 end |
227 end |
205 |
228 |
206 end |
229 end |
207 |
230 |
208 end |
231 end |
232 fIsMissing[wtf] = false |
255 fIsMissing[wtf] = false |
233 fNeedsRespawn[wtf] = true |
256 fNeedsRespawn[wtf] = true |
234 fIsMissing[bbq] = false |
257 fIsMissing[bbq] = false |
235 fNeedsRespawn[bbq] = true |
258 fNeedsRespawn[bbq] = true |
236 fCaptures[wtf] = fCaptures[wtf] +1 --fCaptures[wtf] |
259 fCaptures[wtf] = fCaptures[wtf] +1 --fCaptures[wtf] |
237 ShowMission("You have SCORED!!", "Red Team: " .. fCaptures[0], "Blue Team: " .. fCaptures[1], -amBazooka, 0) |
260 |
|
261 --ShowMission(loc("You have SCORED!!"), "Red Team: " .. fCaptures[0], "Blue Team: " .. fCaptures[1], -amBazooka, 0) |
|
262 ShowMission(loc("You have SCORED!!"), GetHogTeamName(CurrentHedgehog) .. ": " .. fCaptures[wtf], loc("Opposing Team: ") .. fCaptures[bbq], 0, 0) |
|
263 |
238 PlaySound(sndVictory) |
264 PlaySound(sndVictory) |
239 --SetEffect(fThief[bbq], hePoisoned, false) |
265 --SetEffect(fThief[bbq], hePoisoned, false) |
240 fThief[bbq] = nil -- player no longer has the enemy flag |
266 fThief[bbq] = nil -- player no longer has the enemy flag |
241 CheckScore(wtf) |
267 CheckScore(wtf) |
242 |
268 |
246 fNeedsRespawn[wtf] = true |
272 fNeedsRespawn[wtf] = true |
247 |
273 |
248 -- NEW ADDIITON, does this work? Should make it possible to return your flag and then score in the same turn |
274 -- 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 |
275 if fIsMissing[wtf] == true then |
250 HandleRespawns() -- this will set fIsMissing[wtf] to false :) |
276 HandleRespawns() -- this will set fIsMissing[wtf] to false :) |
251 AddCaption("Flag returned!") |
277 AddCaption(loc("Flag returned!")) |
252 elseif fIsMissing[wtf] == false then |
278 elseif fIsMissing[wtf] == false then |
253 AddCaption("That was pointless. The flag will respawn next round.") |
279 AddCaption(loc("That was pointless.") .. loc("The flag will respawn next round.")) |
254 end |
280 end |
255 |
281 |
256 --fIsMissing[wtf] = false |
282 --fIsMissing[wtf] = false |
257 --ShowMission("Flag returned!", "Hooray", "", -amBazooka, 0) |
283 --ShowMission("Flag returned!", "Hooray", "", -amBazooka, 0) |
258 |
284 |
324 |
350 |
325 function HandleCircles() |
351 function HandleCircles() |
326 |
352 |
327 for i = 0, 1 do |
353 for i = 0, 1 do |
328 if fIsMissing[i] == false then -- draw a circle at the flag's spawning place |
354 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]) |
355 --SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
|
356 SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
330 elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then |
357 elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then |
331 if fThief[i] ~= nil then -- draw circle round flag carrier |
358 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]) |
359 --SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
|
360 SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
333 elseif fThief[i] == nil then -- draw cirle round dropped flag |
361 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]) |
362 --SetVisualGearValues(fCirc[i], GetX(fGear[i]), GetY(fGear[i]), 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
|
363 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]) |
335 end |
364 end |
336 end |
365 end |
337 |
366 |
338 if fNeedsRespawn[i] == true then -- if the flag has been destroyed, no need for a circle |
367 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]) |
368 SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 0, 0, fCol[i]) |
464 |
493 |
465 roundsCounter = 0 |
494 roundsCounter = 0 |
466 |
495 |
467 r = GetRandom(8) |
496 r = GetRandom(8) |
468 if r == 0 then |
497 if r == 0 then |
469 SpawnAmmoCrate(0,0,amSwitch) |
498 SpawnUtilityCrate(0,0,amSwitch) |
470 elseif r == 1 then |
499 elseif r == 1 then |
471 SpawnAmmoCrate(0,0,amTeleport) |
500 SpawnUtilityCrate(0,0,amTeleport) |
472 elseif r == 2 then |
501 elseif r == 2 then |
473 SpawnAmmoCrate(0,0,amJetpack) |
502 SpawnUtilityCrate(0,0,amJetpack) |
474 elseif r == 3 then |
503 elseif r == 3 then |
475 SpawnUtilityCrate(0,0,amExtraTime) |
504 SpawnUtilityCrate(0,0,amExtraTime) |
476 elseif r == 4 then |
505 elseif r == 4 then |
477 SpawnAmmoCrate(0,0,amGirder) |
506 SpawnUtilityCrate(0,0,amGirder) |
478 elseif r == 5 then |
507 elseif r == 5 then |
479 SpawnAmmoCrate(0,0,amDynamite) |
508 SpawnAmmoCrate(0,0,amDynamite) |
480 elseif r == 6 then |
509 elseif r == 6 then |
481 SpawnAmmoCrate(0,0,amFlamethrower) |
510 SpawnAmmoCrate(0,0,amFlamethrower) |
482 elseif r == 7 then |
511 elseif r == 7 then |
483 SpawnAmmoCrate(0,0,amPortalGun) |
512 SpawnUtilityCrate(0,0,amPortalGun) |
484 end |
513 end |
485 |
514 |
486 end |
515 end |
487 |
516 |
488 end |
517 end |
492 ------------------------ |
521 ------------------------ |
493 |
522 |
494 function onGameInit() |
523 function onGameInit() |
495 |
524 |
496 -- Things we don't modify here will use their default values. |
525 -- 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 |
526 GameFlags = gfDivideTeams -- Game settings and rules |
499 TurnTime = 30000 -- (was 30) The time the player has to move each round (in ms) |
527 TurnTime = 30000 -- (was 30) The time the player has to move each round (in ms) |
500 CaseFreq = 0 -- The frequency of crate drops |
528 CaseFreq = 0 -- The frequency of crate drops |
501 MinesNum = 0 -- The number of mines being placed |
529 MinesNum = 0 -- The number of mines being placed |
502 MinesTime = 2000 |
530 MinesTime = 2000 |
503 Explosives = 0 -- The number of explosives being placed |
531 Explosives = 0 -- The number of explosives being placed |
504 Delay = 10 -- The delay between each round |
532 Delay = 10 -- The delay between each round |
505 SuddenDeathTurns = 99 -- suddendeath is off, effectively |
533 SuddenDeathTurns = 99 -- suddendeath is off, effectively |
506 Map = "CTF_Blizzard" -- The map to be played |
534 Map = "Blizzard" -- The map to be played |
507 Theme = "Snow" -- The theme to be used "Nature" |
535 Theme = "Snow" -- The theme to be used "Nature" |
508 |
536 |
509 end |
537 end |
510 |
538 |
511 |
539 |
512 function onGameStart() |
540 function onGameStart() |
513 |
541 |
514 ShowMission(loc(caption), loc(subcaption), loc(goal), 0, 0) |
542 --ShowMission(loc(caption), loc(subcaption), loc(goal), 0, 0) |
|
543 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) |
|
544 |
515 |
545 |
516 -- initialize teleporters |
546 -- initialize teleporters |
517 redTel = CreateZone(342,1316,42,449) -- red teleporter |
547 redTel = CreateZone(342,1316,42,449) -- red teleporter |
518 orangeTel = CreateZone(3719,1330,45,449) -- orange teleporter |
548 orangeTel = CreateZone(3719,1330,45,449) -- orange teleporter |
519 |
549 |
554 fSpawnY[1] = 1747 |
584 fSpawnY[1] = 1747 |
555 |
585 |
556 for i = 0, 1 do |
586 for i = 0, 1 do |
557 fGear[i] = SpawnAmmoCrate(fSpawnX[i],fSpawnY[i],amSkip) |
587 fGear[i] = SpawnAmmoCrate(fSpawnX[i],fSpawnY[i],amSkip) |
558 fCirc[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
588 fCirc[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
559 fCol[i] = GetClanColor(i) |
589 fCol[i] = GetClanColor(i) |
|
590 |
|
591 fSpawnC[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
|
592 SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 10, 200, 1, 10, 0, 300, 5, fCol[i]) |
|
593 |
|
594 |
560 fIsMissing[i] = false |
595 fIsMissing[i] = false |
561 fNeedsRespawn[i] = false |
596 fNeedsRespawn[i] = false |
562 fCaptures[i] = 0 |
597 fCaptures[i] = 0 |
|
598 |
|
599 vCircMinA[i] = 20 |
|
600 vCircMaxA[i] = 255 |
|
601 vCircType[i] = 1 |
|
602 vCircPulse[i] = 10 |
|
603 vCircFuckAll[i] = 0 |
|
604 vCircRadius[i] = 150 |
|
605 vCircWidth[i] = 5 |
|
606 vCircCol[i] = fCol[i] |
|
607 |
|
608 SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
|
609 |
563 end |
610 end |
564 |
611 |
565 end |
612 end |
566 |
613 |
567 |
614 |
639 SetAmmo(amGirder, 2, 0, 0, 2) |
687 SetAmmo(amGirder, 2, 0, 0, 2) |
640 SetAmmo(amPortalGun, 2, 0, 0, 2) |
688 SetAmmo(amPortalGun, 2, 0, 0, 2) |
641 |
689 |
642 SetAmmo(amParachute, 9, 0, 0, 0) |
690 SetAmmo(amParachute, 9, 0, 0, 0) |
643 SetAmmo(amRope, 9, 0, 0, 0) |
691 SetAmmo(amRope, 9, 0, 0, 0) |
644 SetAmmo(amTeleport, 0, 0, 0, 1) |
692 SetAmmo(amTeleport, 1, 0, 0, 1) |
645 SetAmmo(amJetpack, 1, 0, 0, 1) |
693 SetAmmo(amJetpack, 1, 0, 0, 1) |
646 |
694 |
647 SetAmmo(amSwitch, 2, 0, 0, 1) |
695 SetAmmo(amSwitch, 2, 0, 0, 1) |
648 SetAmmo(amExtraTime,1,0,0,1) |
696 SetAmmo(amExtraTime,1,0,0,1) |
649 SetAmmo(amLowGravity,1,0,0,0) |
697 SetAmmo(amLowGravity,1,0,0,0) |