47 --------- |
47 --------- |
48 -- [fufufufu kamikaze fix] |
48 -- [fufufufu kamikaze fix] |
49 -- added nill checks to make sure the player doesn't generate errors by producing a nil value in hhs[] when he uses kamikaze |
49 -- added nill checks to make sure the player doesn't generate errors by producing a nil value in hhs[] when he uses kamikaze |
50 -- added a check to make sure the player doesn't kamikaze straight down and make the flag's starting point underwater |
50 -- added a check to make sure the player doesn't kamikaze straight down and make the flag's starting point underwater |
51 -- added a check to make sure the player drops the flag if he has it and he uses kamikaze |
51 -- added a check to make sure the player drops the flag if he has it and he uses kamikaze |
|
52 |
|
53 -------- |
|
54 -- 0.4 |
|
55 -------- |
|
56 |
|
57 -- remove user-branding and version numbers |
|
58 -- removed some stuff that wasn't needed |
|
59 -- fix piano strike exploit |
|
60 -- changed delay to allow for better portals |
|
61 -- changed starting feedback a little |
|
62 -- increased the radius around the circle indicating the flag thief so that it doesn't obscure his health |
52 |
63 |
53 ----------------- |
64 ----------------- |
54 --SCRIPT BEGINS |
65 --SCRIPT BEGINS |
55 ----------------- |
66 ----------------- |
56 |
67 |
225 |
232 |
226 if fNeedsRespawn[i] == true then |
233 if fNeedsRespawn[i] == true then |
227 fGear[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
234 fGear[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
228 fGearX[i] = fSpawnX[i] |
235 fGearX[i] = fSpawnX[i] |
229 fGearY[i] = fSpawnY[i] |
236 fGearY[i] = fSpawnY[i] |
230 --fGear[i] = SpawnAmmoCrate(fSpawnX[i],fSpawnY[i],amSkip) |
237 |
231 fNeedsRespawn[i] = false |
238 fNeedsRespawn[i] = false |
232 fIsMissing[i] = false -- new, this should solve problems of a respawned flag being "returned" when a player tries to score |
239 fIsMissing[i] = false -- new, this should solve problems of a respawned flag being "returned" when a player tries to score |
233 AddCaption(loc("Flag respawned!")) |
240 AddCaption(loc("Flag respawned!")) |
234 end |
241 end |
235 |
242 |
253 --ShowMission(LAND_HEIGHT, fThiefY[wtf], (LAND_HEIGHT - fThiefY[wtf]), 0, 0) |
260 --ShowMission(LAND_HEIGHT, fThiefY[wtf], (LAND_HEIGHT - fThiefY[wtf]), 0, 0) |
254 if (LAND_HEIGHT - fThiefY[wtf]) < 15 then |
261 if (LAND_HEIGHT - fThiefY[wtf]) < 15 then |
255 fIsMissing[wtf] = true |
262 fIsMissing[wtf] = true |
256 fNeedsRespawn[wtf] = true |
263 fNeedsRespawn[wtf] = true |
257 HandleRespawns() |
264 HandleRespawns() |
258 --AddCaption("hah??") |
|
259 else --normally |
265 else --normally |
260 fGearX[wtf] = fThiefX[wtf] |
266 fGearX[wtf] = fThiefX[wtf] |
261 fGearY[wtf] = fThiefY[wtf] |
267 fGearY[wtf] = fThiefY[wtf] |
262 fGear[wtf] = AddVisualGear(fGearX[wtf],fGearY[wtf],vgtCircle,0,true) |
268 fGear[wtf] = AddVisualGear(fGearX[wtf],fGearY[wtf],vgtCircle,0,true) |
263 --fGear[wtf] = AddVisualGear(fThiefX[wtf],fThiefY[wtf],vgtCircle,0,true) |
|
264 end |
269 end |
265 |
270 |
266 AddVisualGear(fThiefX[wtf], fThiefY[wtf], vgtBigExplosion, 0, false) |
271 AddVisualGear(fThiefX[wtf], fThiefY[wtf], vgtBigExplosion, 0, false) |
267 fThief[wtf] = nil |
272 fThief[wtf] = nil |
268 end |
273 end |
288 SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 20, 0, 10, 0, 33, 3, fCol[i]) |
293 SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 20, 0, 10, 0, 33, 3, fCol[i]) |
289 if fGear[i] ~= nil then -- draw the flag gear itself |
294 if fGear[i] ~= nil then -- draw the flag gear itself |
290 SetVisualGearValues(fGear[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, fGearRad, 2, fCol[i]) |
295 SetVisualGearValues(fGear[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, fGearRad, 2, fCol[i]) |
291 end |
296 end |
292 elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then |
297 elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then |
293 if fThief[i] ~= nil then -- draw circle round flag carrier |
298 if fThief[i] ~= nil then -- draw circle round flag carrier -- 33 |
294 SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], 20, 200, 0, 0, 100, 33, 3, fCol[i]) |
299 SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], 20, 200, 0, 0, 100, 50, 3, fCol[i]) |
295 --AddCaption("circle marking carrier") |
300 --AddCaption("circle marking carrier") |
296 elseif fThief[i] == nil then -- draw cirle round dropped flag |
301 elseif fThief[i] == nil then -- draw cirle round dropped flag |
297 --g1X,g1Y,g4,g5,g6,g7,g8,g9,g10,g11 = GetVisualGearValues(fGear[i]) |
302 --g1X,g1Y,g4,g5,g6,g7,g8,g9,g10,g11 = GetVisualGearValues(fGear[i]) |
298 --SetVisualGearValues(fCirc[i], g1X, g1Y, 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
303 --SetVisualGearValues(fCirc[i], g1X, g1Y, 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
299 SetVisualGearValues(fCirc[i], fGearX[i], fGearY[i], 20, 200, 0, 0, 100, 33, 3, fCol[i]) |
304 SetVisualGearValues(fCirc[i], fGearX[i], fGearY[i], 20, 200, 0, 0, 100, 33, 3, fCol[i]) |
417 fCaptures[i] = 0 |
422 fCaptures[i] = 0 |
418 |
423 |
419 --SetVisualGearValues(zxc, 1000,1000, 20, 100, 0, 10, 1, 100, 5, GetClanColor(0)) |
424 --SetVisualGearValues(zxc, 1000,1000, 20, 100, 0, 10, 1, 100, 5, GetClanColor(0)) |
420 |
425 |
421 SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 20, 100, 0, 10, 0, 75, 5, fCol[i]) |
426 SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 20, 100, 0, 10, 0, 75, 5, fCol[i]) |
422 --SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 20, 0, 10, 0, 33, 3, fCol[i]) |
|
423 |
|
424 |
427 |
425 end |
428 end |
426 |
429 |
427 end |
430 end |
428 |
431 |
430 -- game methods |
433 -- game methods |
431 ------------------------ |
434 ------------------------ |
432 |
435 |
433 function onGameInit() |
436 function onGameInit() |
434 |
437 |
435 -- Things we don't modify here will use their default values. |
|
436 |
|
437 GameFlags = band(bor(GameFlags, gfDivideTeams), bnot(gfKing + gfForts)) |
438 GameFlags = band(bor(GameFlags, gfDivideTeams), bnot(gfKing + gfForts)) |
438 SuddenDeathTurns = 99 -- suddendeath is off, effectively |
439 SuddenDeathTurns = 999 -- suddendeath is off, effectively |
439 --TurnTime = 30000 -- (was 30) The time the player has to move each round (in ms) |
440 Delay = 10 |
440 --Delay = 10 -- The delay between each round |
|
441 |
441 |
442 end |
442 end |
443 |
443 |
444 |
444 |
445 function onGameStart() |
445 function onGameStart() |
446 |
446 |
447 --ShowMission(loc(caption), loc(subcaption), loc(goal), 0, 0) |
447 --ShowMission(loc(caption), loc(subcaption), loc(goal), 0, 0) |
448 ShowMission(loc("CAPTURE THE FLAG"), loc("by mikade"), loc("CUSTOM BUILD 0.2"), 0, 0) |
448 ShowMission(loc("CAPTURE THE FLAG"), loc("Flags, and their home base will be placed where each team ends their first turn."), "", 0, 0) |
449 |
449 |
450 RebuildTeamInfo() |
450 RebuildTeamInfo() |
451 |
451 |
452 -- should gfDivideTeams do this automatically? |
452 -- should gfDivideTeams do this automatically? |
453 --[[for i = 0, (TeamsCount-1) do |
453 --[[for i = 0, (TeamsCount-1) do |
482 --AddCaption("Handling respawns") |
482 --AddCaption("Handling respawns") |
483 if gameStarted == true then |
483 if gameStarted == true then |
484 HandleRespawns() |
484 HandleRespawns() |
485 --new method of placing starting flags |
485 --new method of placing starting flags |
486 elseif gameTurns == 1 then |
486 elseif gameTurns == 1 then |
487 ShowMission(loc("CAPTURE THE FLAG"), loc("Flags will be placed where each team ends their turn."), "", 0, 0) |
487 ShowMission(loc("CAPTURE THE FLAG"), loc("Flags, and their home base will be placed where each team ends their first turn."), "", 0, 0) |
488 elseif gameTurns == 2 then |
488 elseif gameTurns == 2 then |
489 fPlaced[0] = true |
489 fPlaced[0] = true |
490 ShowMission(loc("CAPTURE THE FLAG"), loc("RULES OF THE GAME [Press ESC to view]"), 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) |
490 ShowMission(loc("CAPTURE THE FLAG"), loc("RULES OF THE GAME [Press ESC to view]"), 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) |
491 elseif gameTurns == 3 then |
491 elseif gameTurns == 3 then |
492 fPlaced[1] = true |
492 fPlaced[1] = true |
560 |
560 |
561 AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
561 AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
562 |
562 |
563 end |
563 end |
564 |
564 |
565 function onGearDamage(gear, damage) |
|
566 -- |
|
567 end |
|
568 |
|
569 function onGearAdd(gear) |
565 function onGearAdd(gear) |
570 |
566 |
571 if GetGearType(gear) == gtHedgehog then |
567 if GetGearType(gear) == gtHedgehog then |
572 hhs[numhhs] = gear |
568 hhs[numhhs] = gear |
573 numhhs = numhhs + 1 |
569 numhhs = numhhs + 1 |
574 SetEffect(gear, heResurrectable, true) |
570 SetEffect(gear, heResurrectable, true) |
|
571 |
|
572 elseif GetGearType(gear) == gtPiano then |
|
573 |
|
574 for i = 0, 1 do |
|
575 if CurrentHedgehog == fThief[i] then |
|
576 FlagThiefDead(gear) |
|
577 end |
|
578 end |
|
579 |
575 end |
580 end |
576 |
581 |
577 end |
582 end |
578 |
583 |
579 function onGearDelete(gear) |
584 function onGearDelete(gear) |
580 |
585 |
581 if GetGearType(gear) == gtHedgehog then |
586 if GetGearType(gear) == gtHedgehog then |
582 --AddCaption("gear deleted!") |
|
583 for i = 0, (numhhs-1) do |
587 for i = 0, (numhhs-1) do |
584 if gear == hhs[i] then |
588 if gear == hhs[i] then |
585 |
589 |
586 for i = 0,1 do |
590 for i = 0,1 do |
587 if gear == fThief[i] then |
591 if gear == fThief[i] then |
588 FlagThiefDead(gear) |
592 FlagThiefDead(gear) |
589 end |
593 end |
590 end |
594 end |
591 hhs[i] = nil |
595 hhs[i] = nil |
592 --AddCaption("for real") |
|
593 end |
596 end |
594 end |
597 end |
595 end |
598 end |
596 |
599 |
597 end |
600 end |