23 -- dialogs |
23 -- dialogs |
24 local dialog01 = {} |
24 local dialog01 = {} |
25 local dialog02 = {} |
25 local dialog02 = {} |
26 local dialog03 = {} |
26 local dialog03 = {} |
27 local dialog04 = {} |
27 local dialog04 = {} |
|
28 local dialog05 = {} |
|
29 local dialog06 = {} |
28 -- mission objectives |
30 -- mission objectives |
29 local goals = { |
31 local goals = { |
30 [dialog01] = {missionName, loc("Getting ready"), loc("Go to the upper platform and get the weapons in the crates!"), 1, 4500}, |
32 [dialog01] = {missionName, loc("Getting ready"), loc("Go to the upper platform and get the weapons in the crates!"), 1, 4500}, |
31 [dialog02] = {missionName, loc("Prepare to fight"), loc("Go down and save these PAotH hogs!"), 1, 5000}, |
33 [dialog02] = {missionName, loc("Prepare to fight"), loc("Go down and save these PAotH hogs!"), 1, 5000}, |
32 [dialog03] = {missionName, loc("The fight begins!"), loc("Neutralize your enemies and be careful!"), 1, 5000}, |
34 [dialog03] = {missionName, loc("The fight begins!"), loc("Neutralize your enemies and be careful!"), 1, 5000}, |
393 local m2h = GetHealth(minion2.gear) |
394 local m2h = GetHealth(minion2.gear) |
394 local m3h = GetHealth(minion3.gear) |
395 local m3h = GetHealth(minion3.gear) |
395 if m1h == 0 or m2h == 0 or m3h == 0 then return end |
396 if m1h == 0 or m2h == 0 or m3h == 0 then return end |
396 |
397 |
397 if m1h and m1h > 0 and StoppedGear(minion1.gear) then |
398 if m1h and m1h > 0 and StoppedGear(minion1.gear) then |
398 AnimSay(minion1.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000) |
399 Dialog06Setup(minion1.gear) |
399 elseif m2h and m2h > 0 and StoppedGear(minion2.gear) then |
400 elseif m2h and m2h > 0 and StoppedGear(minion2.gear) then |
400 AnimSay(minion2.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000) |
401 Dialog06ASetup(minion2.gear) |
401 elseif m3h and m3h > 0 and StoppedGear(minion3.gear) then |
402 elseif m3h and m3h > 0 and StoppedGear(minion3.gear) then |
402 AnimSay(minion3.gear, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 6000) |
403 Dialog06Setup(minion3.gear) |
403 end |
404 end |
404 |
405 AddAnim(dialog06) |
405 AnimCaption(hero.gear, loc("Congrats! You made them run away!"), 6000) |
406 end |
|
407 |
|
408 function afterDialog06() |
|
409 EndTurn(true) |
406 SendStat(siCustomAchievement, loc("You have eliminated Professor Hogevil.")) |
410 SendStat(siCustomAchievement, loc("You have eliminated Professor Hogevil.")) |
407 SendStat(siCustomAchievement, loc("You drove the minions away.")) |
411 SendStat(siCustomAchievement, loc("You drove the minions away.")) |
408 DismissTeam(teamB.name) |
|
409 AnimWait(hero.gear,5000) |
|
410 |
|
411 SaveCampaignVar("ProfDiedOnMoon", "1") |
412 SaveCampaignVar("ProfDiedOnMoon", "1") |
|
413 victory() |
|
414 end |
|
415 |
|
416 function afterDialog05() |
|
417 EndTurn(true) |
|
418 HideHog(professor.gear) |
|
419 SendStat(siCustomAchievement, loc("You have eliminated the evil minions.")) |
|
420 SendStat(siCustomAchievement, loc("You drove Professor Hogevil away.")) |
|
421 |
|
422 SaveCampaignVar("ProfDiedOnMoon", "0") |
412 victory() |
423 victory() |
413 end |
424 end |
414 |
425 |
415 function minionsDeath(gear) |
426 function minionsDeath(gear) |
416 if professor.dead or GetHealth(professor.gear) == nil or GetHealth(professor.gear) == 0 then return end |
427 if professor.dead or GetHealth(professor.gear) == nil or GetHealth(professor.gear) == 0 then return end |
417 if gameOver then return end |
428 if gameOver then return end |
418 |
429 AddAnim(dialog05) |
419 AnimSay(professor.gear, loc("I may lost this battle, but I haven't lost the war yet!"), SAY_SHOUT, 6000) |
|
420 DismissTeam(teamC.name) |
|
421 AnimWait(hero.gear,5000) |
|
422 SendStat(siCustomAchievement, loc("You have eliminated the evil minions.")) |
|
423 SendStat(siCustomAchievement, loc("You drove Professor Hogevil away.")) |
|
424 |
|
425 SaveCampaignVar("ProfDiedOnMoon", "0") |
|
426 victory() |
|
427 end |
430 end |
428 |
431 |
429 -------------- ANIMATIONS ------------------ |
432 -------------- ANIMATIONS ------------------ |
430 |
433 |
431 function Skipanim(anim) |
434 function Skipanim(anim) |
458 table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Ehm, okay ..."), SAY_SAY, 2500}}) |
469 table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Ehm, okay ..."), SAY_SAY, 2500}}) |
459 table.insert(dialog01, {func = ShowMission, args = goals[dialog01]}) |
470 table.insert(dialog01, {func = ShowMission, args = goals[dialog01]}) |
460 table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}}) |
471 table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}}) |
461 -- DIALOG 02 - To the weapons platform |
472 -- DIALOG 02 - To the weapons platform |
462 AddSkipFunction(dialog02, Skipanim, {dialog02}) |
473 AddSkipFunction(dialog02, Skipanim, {dialog02}) |
463 table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Checkpoint reached!"), 4000}}) |
474 table.insert(dialog02, {func = AnimWait, args = {hero.gear, 100}}) |
|
475 table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Checkpoint reached!"), 4000}}) |
464 table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I've made it! Yeah!"), SAY_SHOUT, 4000}}) |
476 table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I've made it! Yeah!"), SAY_SHOUT, 4000}}) |
465 table.insert(dialog02, {func = AnimSay, args = {paoth1.gear, loc("Nice! Now hurry and get down! You have to rescue my friends!"), SAY_SHOUT, 7000}}) |
477 table.insert(dialog02, {func = AnimSay, args = {paoth1.gear, loc("Nice! Now hurry and get down! You have to rescue my friends!"), SAY_SHOUT, 7000}}) |
466 table.insert(dialog02, {func = setAfterDialog02, args = {}}) |
478 table.insert(dialog02, {func = setAfterDialog02, args = {}}) |
467 table.insert(dialog02, {func = ShowMission, args = goals[dialog02]}) |
479 table.insert(dialog02, {func = ShowMission, args = goals[dialog02]}) |
468 table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}}) |
480 table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}}) |
480 table.insert(dialog04, {func = AnimSay, args = {minion1.gear, loc("Look, boss! There is the target!"), SAY_SHOUT, 4000}}) |
492 table.insert(dialog04, {func = AnimSay, args = {minion1.gear, loc("Look, boss! There is the target!"), SAY_SHOUT, 4000}}) |
481 table.insert(dialog04, {func = AnimSay, args = {professor.gear, loc("Prepare for battle!"), SAY_SHOUT, 4000}}) |
493 table.insert(dialog04, {func = AnimSay, args = {professor.gear, loc("Prepare for battle!"), SAY_SHOUT, 4000}}) |
482 table.insert(dialog04, {func = AnimSay, args = {hero.gear, loc("Here we go!"), SAY_THINK, 4000}}) |
494 table.insert(dialog04, {func = AnimSay, args = {hero.gear, loc("Here we go!"), SAY_THINK, 4000}}) |
483 table.insert(dialog04, {func = ShowMission, args = goals[dialog04]}) |
495 table.insert(dialog04, {func = ShowMission, args = goals[dialog04]}) |
484 table.insert(dialog04, {func = startCombat, args = {hero.gear}}) |
496 table.insert(dialog04, {func = startCombat, args = {hero.gear}}) |
|
497 -- DIALOG 05 - All minions dead |
|
498 AddSkipFunction(dialog05, Skipanim, {dialog05}) |
|
499 table.insert(dialog05, {func = AnimWait, args = {professor.gear, 1500}}) |
|
500 table.insert(dialog05, {func = AnimSay, args = {professor.gear, loc("I may lost this battle, but I haven't lost the war yet!"), SAY_SHOUT, 5000}}) |
|
501 table.insert(dialog05, {func = runaway, args = {professor.gear}}) |
|
502 table.insert(dialog05, {func = afterDialog05, args = {professor.gear}}) |
|
503 end |
|
504 |
|
505 function Dialog06Setup(livingMinion) |
|
506 -- DIALOG 06 - Professor dead |
|
507 AddSkipFunction(dialog06, Skipanim, {dialog06}) |
|
508 table.insert(dialog06, {func = AnimWait, args = {livingMinion, 1500}}) |
|
509 table.insert(dialog06, {func = AnimSay, args = {livingMinion, loc("The boss has fallen! Retreat!"), SAY_SHOUT, 3000}}) |
|
510 table.insert(dialog06, {func = runaway, args = {minion1.gear}}) |
|
511 table.insert(dialog06, {func = runaway, args = {minion2.gear}}) |
|
512 table.insert(dialog06, {func = runaway, args = {minion3.gear}}) |
|
513 table.insert(dialog06, {func = afterDialog06, args = {livingMinion}}) |
|
514 end |
|
515 |
|
516 function runaway(gear) |
|
517 if GetHealth(gear) then |
|
518 AddVisualGear(GetX(gear)-5, GetY(gear)-5, vgtSmoke, 0, false) |
|
519 AddVisualGear(GetX(gear)+5, GetY(gear)+5, vgtSmoke, 0, false) |
|
520 AddVisualGear(GetX(gear)-5, GetY(gear)+5, vgtSmoke, 0, false) |
|
521 AddVisualGear(GetX(gear)+5, GetY(gear)-5, vgtSmoke, 0, false) |
|
522 SetState(gear, bor(GetState(gear), gstInvisible)) |
|
523 end |
485 end |
524 end |
486 |
525 |
487 ------------------- custom "animation" functions -------------------------- |
526 ------------------- custom "animation" functions -------------------------- |
488 |
527 |
489 function startCombat() |
528 function startCombat() |