355 EndGame() |
362 EndGame() |
356 ended = true |
363 ended = true |
357 end |
364 end |
358 end |
365 end |
359 |
366 |
|
367 -- Device crate got taken |
360 function deviceCrateEvent(gear) |
368 function deviceCrateEvent(gear) |
361 SetGearMessage(hero.gear, 0) |
369 -- Stop hedgehog |
362 if not tookPartInBattle then |
370 SetGearMessage(deviceCrate.collector, 0) |
363 -- Captain Lime turns evil |
371 if deviceCrate.collector == hero.gear then |
364 AddAnim(dialog03) |
372 -- Hog Solo collected the device crate |
365 else |
373 |
366 -- Fruit Assassins attack |
374 if not tookPartInBattle then |
367 for i=1,table.getn(redHedgehogs) do |
375 -- Captain Lime turns evil |
368 RestoreHog(redHedgehogs[i].gear) |
376 AddAnim(dialog03) |
369 end |
377 else |
370 AddAnim(dialog04) |
378 -- Fruit Assassins attack |
371 end |
379 for i=1,table.getn(redHedgehogs) do |
372 -- needs to be set to true for both plots |
380 RestoreHog(redHedgehogs[i].gear) |
373 permitCaptainLimeDeath = true |
381 end |
374 AddAmmo(hero.gear, amSwitch, 0) |
382 AddAnim(dialog04) |
375 AddEvent(onSurface, {hero.gear}, surface, {hero.gear}, 0) |
383 end |
|
384 -- needs to be set to true for both plots |
|
385 permitCaptainLimeDeath = true |
|
386 AddAmmo(hero.gear, amSwitch, 0) |
|
387 AddEvent(onSurface, {hero.gear}, surface, {hero.gear}, 0) |
|
388 else |
|
389 -- Player let the Green Bananas collect the crate. |
|
390 -- How dumb! |
|
391 -- Player will lose for this. |
|
392 AnimationSetup05(deviceCrate.collector) |
|
393 AddAnim(dialog05) |
|
394 end |
376 end |
395 end |
377 |
396 |
378 function surface(gear) |
397 function surface(gear) |
379 previousHog = -1 |
398 previousHog = -1 |
380 if tookPartInBattle then |
399 if tookPartInBattle then |
381 if GetHealth(green1.gear) then |
400 escapeHog(green1.gear) |
382 HideHog(green1.gear) |
|
383 end |
|
384 AddEvent(onRedTeamDeath, {green1.gear}, redTeamDeath, {green1.gear}, 0) |
401 AddEvent(onRedTeamDeath, {green1.gear}, redTeamDeath, {green1.gear}, 0) |
385 else |
402 else |
386 SetHogLevel(green1.gear, 1) |
403 SetHogLevel(green1.gear, 1) |
387 -- Equip Captain Lime with weapons |
404 -- Equip Captain Lime with weapons |
388 AddAmmo(green1.gear, amBazooka, 6) |
405 AddAmmo(green1.gear, amBazooka, 6) |
389 AddAmmo(green1.gear, amGrenade, 6) |
406 AddAmmo(green1.gear, amGrenade, 6) |
390 AddAmmo(green1.gear, amDEagle, 2) |
407 AddAmmo(green1.gear, amDEagle, 2) |
391 AddEvent(onGaptainLimeDeath, {green1.gear}, captainLimeDeath, {green1.gear}, 0) |
408 AddEvent(onGaptainLimeDeath, {green1.gear}, captainLimeDeath, {green1.gear}, 0) |
392 end |
409 end |
393 EndTurn(true) |
410 EndTurn(true) |
394 if GetHealth(green2.gear) then |
411 escapeHog(green2.gear) |
395 HideHog(green2.gear) |
412 escapeHog(green3.gear) |
396 end |
|
397 if GetHealth(green3.gear) then |
|
398 HideHog(green3.gear) |
|
399 end |
|
400 inBattle = true |
413 inBattle = true |
401 end |
414 end |
402 |
415 |
403 function captainLimeDeath(gear) |
416 function captainLimeDeath(gear) |
404 -- hero win in scenario of escape in 1st part |
417 -- hero win in scenario of escape in 1st part |
461 table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("Okay then!"), SAY_SAY, 2000}}) |
476 table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("Okay then!"), SAY_SAY, 2000}}) |
462 table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}}) |
477 table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}}) |
463 table.insert(dialog02, {func = ShowMission, args = goals[dialog02]}) |
478 table.insert(dialog02, {func = ShowMission, args = goals[dialog02]}) |
464 -- DIALOG03 - At crates, hero learns that Captain Lime is bad |
479 -- DIALOG03 - At crates, hero learns that Captain Lime is bad |
465 AddSkipFunction(dialog03, Skipanim, {dialog03}) |
480 AddSkipFunction(dialog03, Skipanim, {dialog03}) |
466 table.insert(dialog03, {func = AnimWait, args = {hero.gear, 1250}}) |
481 table.insert(dialog03, {func = AnimWait, args = {hero.gear, 2000}}) |
467 table.insert(dialog03, {func = FollowGear, args = {hero.gear}}) |
482 table.insert(dialog03, {func = FollowGear, args = {hero.gear}}) |
468 table.insert(dialog03, {func = AnimSay, args = {hero.gear, loc("Hooray! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}}) |
483 table.insert(dialog03, {func = AnimSay, args = {hero.gear, loc("Hooray! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}}) |
469 table.insert(dialog03, {func = AnimWait, args = {green1.gear, 4000}}) |
484 table.insert(dialog03, {func = AnimWait, args = {green1.gear, 4000}}) |
470 table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("This Hog Solo is so naive! When he returns I'll shoot him and keep that device for myself!"), SAY_THINK, 4000}}) |
485 table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("This Hog Solo is so naive! When he returns I'll shoot him and keep that device for myself!"), SAY_THINK, 4000}}) |
471 table.insert(dialog03, {func = ShowMission, args = goals[dialog03]}) |
486 table.insert(dialog03, {func = ShowMission, args = goals[dialog03]}) |
472 table.insert(dialog03, {func = makeCptLimeEvil, args = {hero.gear}}) |
487 table.insert(dialog03, {func = makeCptLimeEvil, args = {hero.gear}}) |
473 -- DIALOG04 - At crates, hero learns about the Assassins ambush |
488 -- DIALOG04 - At crates, hero learns about the Assassins ambush |
474 AddSkipFunction(dialog04, Skipanim, {dialog04}) |
489 AddSkipFunction(dialog04, Skipanim, {dialog04}) |
475 table.insert(dialog04, {func = AnimWait, args = {hero.gear, 4000}}) |
490 table.insert(dialog04, {func = AnimWait, args = {hero.gear, 2000}}) |
476 table.insert(dialog04, {func = FollowGear, args = {hero.gear}}) |
491 table.insert(dialog04, {func = FollowGear, args = {hero.gear}}) |
477 table.insert(dialog04, {func = AnimSay, args = {hero.gear, loc("Hooray! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}}) |
492 table.insert(dialog04, {func = AnimSay, args = {hero.gear, loc("Hooray! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}}) |
478 table.insert(dialog04, {func = AnimWait, args = {redHedgehogs[1].gear, 4000}}) |
493 table.insert(dialog04, {func = AnimWait, args = {redHedgehogs[1].gear, 4000}}) |
479 table.insert(dialog04, {func = AnimSay, args = {redHedgehogs[1].gear, loc("We have spotted the enemy! We'll attack when the enemies start gathering!"), SAY_THINK, 4000}}) |
494 table.insert(dialog04, {func = AnimSay, args = {redHedgehogs[1].gear, loc("We have spotted the enemy! We'll attack when the enemies start gathering!"), SAY_THINK, 4000}}) |
480 table.insert(dialog04, {func = ShowMission, args = goals[dialog04]}) |
495 table.insert(dialog04, {func = ShowMission, args = goals[dialog04]}) |
481 table.insert(dialog04, {func = goToThesurface, args = {hero.gear}}) |
496 table.insert(dialog04, {func = goToThesurface, args = {hero.gear}}) |
482 end |
497 end |
483 |
498 |
|
499 function AnimationSetup05(collector) |
|
500 -- DIALOG05 - A member or the green bananas collected the target crate and steals it. Player loses |
|
501 AddSkipFunction(dialog05, Skipanim, {dialog05}) |
|
502 table.insert(dialog05, {func = AnimWait, args = {collector, 2000}}) |
|
503 table.insert(dialog05, {func = FollowGear, args = {collector}}) |
|
504 table.insert(dialog05, {func = AnimSay, args = {collector, loc("Oh yes! I got the device part! Now it belongs to me alone."), SAY_SAY, 4000}}) |
|
505 table.insert(dialog05, {func = AnimWait, args = {collector, 3000}}) |
|
506 table.insert(dialog05, {func = AnimSay, args = {hero.gear, loc("Hey! I was supposed to collect it!"), SAY_SHOUT, 3000}}) |
|
507 table.insert(dialog05, {func = AnimWait, args = {hero.gear, 3000}}) |
|
508 table.insert(dialog05, {func = AnimSay, args = {collector, loc("I don't care. It's worth a fortune! Good bye, you idiot!"), SAY_SAY, 5000}}) |
|
509 table.insert(dialog05, {func = heroIsAStupidFool, args = {collector}}) |
|
510 |
|
511 end |
|
512 |
484 ------------- OTHER FUNCTIONS --------------- |
513 ------------- OTHER FUNCTIONS --------------- |
|
514 |
|
515 -- Hide hog and create a simple escaping effect, if hog exists. |
|
516 -- No-op is hog does not exist |
|
517 function escapeHog(gear) |
|
518 if GetHealth(gear) then |
|
519 AddVisualGear(GetX(gear), GetY(gear), vgtSmokeWhite, 0, false) |
|
520 for i=1, 4 do |
|
521 AddVisualGear(GetX(gear)-16+math.random(32), GetY(gear)-16+math.random(32), vgtSmokeWhite, 0, false) |
|
522 end |
|
523 HideHog(gear) |
|
524 end |
|
525 end |
485 |
526 |
486 function makeCptLimeEvil() |
527 function makeCptLimeEvil() |
487 -- Turn Captain Lime evil |
528 -- Turn Captain Lime evil |
488 SetHogLevel(green1.gear, 1) |
529 SetHogLevel(green1.gear, 1) |
489 EndTurn(true) |
530 EndTurn(true) |