163 bbq = 1 |
163 bbq = 1 |
164 elseif (gear == fGear[1]) then |
164 elseif (gear == fGear[1]) then |
165 wtf = 1 |
165 wtf = 1 |
166 bbq = 0 |
166 bbq = 0 |
167 end |
167 end |
168 |
168 |
169 -- player has successfully captured the enemy flag |
169 -- player has successfully captured the enemy flag |
170 if (GetHogClan(CurrentHedgehog) == wtf) and (CurrentHedgehog == fThief[bbq]) and (fIsMissing[wtf] == false) then |
170 if (GetHogClan(CurrentHedgehog) == wtf) and (CurrentHedgehog == fThief[bbq]) and (fIsMissing[wtf] == false) then |
171 |
171 |
172 DeleteVisualGear(fGear[wtf]) |
172 DeleteVisualGear(fGear[wtf]) |
173 fGear[wtf] = nil -- the flag has now disappeared |
173 fGear[wtf] = nil -- the flag has now disappeared |
174 |
174 |
175 fIsMissing[wtf] = false |
175 fIsMissing[wtf] = false |
176 fNeedsRespawn[wtf] = true |
176 fNeedsRespawn[wtf] = true |
177 fIsMissing[bbq] = false |
177 fIsMissing[bbq] = false |
178 fNeedsRespawn[bbq] = true |
178 fNeedsRespawn[bbq] = true |
179 fCaptures[wtf] = fCaptures[wtf] +1 |
179 fCaptures[wtf] = fCaptures[wtf] +1 |
180 ShowMission(loc("You have SCORED!!"), GetHogTeamName(CurrentHedgehog) .. ": " .. fCaptures[wtf], loc("Opposing Team: ") .. fCaptures[bbq], 0, 0) |
180 ShowMission(loc("You have SCORED!!"), GetHogTeamName(CurrentHedgehog) .. ": " .. fCaptures[wtf], loc("Opposing Team: ") .. fCaptures[bbq], 0, 0) |
181 PlaySound(sndVictory) |
181 PlaySound(sndVictory) |
182 fThief[bbq] = nil -- player no longer has the enemy flag |
182 fThief[bbq] = nil -- player no longer has the enemy flag |
183 CheckScore(wtf) |
183 CheckScore(wtf) |
184 |
184 |
185 --if the player is returning the flag |
185 --if the player is returning the flag |
186 elseif (GetHogClan(CurrentHedgehog) == wtf) and (fIsMissing[wtf] == true) then |
186 elseif (GetHogClan(CurrentHedgehog) == wtf) and (fIsMissing[wtf] == true) then |
187 |
187 |
188 DeleteVisualGear(fGear[wtf]) |
188 DeleteVisualGear(fGear[wtf]) |
189 fGear[wtf] = nil -- the flag has now disappeared |
189 fGear[wtf] = nil -- the flag has now disappeared |
190 |
190 |
191 fNeedsRespawn[wtf] = true |
191 fNeedsRespawn[wtf] = true |
192 HandleRespawns() -- this will set fIsMissing[wtf] to false :) |
192 HandleRespawns() -- this will set fIsMissing[wtf] to false :) |
193 AddCaption(loc("Flag returned!")) |
193 AddCaption(loc("Flag returned!")) |
194 |
194 |
195 --if the player is taking the enemy flag |
195 --if the player is taking the enemy flag |
196 elseif GetHogClan(CurrentHedgehog) == bbq then |
196 elseif GetHogClan(CurrentHedgehog) == bbq then |
197 |
197 |
198 DeleteVisualGear(fGear[wtf]) |
198 DeleteVisualGear(fGear[wtf]) |
199 fGear[wtf] = nil -- the flag has now disappeared |
199 fGear[wtf] = nil -- the flag has now disappeared |
200 |
200 |
201 fIsMissing[wtf] = true |
201 fIsMissing[wtf] = true |
202 for i = 0,numhhs-1 do |
202 for i = 0,numhhs-1 do |
203 if CurrentHedgehog ~= nil then |
203 if CurrentHedgehog ~= nil then |
204 if CurrentHedgehog == hhs[i] then |
204 if CurrentHedgehog == hhs[i] then |
205 fThief[wtf] = hhs[i] |
205 fThief[wtf] = hhs[i] |
206 end |
206 end |
207 end |
207 end |
208 end |
208 end |
209 AddCaption(loc("Flag captured!")) |
209 AddCaption(loc("Flag captured!")) |
210 |
210 |
211 end |
211 end |
212 |
212 |
213 end |
213 end |
214 |
214 |
215 function CheckFlagProximity() |
215 function CheckFlagProximity() |
216 |
216 |
217 for i = 0, 1 do |
217 for i = 0, 1 do |
218 if fGear[i] ~= nil then |
218 if fGear[i] ~= nil then |
219 |
219 |
220 g1X = fGearX[i] |
220 g1X = fGearX[i] |
221 g1Y = fGearY[i] |
221 g1Y = fGearY[i] |
222 |
222 |
223 g2X, g2Y = GetGearPosition(CurrentHedgehog) |
223 g2X, g2Y = GetGearPosition(CurrentHedgehog) |
224 |
224 |
225 q = g1X - g2X |
225 q = g1X - g2X |
226 w = g1Y - g2Y |
226 w = g1Y - g2Y |
227 dist = (q*q) + (w*w) |
227 dist = (q*q) + (w*w) |
228 |
228 |
229 if dist < 500 then --1600 |
229 if dist < 500 then --1600 |
230 DoFlagStuff(fGear[i]) |
230 DoFlagStuff(fGear[i]) |
231 end |
231 end |
232 end |
232 end |
233 end |
233 end |
263 wtf = 1 |
263 wtf = 1 |
264 bbq = 0 |
264 bbq = 0 |
265 end |
265 end |
266 |
266 |
267 if fThief[wtf] ~= nil then |
267 if fThief[wtf] ~= nil then |
268 -- falls into water |
268 -- falls into water |
269 --ShowMission(LAND_HEIGHT, fThiefY[wtf], (LAND_HEIGHT - fThiefY[wtf]), 0, 0) |
269 --ShowMission(LAND_HEIGHT, fThiefY[wtf], (LAND_HEIGHT - fThiefY[wtf]), 0, 0) |
270 if (LAND_HEIGHT - fThiefY[wtf]) < 15 then |
270 if (LAND_HEIGHT - fThiefY[wtf]) < 15 then |
271 fIsMissing[wtf] = true |
271 fIsMissing[wtf] = true |
272 fNeedsRespawn[wtf] = true |
272 fNeedsRespawn[wtf] = true |
273 HandleRespawns() |
273 HandleRespawns() |
274 else --normally |
274 else --normally |
275 fGearX[wtf] = fThiefX[wtf] |
275 fGearX[wtf] = fThiefX[wtf] |
276 fGearY[wtf] = fThiefY[wtf] |
276 fGearY[wtf] = fThiefY[wtf] |
277 fGear[wtf] = AddVisualGear(fGearX[wtf],fGearY[wtf],vgtCircle,0,true) |
277 fGear[wtf] = AddVisualGear(fGearX[wtf],fGearY[wtf],vgtCircle,0,true) |
278 end |
278 end |
279 |
279 |
280 AddVisualGear(fThiefX[wtf], fThiefY[wtf], vgtBigExplosion, 0, false) |
280 AddVisualGear(fThiefX[wtf], fThiefY[wtf], vgtBigExplosion, 0, false) |
281 fThief[wtf] = nil |
281 fThief[wtf] = nil |
282 end |
282 end |
288 fGearTimer = fGearTimer + 1 |
288 fGearTimer = fGearTimer + 1 |
289 if fGearTimer == 50 then |
289 if fGearTimer == 50 then |
290 fGearTimer = 0 |
290 fGearTimer = 0 |
291 fGearRad = fGearRad + 1 |
291 fGearRad = fGearRad + 1 |
292 if fGearRad > fGearRadMax then |
292 if fGearRad > fGearRadMax then |
293 fGearRad = fGearRadMin |
293 fGearRad = fGearRadMin |
294 end |
294 end |
295 end |
295 end |
296 |
296 |
297 for i = 0, 1 do |
297 for i = 0, 1 do |
298 |
298 |
299 --SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 50, 3, fCol[i]) -- draw a circ for spawning area |
299 --SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 50, 3, fCol[i]) -- draw a circ for spawning area |
300 |
300 |
301 if fIsMissing[i] == false then -- draw a flag marker at the flag's spawning place |
301 if fIsMissing[i] == false then -- draw a flag marker at the flag's spawning place |
302 SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 20, 0, 10, 0, 33, 3, fCol[i]) |
302 SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 20, 0, 10, 0, 33, 3, fCol[i]) |
303 if fGear[i] ~= nil then -- draw the flag gear itself |
303 if fGear[i] ~= nil then -- draw the flag gear itself |
304 SetVisualGearValues(fGear[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, fGearRad, 2, fCol[i]) |
304 SetVisualGearValues(fGear[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, fGearRad, 2, fCol[i]) |
305 end |
305 end |
306 elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then |
306 elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then |
307 if fThief[i] ~= nil then -- draw circle round flag carrier -- 33 |
307 if fThief[i] ~= nil then -- draw circle round flag carrier -- 33 |
308 SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], 20, 200, 0, 0, 100, 50, 3, fCol[i]) |
308 SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], 20, 200, 0, 0, 100, 50, 3, fCol[i]) |
309 --AddCaption("circle marking carrier") |
309 --AddCaption("circle marking carrier") |
310 elseif fThief[i] == nil then -- draw cirle round dropped flag |
310 elseif fThief[i] == nil then -- draw cirle round dropped flag |
311 --g1X,g1Y,g4,g5,g6,g7,g8,g9,g10,g11 = GetVisualGearValues(fGear[i]) |
311 --g1X,g1Y,g4,g5,g6,g7,g8,g9,g10,g11 = GetVisualGearValues(fGear[i]) |
312 --SetVisualGearValues(fCirc[i], g1X, g1Y, 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
312 --SetVisualGearValues(fCirc[i], g1X, g1Y, 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
313 SetVisualGearValues(fCirc[i], fGearX[i], fGearY[i], 20, 200, 0, 0, 100, 33, 3, fCol[i]) |
313 SetVisualGearValues(fCirc[i], fGearX[i], fGearY[i], 20, 200, 0, 0, 100, 33, 3, fCol[i]) |
314 --AddCaption('dropped circle marker') |
314 --AddCaption('dropped circle marker') |
315 if fGear[i] ~= nil then -- flag gear itself |
315 if fGear[i] ~= nil then -- flag gear itself |
316 --SetVisualGearValues(fGear[i], g1X, g1Y, 20, 200, 0, 0, 100, 10, 4, fCol[i]) |
316 --SetVisualGearValues(fGear[i], g1X, g1Y, 20, 200, 0, 0, 100, 10, 4, fCol[i]) |
317 SetVisualGearValues(fGear[i], fGearX[i], fGearY[i], 20, 200, 0, 0, 100, fGearRad, 2, fCol[i]) |
317 SetVisualGearValues(fGear[i], fGearX[i], fGearY[i], 20, 200, 0, 0, 100, fGearRad, 2, fCol[i]) |
318 --AddCaption('dropped flag itself') |
318 --AddCaption('dropped flag itself') |
319 end |
319 end |
320 end |
320 end |
321 end |
321 end |
408 gameStarted = true |
408 gameStarted = true |
409 AddCaption(loc("Game Started!")) |
409 AddCaption(loc("Game Started!")) |
410 |
410 |
411 for i = 0, 1 do |
411 for i = 0, 1 do |
412 |
412 |
413 -- if someone uses kamikaze downwards, this can happen as the hog won't respawn |
413 -- if someone uses kamikaze downwards, this can happen as the hog won't respawn |
414 if (LAND_HEIGHT - fSpawnY[i]) < 0 then |
414 if (LAND_HEIGHT - fSpawnY[i]) < 0 then |
415 tempG = AddGear(0, 0, gtTarget, 0, 0, 0, 0) |
415 tempG = AddGear(0, 0, gtTarget, 0, 0, 0, 0) |
416 FindPlace(tempG, true, 0, LAND_WIDTH, true) |
416 FindPlace(tempG, true, 0, LAND_WIDTH, true) |
417 fSpawnX[i], fSpawnY[i] = GetGearPosition(tempG) |
417 fSpawnX[i], fSpawnY[i] = GetGearPosition(tempG) |
418 DeleteGear(tempG) |
418 DeleteGear(tempG) |
419 end |
419 end |
420 |
420 |
421 fGear[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
421 fGear[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
422 fCirc[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
422 fCirc[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
423 fSpawnC[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
423 fSpawnC[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
424 |
424 |
427 |
427 |
428 fCol[i] = GetClanColor(i) |
428 fCol[i] = GetClanColor(i) |
429 fIsMissing[i] = false |
429 fIsMissing[i] = false |
430 fNeedsRespawn[i] = false |
430 fNeedsRespawn[i] = false |
431 fCaptures[i] = 0 |
431 fCaptures[i] = 0 |
432 |
432 |
433 --SetVisualGearValues(zxc, 1000,1000, 20, 100, 0, 10, 1, 100, 5, GetClanColor(0)) |
433 --SetVisualGearValues(zxc, 1000,1000, 20, 100, 0, 10, 1, 100, 5, GetClanColor(0)) |
434 |
434 |
435 SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 20, 100, 0, 10, 0, 75, 5, fCol[i]) |
435 SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 20, 100, 0, 10, 0, 75, 5, fCol[i]) |
436 |
436 |
437 end |
437 end |
438 |
438 |
439 end |
439 end |
440 |
440 |
441 ------------------------ |
441 ------------------------ |
444 |
444 |
445 function onGameInit() |
445 function onGameInit() |
446 |
446 |
447 GameFlags = band(bor(GameFlags, gfDivideTeams), bnot(gfKing + gfForts)) |
447 GameFlags = band(bor(GameFlags, gfDivideTeams), bnot(gfKing + gfForts)) |
448 --SuddenDeathTurns = 999 -- suddendeath is off, effectively |
448 --SuddenDeathTurns = 999 -- suddendeath is off, effectively |
449 WaterRise = 0 |
449 WaterRise = 0 |
450 Delay = 10 |
450 Delay = 10 |
451 |
451 |
452 end |
452 end |
453 |
453 |
454 |
454 |
455 function onGameStart() |
455 function onGameStart() |
456 |
456 |
457 --ShowMission(loc(caption), loc(subcaption), loc(goal), 0, 0) |
457 --ShowMission(loc(caption), loc(subcaption), loc(goal), 0, 0) |
458 ShowMission(loc("CAPTURE THE FLAG"), loc("Flags, and their home base will be placed where each team ends their first turn."), "", 0, 0) |
458 ShowMission(loc("CAPTURE THE FLAG"), loc("Flags, and their home base will be placed where each team ends their first turn."), "", 0, 0) |
459 |
459 |
460 RebuildTeamInfo() |
460 RebuildTeamInfo() |
461 |
461 |
462 -- should gfDivideTeams do this automatically? |
462 -- should gfDivideTeams do this automatically? |
463 --[[for i = 0, (TeamsCount-1) do |
463 --[[for i = 0, (TeamsCount-1) do |
464 for g = teamIndex[i], (teamIndex[i]+teamSize[i]-1) do |
464 for g = teamIndex[i], (teamIndex[i]+teamSize[i]-1) do |
465 if GetHogClan(hhs[g]) == 0 then |
465 if GetHogClan(hhs[g]) == 0 then |
466 FindPlace(hhs[g], false, 0, LAND_WIDTH/2) |
466 FindPlace(hhs[g], false, 0, LAND_WIDTH/2) |
467 elseif GetHogClan(hhs[g]) == 1 then |
467 elseif GetHogClan(hhs[g]) == 1 then |
473 fPlaced[0] = false |
473 fPlaced[0] = false |
474 fPlaced[1] = false |
474 fPlaced[1] = false |
475 |
475 |
476 --zxc = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
476 --zxc = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true) |
477 |
477 |
478 |
478 |
479 --SetVisualGearValues(zxc, 1000,1000, 20, 255, 1, 10, 0, 200, 1, GetClanColor(0)) |
479 --SetVisualGearValues(zxc, 1000,1000, 20, 255, 1, 10, 0, 200, 1, GetClanColor(0)) |
480 --minO,max0 -glowyornot --pulsate timer -- fuckall -- radius -- width -- colour |
480 --minO,max0 -glowyornot --pulsate timer -- fuckall -- radius -- width -- colour |
481 end |
481 end |
482 |
482 |
483 |
483 |
484 function onNewTurn() |
484 function onNewTurn() |
485 |
485 |
486 gameTurns = gameTurns + 1 |
486 gameTurns = gameTurns + 1 |
487 |
487 |
488 if lastTeam ~= GetHogTeamName(CurrentHedgehog) then |
488 if lastTeam ~= GetHogTeamName(CurrentHedgehog) then |
489 lastTeam = GetHogTeamName(CurrentHedgehog) |
489 lastTeam = GetHogTeamName(CurrentHedgehog) |
490 end |
490 end |
491 |
491 |
492 --AddCaption("Handling respawns") |
492 --AddCaption("Handling respawns") |
493 if gameStarted == true then |
493 if gameStarted == true then |
494 HandleRespawns() |
494 HandleRespawns() |
495 --new method of placing starting flags |
495 --new method of placing starting flags |
496 elseif gameTurns == 1 then |
496 elseif gameTurns == 1 then |
497 ShowMission(loc("CAPTURE THE FLAG"), loc("Flags, and their home base will be placed where each team ends their first turn."), "", 0, 0) |
497 ShowMission(loc("CAPTURE THE FLAG"), loc("Flags, and their home base will be placed where each team ends their first turn."), "", 0, 0) |
498 elseif gameTurns == 2 then |
498 elseif gameTurns == 2 then |
499 fPlaced[0] = true |
499 fPlaced[0] = true |
500 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) |
500 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) |
501 elseif gameTurns == 3 then |
501 elseif gameTurns == 3 then |
502 fPlaced[1] = true |
502 fPlaced[1] = true |
503 StartTheGame() |
503 StartTheGame() |
504 end |
504 end |
505 |
505 |
506 end |
506 end |
507 |
507 |