113 -------------------------- |
113 -------------------------- |
114 |
114 |
115 local numhhs = 0 -- store number of hedgehogs |
115 local numhhs = 0 -- store number of hedgehogs |
116 local hhs = {} -- store hedgehog gears |
116 local hhs = {} -- store hedgehog gears |
117 |
117 |
118 local numTeams -- store the number of teams in the game |
|
119 local teamNameArr = {} -- store the list of teams |
118 local teamNameArr = {} -- store the list of teams |
120 local teamSize = {} -- store how many hogs per team |
119 local teamSize = {} -- store how many hogs per team |
121 local teamIndex = {} -- at what point in the hhs{} does each team begin |
120 local teamIndex = {} -- at what point in the hhs{} does each team begin |
122 local clanTeams = {} -- list of teams per clan |
121 local clanTeams = {} -- list of teams per clan |
123 |
122 |
174 ------------------------ |
170 ------------------------ |
175 -- see on gameTick also |
171 -- see on gameTick also |
176 |
172 |
177 function ManageTeleporterEffects() |
173 function ManageTeleporterEffects() |
178 effectTimer = effectTimer + 1 |
174 effectTimer = effectTimer + 1 |
179 if effectTimer > 50 then -- 100 |
175 if effectTimer > 50 then |
180 effectTimer = 0 |
176 effectTimer = 0 |
181 |
177 |
182 for i = 0,1 do |
178 for i = 0,1 do |
183 eX = 10 + zXMin[i] + GetRandom(zWidth[i]-10) |
179 local eX = 10 + zXMin[i] + GetRandom(zWidth[i]-10) |
184 eY = 50 + zYMin[i] + GetRandom(zHeight[i]-110) |
180 local eY = 50 + zYMin[i] + GetRandom(zHeight[i]-110) |
185 |
181 |
186 -- steam and smoke and DUST look good, smokering looks trippy |
182 -- steam and smoke and DUST look good, smokering looks trippy |
187 -- smoketrace and eviltrace are not effected by wind? |
183 -- smoketrace and eviltrace are not effected by wind? |
188 -- chunk is a LR falling gear |
184 -- chunk is a LR falling gear |
189 tempE = AddVisualGear(eX, eY, vgtDust, 0, false) |
185 local tempE = AddVisualGear(eX, eY, vgtDust, 0, false) |
190 if tempE ~= 0 then |
186 if tempE ~= 0 then |
191 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) |
187 SetVisualGearValues(tempE, eX, eY, nil, nil, nil, nil, nil, nil, nil, fCol[i]) |
192 SetVisualGearValues(tempE, eX, eY, g3, g4, g5, g6, g7, g8, g9, fCol[i]) |
|
193 end |
188 end |
194 end |
189 end |
195 end |
190 end |
196 end |
191 end |
197 |
192 |
262 |
258 |
263 end |
259 end |
264 |
260 |
265 function FlagDeleted(gear) |
261 function FlagDeleted(gear) |
266 |
262 |
|
263 local wtf, bbq |
267 PlaySound(sndShotgunReload) |
264 PlaySound(sndShotgunReload) |
268 if (gear == fGear[0]) then |
265 if (gear == fGear[0]) then |
269 wtf = 0 |
266 wtf = 0 |
270 bbq = 1 |
267 bbq = 1 |
271 elseif (gear == fGear[1]) then |
268 elseif (gear == fGear[1]) then |
272 wtf = 1 |
269 wtf = 1 |
273 bbq = 0 |
270 bbq = 0 |
274 end |
271 end |
275 |
272 |
276 --ShowMission("OH HAI!", "FlagDeleted was called", "Oh noes!", -amBazooka, 0) |
|
277 |
|
278 if CurrentHedgehog ~= nil then |
273 if CurrentHedgehog ~= nil then |
279 |
274 |
280 --ShowMission("GUESS WAT?", "I'm not nil", "Oh noes!", -amBazooka, 0) |
|
281 --if the player picks up the flag |
275 --if the player picks up the flag |
282 if CheckDistance(CurrentHedgehog, fGear[wtf]) < 1600 then |
276 if CheckDistance(CurrentHedgehog, fGear[wtf]) < 1600 then |
283 |
277 |
284 fGear[wtf] = nil -- the flag has now disappeared and we shouldnt be pointing to it |
278 fGear[wtf] = nil -- the flag has now disappeared and we shouldnt be pointing to it |
285 |
279 |
287 if (GetHogClan(CurrentHedgehog) == wtf) and (CurrentHedgehog == fThief[bbq]) and (fIsMissing[wtf] == false) then |
281 if (GetHogClan(CurrentHedgehog) == wtf) and (CurrentHedgehog == fThief[bbq]) and (fIsMissing[wtf] == false) then |
288 fIsMissing[wtf] = false |
282 fIsMissing[wtf] = false |
289 fNeedsRespawn[wtf] = true |
283 fNeedsRespawn[wtf] = true |
290 fIsMissing[bbq] = false |
284 fIsMissing[bbq] = false |
291 fNeedsRespawn[bbq] = true |
285 fNeedsRespawn[bbq] = true |
292 fCaptures[wtf] = fCaptures[wtf] +1 --fCaptures[wtf] |
286 fCaptures[wtf] = fCaptures[wtf] +1 |
293 |
287 |
294 AddCaption(string.format(loc("%s has scored!"), GetHogTeamName(CurrentHedgehog)), 0xFFFFFFFF, capgrpGameState) |
288 AddCaption(string.format(loc("%s has scored!"), GetHogTeamName(CurrentHedgehog)), 0xFFFFFFFF, capgrpGameState) |
295 for i=1, #clanTeams[wtf] do |
289 for i=1, #clanTeams[wtf] do |
296 SetTeamLabel(clanTeams[wtf][i], fCaptures[wtf]) |
290 SetTeamLabel(clanTeams[wtf][i], fCaptures[wtf]) |
297 end |
291 end |
298 |
292 |
299 PlaySound(sndHomerun) |
293 PlaySound(sndHomerun) |
300 --SetEffect(fThief[bbq], hePoisoned, false) |
|
301 fThief[bbq] = nil -- player no longer has the enemy flag |
294 fThief[bbq] = nil -- player no longer has the enemy flag |
302 CheckScore(wtf) |
295 CheckScore(wtf) |
303 |
296 |
304 --if the player is returning the flag |
297 --if the player is returning the flag |
305 elseif GetHogClan(CurrentHedgehog) == wtf then |
298 elseif GetHogClan(CurrentHedgehog) == wtf then |
312 AddCaption(loc("Flag returned!")) |
305 AddCaption(loc("Flag returned!")) |
313 elseif fIsMissing[wtf] == false then |
306 elseif fIsMissing[wtf] == false then |
314 AddCaption(loc("That was pointless. The flag will respawn next round.")) |
307 AddCaption(loc("That was pointless. The flag will respawn next round.")) |
315 end |
308 end |
316 |
309 |
317 --fIsMissing[wtf] = false |
|
318 --ShowMission("Flag returned!", "Hooray", "", -amBazooka, 0) |
|
319 |
|
320 --if the player is taking the enemy flag |
310 --if the player is taking the enemy flag |
321 elseif GetHogClan(CurrentHedgehog) == bbq then |
311 elseif GetHogClan(CurrentHedgehog) == bbq then |
322 fIsMissing[wtf] = true |
312 fIsMissing[wtf] = true |
323 for i = 0,numhhs-1 do |
313 for i = 0,numhhs-1 do |
324 if CurrentHedgehog == hhs[i] then |
314 if CurrentHedgehog == hhs[i] then |
325 fThief[wtf] = hhs[i] |
315 fThief[wtf] = hhs[i] |
326 --SetEffect(fThief[wtf], hePoisoned, true) |
|
327 end |
316 end |
328 end |
317 end |
329 |
318 |
330 AddCaption(loc("Flag captured!")) |
319 AddCaption(loc("Flag captured!")) |
331 |
320 |
353 |
342 |
354 -- if flag has been destroyed deep underwater and player is now nil |
343 -- if flag has been destroyed deep underwater and player is now nil |
355 -- probably only gets called if the flag thief drowns himself |
344 -- probably only gets called if the flag thief drowns himself |
356 -- otherwise the above one will work fine |
345 -- otherwise the above one will work fine |
357 else |
346 else |
358 --ShowMission("NIL PLAYER!", "Oh snap", "Oh noes!", -amBazooka, 0) |
|
359 fGear[wtf] = nil |
347 fGear[wtf] = nil |
360 fIsMissing[wtf] = true |
348 fIsMissing[wtf] = true |
361 fNeedsRespawn[wtf] = true |
349 fNeedsRespawn[wtf] = true |
362 AddCaption(loc("The flag will respawn next round.")) |
350 AddCaption(loc("The flag will respawn next round.")) |
363 end |
351 end |
364 |
352 |
365 end |
353 end |
366 |
354 |
367 function FlagThiefDead(gear) |
355 function FlagThiefDead(gear) |
368 |
356 |
|
357 local wtf, bbq |
369 if (gear == fThief[0]) then |
358 if (gear == fThief[0]) then |
370 wtf = 0 |
359 wtf = 0 |
371 bbq = 1 |
360 bbq = 1 |
372 elseif (gear == fThief[1]) then |
361 elseif (gear == fThief[1]) then |
373 wtf = 1 |
362 wtf = 1 |
390 |
379 |
391 function HandleCircles() |
380 function HandleCircles() |
392 |
381 |
393 for i = 0, 1 do |
382 for i = 0, 1 do |
394 if fIsMissing[i] == false then -- draw a circle at the flag's spawning place |
383 if fIsMissing[i] == false then -- draw a circle at the flag's spawning place |
395 --SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
|
396 SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
384 SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
397 elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then |
385 elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then |
398 if fThief[i] ~= nil then -- draw circle round flag carrier |
386 if fThief[i] ~= nil then -- draw circle round flag carrier |
399 --SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
|
400 SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
387 SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i]) |
401 elseif fThief[i] == nil then -- draw cirle round dropped flag |
388 elseif fThief[i] == nil then -- draw cirle round dropped flag |
402 --SetVisualGearValues(fCirc[i], GetX(fGear[i]), GetY(fGear[i]), 20, 200, 0, 0, 100, 33, 2, fCol[i]) |
|
403 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]) |
389 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]) |
404 end |
390 end |
405 end |
391 end |
406 |
392 |
407 if fNeedsRespawn[i] == true then -- if the flag has been destroyed, no need for a circle |
393 if fNeedsRespawn[i] == true then -- if the flag has been destroyed, no need for a circle |
415 -- general methods |
401 -- general methods |
416 ------------------------ |
402 ------------------------ |
417 |
403 |
418 function CheckDistance(gear1, gear2) |
404 function CheckDistance(gear1, gear2) |
419 |
405 |
420 g1X, g1Y = GetGearPosition(gear1) |
406 local g1X, g1Y = GetGearPosition(gear1) |
421 g2X, g2Y = GetGearPosition(gear2) |
407 local g2X, g2Y = GetGearPosition(gear2) |
422 |
408 |
423 g1X = g1X - g2X |
409 g1X = g1X - g2X |
424 g1Y = g1Y - g2Y |
410 g1Y = g1Y - g2Y |
425 z = (g1X*g1X) + (g1Y*g1Y) |
411 local dist = (g1X*g1X) + (g1Y*g1Y) |
426 |
|
427 --dist = math.sqrt(z) |
|
428 |
|
429 dist = z |
|
430 |
412 |
431 return dist |
413 return dist |
432 |
414 |
433 end |
415 end |
434 |
416 |
435 function CheckTeleporters() |
417 function CheckTeleporters() |
436 |
418 |
437 teleportActive = false |
419 local teleportActive = false |
438 |
420 |
439 if (GearIsInZone(CurrentHedgehog, redTel) == true) and (GetHogClan(CurrentHedgehog) == 0) then |
421 if (GearIsInZone(CurrentHedgehog, redTel) == true) and (GetHogClan(CurrentHedgehog) == 0) then |
440 teleportActive = true |
422 teleportActive = true |
441 destinationX = 1402 |
423 destinationX = 1402 |
442 destinationY = 321 |
424 destinationY = 321 |
481 teamNameArr[i] = GetTeamName(i) |
463 teamNameArr[i] = GetTeamName(i) |
482 teamSize[i] = 0 |
464 teamSize[i] = 0 |
483 teamIndex[i] = 0 |
465 teamIndex[i] = 0 |
484 SetTeamLabel(teamNameArr[i], "0") |
466 SetTeamLabel(teamNameArr[i], "0") |
485 end |
467 end |
486 numTeams = TeamsCount |
|
487 |
468 |
488 -- find out how many hogs per team, and the index of the first hog in hhs |
469 -- find out how many hogs per team, and the index of the first hog in hhs |
489 for i = 0, numTeams-1 do |
470 for i = 0, TeamsCount-1 do |
490 |
471 |
491 for z = 0, numhhs-1 do |
472 for z = 0, numhhs-1 do |
492 if GetHogTeamName(hhs[z]) == teamNameArr[i] then |
473 if GetHogTeamName(hhs[z]) == teamNameArr[i] then |
493 if teamSize[i] == 0 then |
474 if teamSize[i] == 0 then |
494 teamIndex[i] = z -- should give starting index |
475 teamIndex[i] = z -- should give starting index |
551 TurnTime = 30000 -- (was 30) The time the player has to move each round (in ms) |
532 TurnTime = 30000 -- (was 30) The time the player has to move each round (in ms) |
552 CaseFreq = 0 -- The frequency of crate drops |
533 CaseFreq = 0 -- The frequency of crate drops |
553 MinesNum = 0 -- The number of mines being placed |
534 MinesNum = 0 -- The number of mines being placed |
554 MinesTime = 2000 |
535 MinesTime = 2000 |
555 Explosives = 0 -- The number of explosives being placed |
536 Explosives = 0 -- The number of explosives being placed |
556 Delay = 10 -- The delay between each round |
|
557 -- Disable Sudden Death |
537 -- Disable Sudden Death |
558 WaterRise = 0 |
538 WaterRise = 0 |
559 HealthDecrease = 0 |
539 HealthDecrease = 0 |
560 Map = "Blizzard" -- The map to be played |
540 Map = "Blizzard" -- The map to be played |
561 Theme = "Snow" -- The theme to be used "Nature" |
541 Theme = "Snow" -- The theme to be used "Nature" |
573 orangeTel = CreateZone(3719,1330,45,449) -- orange teleporter |
553 orangeTel = CreateZone(3719,1330,45,449) -- orange teleporter |
574 |
554 |
575 |
555 |
576 --new improved placement schematics aw yeah |
556 --new improved placement schematics aw yeah |
577 RebuildTeamInfo() |
557 RebuildTeamInfo() |
578 --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) |
558 local team1Placed = 0 |
579 team1Placed = 0 |
559 local team2Placed = 0 |
580 team2Placed = 0 |
|
581 for i = 0, (TeamsCount-1) do |
560 for i = 0, (TeamsCount-1) do |
582 for g = teamIndex[i], (teamIndex[i]+teamSize[i]-1) do |
561 for g = teamIndex[i], (teamIndex[i]+teamSize[i]-1) do |
583 if GetHogClan(hhs[g]) == 0 then |
562 if GetHogClan(hhs[g]) == 0 then |
584 SetGearPosition(hhs[g],1403+ ((team1Placed+1)*50),1570) |
563 SetGearPosition(hhs[g],1403+ ((team1Placed+1)*50),1570) |
585 team1Placed = team1Placed +1 |
564 team1Placed = team1Placed +1 |
637 end |
615 end |
638 |
616 |
639 |
617 |
640 function onNewTurn() |
618 function onNewTurn() |
641 |
619 |
642 if lastTeam ~= GetHogTeamName(CurrentHedgehog) then |
|
643 lastTeam = GetHogTeamName(CurrentHedgehog) |
|
644 end |
|
645 |
|
646 for i = 0, 1 do |
|
647 if fThief[i] ~= nil then |
|
648 --adjust = 5 + GetHealth(fThief[i]) |
|
649 --SetHealth(fThief[i], adjust) |
|
650 --AddCaption('Helped out the flag poisoned flag thiefs') |
|
651 end |
|
652 end |
|
653 |
|
654 --AddCaption("Handling respawns") |
|
655 HandleRespawns() |
620 HandleRespawns() |
656 HandleCrateDrops() |
621 HandleCrateDrops() |
657 |
|
658 --myC = AddVisualGear(GetX(CurrentHedgehog),GetY(CurrentHedgehog),vgtCircle,0,true) |
|
659 --SetVisualGearValues(myC, GetX(CurrentHedgehog),GetY(CurrentHedgehog), 20, 200, 0, 0, 100, 50, 3, GetClanColor(GetHogClan(CurrentHedgehog))) |
|
660 |
622 |
661 end |
623 end |
662 |
624 |
663 function onGameTick() |
625 function onGameTick() |
664 |
626 |
665 -- onRessurect calls AFTER you have resurrected, |
627 -- onRessurect calls AFTER you have resurrected, |
666 -- so keeping track of x,y a few milliseconds before |
628 -- so keeping track of x,y a few milliseconds before |
667 -- is useful |
629 -- is useful |
668 --FTTC = FTTC + 1 |
630 |
669 --if FTTC == 100 then |
631 for i = 0,1 do |
670 -- FTTC = 0 |
632 if fThief[i] ~= nil then |
671 for i = 0,1 do |
633 fThiefX[i] = GetX(fThief[i]) |
672 if fThief[i] ~= nil then |
634 fThiefY[i] = GetY(fThief[i]) |
673 fThiefX[i] = GetX(fThief[i]) |
635 end |
674 fThiefY[i] = GetY(fThief[i]) |
636 end |
675 end |
|
676 end |
|
677 --end |
|
678 |
637 |
679 -- things we wanna check often |
638 -- things we wanna check often |
680 if (CurrentHedgehog ~= nil) then |
639 if (CurrentHedgehog ~= nil) then |
681 --AddCaption(GetX(CurrentHedgehog) .. "; " .. GetY(CurrentHedgehog)) |
|
682 --AddCaption("Checking Teleporters") |
|
683 CheckTeleporters() |
640 CheckTeleporters() |
684 end |
641 end |
685 |
642 |
686 HandleCircles() |
643 HandleCircles() |
687 ManageTeleporterEffects() |
644 ManageTeleporterEffects() |
695 SetAmmo(amMortar,9,0,0,0) |
652 SetAmmo(amMortar,9,0,0,0) |
696 |
653 |
697 SetAmmo(amGrenade,9,0,0,0) |
654 SetAmmo(amGrenade,9,0,0,0) |
698 SetAmmo(amClusterBomb,4,0,0,0) |
655 SetAmmo(amClusterBomb,4,0,0,0) |
699 |
656 |
700 --SetAmmo(amDEagle, 4, 0, 0, 0) |
|
701 SetAmmo(amShotgun, 9, 0, 0, 0) |
657 SetAmmo(amShotgun, 9, 0, 0, 0) |
702 SetAmmo(amFlamethrower, 1, 0, 0, 1) |
658 SetAmmo(amFlamethrower, 1, 0, 0, 1) |
703 |
659 |
704 SetAmmo(amFirePunch, 9, 0, 0, 0) |
660 SetAmmo(amFirePunch, 9, 0, 0, 0) |
705 SetAmmo(amBaseballBat, 2, 0, 0, 0) |
661 SetAmmo(amBaseballBat, 2, 0, 0, 0) |
706 --SetAmmo(amKamikaze, 2, 0, 0, 0) |
|
707 |
|
708 |
662 |
709 SetAmmo(amDynamite,2,0,0,1) |
663 SetAmmo(amDynamite,2,0,0,1) |
710 SetAmmo(amSMine,4,0,0,0) |
664 SetAmmo(amSMine,4,0,0,0) |
711 |
665 |
712 SetAmmo(amBlowTorch, 9, 0, 0, 0) |
666 SetAmmo(amBlowTorch, 9, 0, 0, 0) |
744 elseif GetHogClan(gear) == 1 then |
696 elseif GetHogClan(gear) == 1 then |
745 FindPlace(gear, false, 2048, LAND_WIDTH) |
697 FindPlace(gear, false, 2048, LAND_WIDTH) |
746 end |
698 end |
747 |
699 |
748 AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
700 AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
749 |
|
750 end |
|
751 |
|
752 function onGearDamage(gear, damage) |
|
753 |
|
754 -- >_< damn, occurs too fast, before the hog has finished moving / updated his health |
|
755 --if GetGearType(gear) == gtHedgehog then |
|
756 -- if damage > GetHealth(gear) then |
|
757 -- AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false) |
|
758 -- end |
|
759 --end |
|
760 |
701 |
761 end |
702 end |
762 |
703 |
763 function onGearAdd(gear) |
704 function onGearAdd(gear) |
764 |
705 |