143 local yellowHats = { "fr_apple", "fr_banana", "fr_lemon", "fr_orange" } |
143 local yellowHats = { "fr_apple", "fr_banana", "fr_lemon", "fr_orange" } |
144 for i=1,7 do |
144 for i=1,7 do |
145 yellowArmy[i].gear = AddHog(yellowArmy[i].name, 1, yellowArmy[i].health, yellowHats[math.random(1,4)]) |
145 yellowArmy[i].gear = AddHog(yellowArmy[i].name, 1, yellowArmy[i].health, yellowHats[math.random(1,4)]) |
146 AnimSetGearPosition(yellowArmy[i].gear, yellowArmy[i].x, yellowArmy[i].y) |
146 AnimSetGearPosition(yellowArmy[i].gear, yellowArmy[i].x, yellowArmy[i].y) |
147 end |
147 end |
148 |
148 |
149 initCheckpoint("fruit01") |
149 initCheckpoint("fruit01") |
150 |
150 |
151 AnimInit() |
151 AnimInit() |
152 AnimationSetup() |
152 AnimationSetup() |
153 end |
153 end |
154 |
154 |
155 function onGameStart() |
155 function onGameStart() |
156 AnimWait(hero.gear, 3000) |
156 AnimWait(hero.gear, 3000) |
157 FollowGear(hero.gear) |
157 FollowGear(hero.gear) |
158 |
158 |
159 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
159 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
160 AddEvent(onHeroSelect, {hero.gear}, heroSelect, {hero.gear}, 0) |
160 AddEvent(onHeroSelect, {hero.gear}, heroSelect, {hero.gear}, 0) |
161 |
161 |
162 -- Green team weapons |
162 -- Green team weapons |
163 local greenArmy = { green1, green2 } |
163 local greenArmy = { green1, green2 } |
164 for i=1,2 do |
164 for i=1,2 do |
165 AddAmmo(greenArmy[i].gear, amBlowTorch, 5) |
165 AddAmmo(greenArmy[i].gear, amBlowTorch, 5) |
166 AddAmmo(greenArmy[i].gear, amRope, 5) |
166 AddAmmo(greenArmy[i].gear, amRope, 5) |
167 AddAmmo(greenArmy[i].gear, amBazooka, 10) |
167 AddAmmo(greenArmy[i].gear, amBazooka, 10) |
168 AddAmmo(greenArmy[i].gear, amGrenade, 7) |
168 AddAmmo(greenArmy[i].gear, amGrenade, 7) |
169 AddAmmo(greenArmy[i].gear, amFirePunch, 2) |
169 AddAmmo(greenArmy[i].gear, amFirePunch, 2) |
170 AddAmmo(greenArmy[i].gear, amDrill, 3) |
170 AddAmmo(greenArmy[i].gear, amDrill, 3) |
171 AddAmmo(greenArmy[i].gear, amSwitch, 2) |
171 AddAmmo(greenArmy[i].gear, amSwitch, 2) |
172 AddAmmo(greenArmy[i].gear, amSkip, 100) |
172 AddAmmo(greenArmy[i].gear, amSkip, 100) |
173 end |
173 end |
174 -- Yellow team weapons |
174 -- Yellow team weapons |
175 AddAmmo(yellow1.gear, amBlowTorch, 1) |
175 AddAmmo(yellow1.gear, amBlowTorch, 1) |
176 AddAmmo(yellow1.gear, amRope, 1) |
176 AddAmmo(yellow1.gear, amRope, 1) |
177 AddAmmo(yellow1.gear, amBazooka, 10) |
177 AddAmmo(yellow1.gear, amBazooka, 10) |
178 AddAmmo(yellow1.gear, amGrenade, 10) |
178 AddAmmo(yellow1.gear, amGrenade, 10) |
179 AddAmmo(yellow1.gear, amFirePunch, 5) |
179 AddAmmo(yellow1.gear, amFirePunch, 5) |
180 AddAmmo(yellow1.gear, amDrill, 3) |
180 AddAmmo(yellow1.gear, amDrill, 3) |
181 AddAmmo(yellow1.gear, amBee, 1) |
181 AddAmmo(yellow1.gear, amBee, 1) |
182 AddAmmo(yellow1.gear, amMortar, 3) |
182 AddAmmo(yellow1.gear, amMortar, 3) |
183 AddAmmo(yellow1.gear, amDEagle, 4) |
183 AddAmmo(yellow1.gear, amDEagle, 4) |
184 AddAmmo(yellow1.gear, amDynamite, 1) |
184 AddAmmo(yellow1.gear, amDynamite, 1) |
185 AddAmmo(yellow1.gear, amSwitch, 100) |
185 AddAmmo(yellow1.gear, amSwitch, 100) |
186 for i=3,7 do |
186 for i=3,7 do |
187 HideHog(yellowArmy[i].gear) |
187 HideHog(yellowArmy[i].gear) |
188 end |
188 end |
189 HideHog(green1.bot) |
189 HideHog(green1.bot) |
190 |
190 |
191 -- crates |
191 -- crates |
192 SpawnHealthCrate(health1X, health1Y) |
192 SpawnHealthCrate(health1X, health1Y) |
193 SpawnAmmoCrate(crateWMX, crateWMY, amWatermelon) |
193 SpawnAmmoCrate(crateWMX, crateWMY, amWatermelon) |
194 |
194 |
195 AddAnim(dialog01) |
195 AddAnim(dialog01) |
196 SendHealthStatsOff() |
196 SendHealthStatsOff() |
197 end |
197 end |
198 |
198 |
199 function onNewTurn() |
199 function onNewTurn() |
330 |
330 |
331 function battleWin(gear) |
331 function battleWin(gear) |
332 -- add stats |
332 -- add stats |
333 saveVariables() |
333 saveVariables() |
334 SendStat(siGameResult, loc("Green Bananas won!")) |
334 SendStat(siGameResult, loc("Green Bananas won!")) |
335 SendStat(siCustomAchievement, loc("You have eliminated all the visible enemy hogs!")) |
335 SendStat(siCustomAchievement, loc("You have eliminated all visible enemy hedgehogs!")) |
336 SendStat(siPlayerKills,'1',teamA.name) |
336 SendStat(siPlayerKills,'1',teamA.name) |
337 SendStat(siPlayerKills,'1',teamB.name) |
337 SendStat(siPlayerKills,'1',teamB.name) |
338 SendStat(siPlayerKills,'0',teamC.name) |
338 SendStat(siPlayerKills,'0',teamC.name) |
339 EndGame() |
339 EndGame() |
340 end |
340 end |
341 |
341 |
342 function escapeWin(gear) |
342 function escapeWin(gear) |
343 -- add stats |
343 -- add stats |
344 saveVariables() |
344 saveVariables() |
345 SendStat(siGameResult, loc("Hog Solo escaped successfully!")) |
345 SendStat(siGameResult, loc("Hog Solo escaped successfully!")) |
346 SendStat(siCustomAchievement, loc("You have reached the flying area successfully!")) |
346 SendStat(siCustomAchievement, loc("You have reached the take-off area successfully!")) |
347 SendStat(siPlayerKills,'1',teamA.name) |
347 SendStat(siPlayerKills,'1',teamA.name) |
348 SendStat(siPlayerKills,'0',teamB.name) |
348 SendStat(siPlayerKills,'0',teamB.name) |
349 SendStat(siPlayerKills,'0',teamC.name) |
349 SendStat(siPlayerKills,'0',teamC.name) |
350 EndGame() |
350 EndGame() |
351 end |
351 end |
352 |
352 |
353 function heroSelect(gear) |
353 function heroSelect(gear) |
354 TurnTimeLeft = 0 |
354 TurnTimeLeft = 0 |
355 FollowGear(hero.gear) |
355 FollowGear(hero.gear) |
356 if GetX(hero.gear) < hero.x then |
356 if GetX(hero.gear) < hero.x then |
357 chooseToBattle = true |
357 chooseToBattle = true |
358 AddEvent(onGreen1Death, {green1.gear}, green1Death, {green1.gear}, 0) |
358 AddEvent(onGreen1Death, {green1.gear}, green1Death, {green1.gear}, 0) |
359 AddEvent(onBattleWin, {hero.gear}, battleWin, {hero.gear}, 0) |
359 AddEvent(onBattleWin, {hero.gear}, battleWin, {hero.gear}, 0) |
360 AddAnim(dialog02) |
360 AddAnim(dialog02) |
361 elseif GetX(hero.gear) > hero.x then |
361 elseif GetX(hero.gear) > hero.x then |
362 HogTurnLeft(hero.gear, true) |
362 HogTurnLeft(hero.gear, true) |
385 |
385 |
386 function AnimationSetup() |
386 function AnimationSetup() |
387 -- DIALOG 01 - Start, Captain Lime talks explains to Hog Solo |
387 -- DIALOG 01 - Start, Captain Lime talks explains to Hog Solo |
388 AddSkipFunction(dialog01, Skipanim, {dialog01}) |
388 AddSkipFunction(dialog01, Skipanim, {dialog01}) |
389 table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}}) |
389 table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}}) |
390 table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere in the Planet of Fruits a terrible war is about to begin..."), 5000}}) |
390 table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere on the Planet of Fruits a terrible war is about to begin..."), 5000}}) |
391 table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("I was told that as the leader of the king's guard, no one knows this world better than you!"), SAY_SAY, 5000}}) |
391 table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("I was told that as the leader of the king's guard, no one knows this world better than you!"), SAY_SAY, 5000}}) |
392 table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("So, I kindly ask for your help"), SAY_SAY, 3000}}) |
392 table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("So, I kindly ask for your help"), SAY_SAY, 3000}}) |
393 table.insert(dialog01, {func = AnimWait, args = {green1.gear, 2000}}) |
393 table.insert(dialog01, {func = AnimWait, args = {green1.gear, 2000}}) |
394 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("You couldn't have come to a worse time Hog Solo!"), SAY_SAY, 3000}}) |
394 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("You couldn't have come to a worse time Hog Solo!"), SAY_SAY, 3000}}) |
395 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("The clan of the Red Strawberry wants to take over the dominion and overthrone king Pineapple."), SAY_SAY, 5000}}) |
395 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("The clan of the Red Strawberry wants to take over the dominion and overthrone king Pineapple."), SAY_SAY, 5000}}) |
398 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("I would gladly help you if we won this battle but under these circumstances I'll only help you if you fight for our side."), SAY_SAY, 6000}}) |
398 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("I would gladly help you if we won this battle but under these circumstances I'll only help you if you fight for our side."), SAY_SAY, 6000}}) |
399 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("What do you say? Will you fight for us?"), SAY_SAY, 3000}}) |
399 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("What do you say? Will you fight for us?"), SAY_SAY, 3000}}) |
400 table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}}) |
400 table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}}) |
401 table.insert(dialog01, {func = ShowMission, args = {missionName, loc("Ready for Battle?"), loc("Walk left if you want to join Captain Lime or right if you want to decline his offer"), 1, 7000}}) |
401 table.insert(dialog01, {func = ShowMission, args = {missionName, loc("Ready for Battle?"), loc("Walk left if you want to join Captain Lime or right if you want to decline his offer"), 1, 7000}}) |
402 table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}}) |
402 table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}}) |
403 -- DIALOG 02 - Hero selects to fight |
403 -- DIALOG 02 - Hero selects to fight |
404 AddSkipFunction(dialog02, Skipanim, {dialog02}) |
404 AddSkipFunction(dialog02, Skipanim, {dialog02}) |
405 table.insert(dialog02, {func = AnimWait, args = {green1.gear, 3000}}) |
405 table.insert(dialog02, {func = AnimWait, args = {green1.gear, 3000}}) |
406 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You choose well Hog Solo!"), SAY_SAY, 3000}}) |
406 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You choose well Hog Solo!"), SAY_SAY, 3000}}) |
407 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I have only 3 hogs available and they are all cadets"), SAY_SAY, 4000}}) |
407 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I have only 3 hogs available and they are all cadets"), SAY_SAY, 4000}}) |
408 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("As more experienced I want you to lead them to the battle"), SAY_SAY, 4000}}) |
408 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("As you are more experienced, I want you to lead them to the battle"), SAY_SAY, 4000}}) |
409 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I of cource will observe the battle and intervene if necessary"), SAY_SAY, 5000}}) |
409 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I of course will observe the battle and intervene if necessary"), SAY_SAY, 5000}}) |
410 table.insert(dialog02, {func = AnimWait, args = {hero.gear, 4500}}) |
410 table.insert(dialog02, {func = AnimWait, args = {hero.gear, 4500}}) |
411 table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("No problem Captain! "), SAY_SAY, 2000}}) |
411 table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("No problem Captain!"), SAY_SAY, 2000}}) |
412 table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("The enemies aren't many anyway, it is going to be easy!"), SAY_SAY, 1}}) |
412 table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("The enemies aren't many anyway, it is going to be easy!"), SAY_SAY, 1}}) |
413 table.insert(dialog02, {func = AnimWait, args = {green1.gear, 9000}}) |
413 table.insert(dialog02, {func = AnimWait, args = {green1.gear, 9000}}) |
414 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Don't be fool son, they'll be more"), SAY_SAY, 2000}}) |
414 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Don't be foolish son, there will be more"), SAY_SAY, 2000}}) |
415 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Try to be smart and eliminate them quickly. This way you might scare the rest!"), SAY_SAY, 5000}}) |
415 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Try to be smart and eliminate them quickly. This way you might scare off the rest!"), SAY_SAY, 5000}}) |
416 table.insert(dialog02, {func = AnimWait, args = {hero.gear, 5000}}) |
416 table.insert(dialog02, {func = AnimWait, args = {hero.gear, 5000}}) |
417 table.insert(dialog02, {func = startBattle, args = {hero.gear}}) |
417 table.insert(dialog02, {func = startBattle, args = {hero.gear}}) |
418 -- DIALOG 03 - Hero selects to flee |
418 -- DIALOG 03 - Hero selects to flee |
419 AddSkipFunction(dialog03, Skipanim, {dialog03}) |
419 AddSkipFunction(dialog03, Skipanim, {dialog03}) |
420 table.insert(dialog03, {func = AnimWait, args = {green1.gear, 3000}}) |
420 table.insert(dialog03, {func = AnimWait, args = {green1.gear, 3000}}) |
421 table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Too bad... Then you should really leave!"), SAY_SAY, 3000}}) |
421 table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Too bad... Then you should really leave!"), SAY_SAY, 3000}}) |
422 table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Things are going to get messy around here"), SAY_SAY, 3000}}) |
422 table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Things are going to get messy around here"), SAY_SAY, 3000}}) |
423 table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Also, you should know that the only place that you can fly would be the most left part of the map"), SAY_SAY, 5000}}) |
423 table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Also, you should know that the only place where you can fly is the left-most part of this area"), SAY_SAY, 5000}}) |
424 table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("All the other places are protected by our anti flying weapons"), SAY_SAY, 4000}}) |
424 table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("All the other places are protected by our flight-inhibiting weapons"), SAY_SAY, 4000}}) |
425 table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Now go and don't waste more of my time you coward..."), SAY_SAY, 4000}}) |
425 table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("Now go and don't waste more of my time you coward..."), SAY_SAY, 4000}}) |
426 table.insert(dialog03, {func = AnimWait, args = {hero.gear, 5000}}) |
426 table.insert(dialog03, {func = AnimWait, args = {hero.gear, 5000}}) |
427 table.insert(dialog03, {func = startBattle, args = {hero.gear}}) |
427 table.insert(dialog03, {func = startBattle, args = {hero.gear}}) |
428 end |
428 end |
429 |
429 |
444 TurnTimeLeft = 0 |
444 TurnTimeLeft = 0 |
445 end |
445 end |
446 |
446 |
447 function gameLost() |
447 function gameLost() |
448 if chooseToBattle then |
448 if chooseToBattle then |
449 SendStat(siGameResult, loc("Green Bananas lost, try again!")) |
449 SendStat(siGameResult, loc("The Green Bananas lost, try again!")) |
450 SendStat(siCustomAchievement, loc("You have to eliminate all the visible enemies")) |
450 SendStat(siCustomAchievement, loc("You have to eliminate all the visible enemies")) |
451 SendStat(siCustomAchievement, loc("5 additional enemies will be spawned during the game")) |
451 SendStat(siCustomAchievement, loc("5 additional enemies will be spawned during the game")) |
452 SendStat(siCustomAchievement, loc("You are controlling all the active ally units")) |
452 SendStat(siCustomAchievement, loc("You are in control of all the active ally units")) |
453 SendStat(siCustomAchievement, loc("The ally units share their ammo")) |
453 SendStat(siCustomAchievement, loc("The ally units share their ammo")) |
454 SendStat(siCustomAchievement, loc("Try to keep as many allies alive as possible")) |
454 SendStat(siCustomAchievement, loc("Try to keep as many allies alive as possible")) |
455 else |
455 else |
456 SendStat(siGameResult, loc("Hog Solo couldn't escape, try again!")) |
456 SendStat(siGameResult, loc("Hog Solo couldn't escape, try again!")) |
457 SendStat(siCustomAchievement, loc("You have to get to the most left land and remove any enemy hog from there")) |
457 SendStat(siCustomAchievement, loc("You have to get to the left-most land and remove any enemy hog from there")) |
458 SendStat(siCustomAchievement, loc("You will play every 3 turns")) |
458 SendStat(siCustomAchievement, loc("You will play every 3 turns")) |
459 SendStat(siCustomAchievement, loc("Green hogs won't intenionally hurt you")) |
459 SendStat(siCustomAchievement, loc("Green hogs won't intenionally hurt you")) |
460 end |
460 end |
461 SendStat(siPlayerKills,'1',teamC.name) |
461 SendStat(siPlayerKills,'1',teamC.name) |
462 SendStat(siPlayerKills,'0',teamA.name) |
462 SendStat(siPlayerKills,'0',teamA.name) |
463 SendStat(siPlayerKills,'0',teamB.name) |
463 SendStat(siPlayerKills,'0',teamB.name) |
464 EndGame() |
464 EndGame() |
465 end |
465 end |
466 |
466 |
467 function getNextWave() |
467 function getNextWave() |
468 if TotalRounds == 4 then |
468 if TotalRounds == 4 then |
469 RestoreHog(yellowArmy[3].gear) |
469 RestoreHog(yellowArmy[3].gear) |
470 AnimCaption(hero.gear, loc("Next wave in 3 turns"), 5000) |
470 AnimCaption(hero.gear, loc("Next wave in 3 turns"), 5000) |
471 if not chooseToBattle and not GetHealth(yellow1.gear) then |
471 if not chooseToBattle and not GetHealth(yellow1.gear) then |
472 SetGearPosition(yellowArmy[3].gear, yellow1.x, yellow1.y) |
472 SetGearPosition(yellowArmy[3].gear, yellow1.x, yellow1.y) |
473 end |
473 end |
474 elseif TotalRounds == 7 then |
474 elseif TotalRounds == 7 then |
475 RestoreHog(yellowArmy[4].gear) |
475 RestoreHog(yellowArmy[4].gear) |