82 isHidden = {} |
82 isHidden = {} |
83 |
83 |
84 |
84 |
85 --------------------------Anim skip functions-------------------------- |
85 --------------------------Anim skip functions-------------------------- |
86 function AfterRefusedAnim() |
86 function AfterRefusedAnim() |
|
87 if stage == loseStage then |
|
88 return |
|
89 end |
87 SpawnUtilityCrate(2045, 1575, amSwitch) |
90 SpawnUtilityCrate(2045, 1575, amSwitch) |
88 SpawnAmmoCrate(2365, 1495, amShotgun) |
91 SpawnAmmoCrate(2365, 1495, amShotgun) |
89 SpawnAmmoCrate(2495, 1519, amGrenade) |
92 SpawnAmmoCrate(2495, 1519, amGrenade) |
90 SpawnUtilityCrate(2620, 1524, amRope) |
93 SpawnUtilityCrate(2620, 1524, amRope) |
91 ShowMission(loc("The Shadow Falls"), loc("The Showdown"), loc("Save Leaks A Lot!|Hint: The switch hedgehog utility might be of help to you."), 1, 6000) |
94 ShowMission(loc("The Shadow Falls"), loc("The Showdown"), loc("Save Leaks A Lot!|Hint: The switch hedgehog utility might be of help to you."), 1, 6000) |
104 AnimWait(ramon, 1) |
107 AnimWait(ramon, 1) |
105 AddFunction({func = HideHog, args = {cyborg}}) |
108 AddFunction({func = HideHog, args = {cyborg}}) |
106 end |
109 end |
107 |
110 |
108 function SkipRefusedAnim() |
111 function SkipRefusedAnim() |
|
112 if stage == loseStage then |
|
113 return |
|
114 end |
109 RefusedStart() |
115 RefusedStart() |
110 AnimSetGearPosition(dense, 2645, 1146) |
116 AnimSetGearPosition(dense, 2645, 1146) |
111 AnimSetGearPosition(ramon, 2218, 1675) |
117 AnimSetGearPosition(ramon, 2218, 1675) |
112 AnimSetGearPosition(spiky, 2400, 1675) |
118 AnimSetGearPosition(spiky, 2400, 1675) |
113 end |
119 end |
114 |
120 |
115 function AfterStartDialogue() |
121 function AfterStartDialogue() |
|
122 if stage == loseStage then |
|
123 return |
|
124 end |
116 stage = spyStage |
125 stage = spyStage |
117 ShowMission(loc("The Shadow Falls"), loc("Play with me!"), loc("Kill the cannibal!"), 1, 6000) |
126 ShowMission(loc("The Shadow Falls"), loc("Play with me!"), loc("Kill the cannibal!"), 1, 6000) |
118 TurnTimeLeft = TurnTime |
127 TurnTimeLeft = TurnTime |
119 end |
128 end |
120 |
129 |
121 |
130 |
122 function StartSkipFunc() |
131 function StartSkipFunc() |
|
132 if stage == loseStage then |
|
133 return |
|
134 end |
123 SetState(cannibals[1], 0) |
135 SetState(cannibals[1], 0) |
124 AnimTurn(leaks, "Right") |
136 AnimTurn(leaks, "Right") |
125 AnimSwitchHog(leaks) |
137 AnimSwitchHog(leaks) |
126 SetInputMask(0xFFFFFFFF) |
138 SetInputMask(0xFFFFFFFF) |
127 end |
139 end |
128 |
140 |
129 function AfterWeaklingsAnim() |
141 function AfterWeaklingsAnim() |
|
142 if stage == loseStage then |
|
143 return |
|
144 end |
130 AddAmmo(cannibals[2], amShotgun, 1) |
145 AddAmmo(cannibals[2], amShotgun, 1) |
131 AddAmmo(cannibals[2], amGrenade, 1) |
146 AddAmmo(cannibals[2], amGrenade, 1) |
132 AddAmmo(cannibals[3], amShotgun, 1) |
147 AddAmmo(cannibals[3], amShotgun, 1) |
133 AddAmmo(cannibals[3], amGrenade, 1) |
148 AddAmmo(cannibals[3], amGrenade, 1) |
134 AddAmmo(cannibals[4], amShotgun, 1) |
149 AddAmmo(cannibals[4], amShotgun, 1) |
159 end |
177 end |
160 SetInputMask(0xFFFFFFFF) |
178 SetInputMask(0xFFFFFFFF) |
161 end |
179 end |
162 |
180 |
163 function AfterStronglingsAnim() |
181 function AfterStronglingsAnim() |
|
182 if stage == loseStage then |
|
183 return |
|
184 end |
164 stage = cyborgStage |
185 stage = cyborgStage |
165 ShowMission(loc("The Shadow Falls"), loc("The Dilemma"), loc("Choose your side! If you want to join the strange man, walk up to him.|Otherwise, walk away from him. If you decide to att...nevermind..."), 1, 8000) |
186 ShowMission(loc("The Shadow Falls"), loc("The Dilemma"), loc("Choose your side! If you want to join the strange man, walk up to him.|Otherwise, walk away from him. If you decide to att...nevermind..."), 1, 8000) |
166 AddEvent(CheckChoice, {}, DoChoice, {}, 0) |
187 AddEvent(CheckChoice, {}, DoChoice, {}, 0) |
167 AddEvent(CheckRefuse, {}, DoRefuse, {}, 0) |
188 AddEvent(CheckRefuse, {}, DoRefuse, {}, 0) |
168 AddEvent(CheckAccept, {}, DoAccept, {}, 0) |
189 AddEvent(CheckAccept, {}, DoAccept, {}, 0) |
198 SwitchHog(dense) |
222 SwitchHog(dense) |
199 SetInputMask(0xFFFFFFFF) |
223 SetInputMask(0xFFFFFFFF) |
200 end |
224 end |
201 |
225 |
202 function AfterAcceptedAnim() |
226 function AfterAcceptedAnim() |
|
227 if stage == loseStage then |
|
228 return |
|
229 end |
203 stage = acceptedReturnStage |
230 stage = acceptedReturnStage |
204 SpawnUtilityCrate(1370, 810, amGirder) |
231 SpawnUtilityCrate(1370, 810, amGirder) |
205 SpawnUtilityCrate(1300, 810, amParachute) |
232 SpawnUtilityCrate(1300, 810, amParachute) |
206 ShowMission(loc("The Shadow Falls"), loc("The walk of Fame"), loc("Return to Leaks A Lot!"), 1, 6000) |
233 ShowMission(loc("The Shadow Falls"), loc("The walk of Fame"), loc("Return to Leaks A Lot!"), 1, 6000) |
207 AddEvent(CheckReadyForStronglings, {}, DoReadyForStronglings, {}, 0) |
234 AddEvent(CheckReadyForStronglings, {}, DoReadyForStronglings, {}, 0) |
212 AnimWait(dense, 1) |
239 AnimWait(dense, 1) |
213 AddFunction({func = HideHog, args = {cyborg}}) |
240 AddFunction({func = HideHog, args = {cyborg}}) |
214 end |
241 end |
215 |
242 |
216 function SkipAcceptedAnim() |
243 function SkipAcceptedAnim() |
|
244 if stage == loseStage then |
|
245 return |
|
246 end |
217 AnimSetGearPosition(cyborg, unpack(cyborgPos)) |
247 AnimSetGearPosition(cyborg, unpack(cyborgPos)) |
218 SetState(cyborg, gstInvisible) |
248 SetState(cyborg, gstInvisible) |
219 AnimSwitchHog(dense) |
249 AnimSwitchHog(dense) |
220 SetInputMask(0xFFFFFFFF) |
250 SetInputMask(0xFFFFFFFF) |
221 end |
251 end |
222 |
252 |
223 function AfterAttackedAnim() |
253 function AfterAttackedAnim() |
|
254 if stage == loseStage then |
|
255 return |
|
256 end |
224 stage = aloneStage |
257 stage = aloneStage |
225 ShowMission(loc("The Shadow Falls"), loc("The Individualist"), loc("Defeat the cannibals!|Grenade hint: set the timer with [1-5], aim with [Up]/[Down] and hold [Space] to set power"), 1, 8000) |
258 ShowMission(loc("The Shadow Falls"), loc("The Individualist"), loc("Defeat the cannibals!|Grenade hint: set the timer with [1-5], aim with [Up]/[Down] and hold [Space] to set power"), 1, 8000) |
226 AddAmmo(cannibals[6], amGrenade, 1) |
259 AddAmmo(cannibals[6], amGrenade, 1) |
227 AddAmmo(cannibals[6], amFirePunch, 0) |
260 AddAmmo(cannibals[6], amFirePunch, 0) |
228 AddAmmo(cannibals[6], amBaseballBat, 0) |
261 AddAmmo(cannibals[6], amBaseballBat, 0) |
284 AnimInsertStepNext({func = AnimWait, args = {dense, 800}}) |
323 AnimInsertStepNext({func = AnimWait, args = {dense, 800}}) |
285 AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false}) |
324 AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false}) |
286 end |
325 end |
287 |
326 |
288 function BlowDenseCloud() |
327 function BlowDenseCloud() |
|
328 if stage == loseStage then |
|
329 return |
|
330 end |
289 AnimInsertStepNext({func = DeleteGear, args = {dense}, swh = false}) |
331 AnimInsertStepNext({func = DeleteGear, args = {dense}, swh = false}) |
290 AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense), GetY(dense), vgtBigExplosion, 0, true}, swh = false}) |
332 AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense), GetY(dense), vgtBigExplosion, 0, true}, swh = false}) |
291 AnimInsertStepNext({func = AnimWait, args = {dense, 1200}}) |
333 AnimInsertStepNext({func = AnimWait, args = {dense, 1200}}) |
292 AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + 20, GetY(dense), vgtExplosion, 0, true}, swh = false}) |
334 AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + 20, GetY(dense), vgtExplosion, 0, true}, swh = false}) |
293 AnimInsertStepNext({func = AnimWait, args = {dense, 100}}) |
335 AnimInsertStepNext({func = AnimWait, args = {dense, 100}}) |
551 SetState(ramon, gstInvisible) |
596 SetState(ramon, gstInvisible) |
552 SetState(spiky, gstInvisible) |
597 SetState(spiky, gstInvisible) |
553 end |
598 end |
554 |
599 |
555 function CondNeedToTurn(hog1, hog2) |
600 function CondNeedToTurn(hog1, hog2) |
|
601 if stage == loseStage then |
|
602 return |
|
603 end |
556 xl, xd = GetX(hog1), GetX(hog2) |
604 xl, xd = GetX(hog1), GetX(hog2) |
557 if xl > xd then |
605 if xl and xd then |
558 AnimInsertStepNext({func = AnimTurn, args = {hog1, "Left"}}) |
606 if xl > xd then |
559 AnimInsertStepNext({func = AnimTurn, args = {hog2, "Right"}}) |
607 AnimInsertStepNext({func = AnimTurn, args = {hog1, "Left"}}) |
560 elseif xl < xd then |
608 AnimInsertStepNext({func = AnimTurn, args = {hog2, "Right"}}) |
561 AnimInsertStepNext({func = AnimTurn, args = {hog2, "Left"}}) |
609 elseif xl < xd then |
562 AnimInsertStepNext({func = AnimTurn, args = {hog1, "Right"}}) |
610 AnimInsertStepNext({func = AnimTurn, args = {hog2, "Left"}}) |
|
611 AnimInsertStepNext({func = AnimTurn, args = {hog1, "Right"}}) |
|
612 end |
563 end |
613 end |
564 end |
614 end |
565 |
615 |
566 function HideHogs() |
616 function HideHogs() |
567 for i = 2, 9 do |
617 for i = 2, 9 do |
575 ramonHidden = true |
625 ramonHidden = true |
576 spikyHidden = true |
626 spikyHidden = true |
577 end |
627 end |
578 |
628 |
579 function HideStronglings() |
629 function HideStronglings() |
|
630 if stage == loseStage then |
|
631 return |
|
632 end |
580 for i = 6, 9 do |
633 for i = 6, 9 do |
581 HideHog(cannibals[i]) |
634 HideHog(cannibals[i]) |
582 isHidden[cannibals[i]] = true |
635 isHidden[cannibals[i]] = true |
583 end |
636 end |
584 end |
637 end |
585 |
638 |
586 function UnHideWeaklings() |
639 function UnHideWeaklings() |
|
640 if stage == loseStage then |
|
641 return |
|
642 end |
587 for i = 2, 5 do |
643 for i = 2, 5 do |
588 RestoreHog(cannibals[i]) |
644 RestoreHog(cannibals[i]) |
589 isHidden[cannibals[i]] = false |
645 isHidden[cannibals[i]] = false |
590 SetState(cannibals[i], gstInvisible) |
646 SetState(cannibals[i], gstInvisible) |
591 end |
647 end |
592 end |
648 end |
593 |
649 |
594 function UnHideStronglings() |
650 function UnHideStronglings() |
|
651 if stage == loseStage then |
|
652 return |
|
653 end |
595 for i = 6, 9 do |
654 for i = 6, 9 do |
596 RestoreHog(cannibals[i]) |
655 RestoreHog(cannibals[i]) |
597 isHidden[cannibals[i]] = false |
656 isHidden[cannibals[i]] = false |
598 SetState(cannibals[i], gstInvisible) |
657 SetState(cannibals[i], gstInvisible) |
599 end |
658 end |
655 function CheckRefuse() |
726 function CheckRefuse() |
656 return GetX(dense) > 1400 and StoppedGear(dense) |
727 return GetX(dense) > 1400 and StoppedGear(dense) |
657 end |
728 end |
658 |
729 |
659 function DoRefuse() |
730 function DoRefuse() |
|
731 if stage == loseStage then |
|
732 return |
|
733 end |
660 choice = choiceRefuse |
734 choice = choiceRefuse |
661 end |
735 end |
662 |
736 |
663 function CheckAccept() |
737 function CheckAccept() |
664 return GetX(dense) < 1300 and StoppedGear(dense) |
738 return GetX(dense) < 1300 and StoppedGear(dense) |
665 end |
739 end |
666 |
740 |
667 function DoAccept() |
741 function DoAccept() |
|
742 if stage == loseStage then |
|
743 return |
|
744 end |
668 choice = choiceAccept |
745 choice = choiceAccept |
669 end |
746 end |
670 |
747 |
671 function CheckConfront() |
748 function CheckConfront() |
672 return cyborgAttacked and StoppedGear(dense) |
749 return cyborgAttacked and StoppedGear(dense) |
673 end |
750 end |
674 |
751 |
675 function DoConfront() |
752 function DoConfront() |
|
753 if stage == loseStage then |
|
754 return |
|
755 end |
676 choice = choiceAttack |
756 choice = choiceAttack |
677 end |
757 end |
678 |
758 |
679 function CheckChoice() |
759 function CheckChoice() |
680 return choice ~= 0 |
760 return choice ~= 0 |
681 end |
761 end |
682 |
762 |
683 function DoChoice() |
763 function DoChoice() |
|
764 if stage == loseStage then |
|
765 return |
|
766 end |
684 RemoveEventFunc(CheckConfront) |
767 RemoveEventFunc(CheckConfront) |
685 RemoveEventFunc(CheckAccept) |
768 RemoveEventFunc(CheckAccept) |
686 RemoveEventFunc(CheckRefuse) |
769 RemoveEventFunc(CheckRefuse) |
687 ChoiceTaken() |
770 ChoiceTaken() |
688 end |
771 end |
689 |
772 |
690 function CheckNeedGirder() |
773 function CheckNeedGirder() |
|
774 if stage == loseStage then |
|
775 return false |
|
776 end |
691 return GetX(dense) > 1640 and StoppedGear(dense) |
777 return GetX(dense) > 1640 and StoppedGear(dense) |
692 end |
778 end |
693 |
779 |
694 function DoNeedGirder() |
780 function DoNeedGirder() |
|
781 if stage == loseStage then |
|
782 return |
|
783 end |
695 ShowMission(loc("The Shadow Falls"), loc("Under Construction"), loc("Return to Leaks A Lot!") .. "|" .. loc("To place a girder, select it, use [Left] and [Right] to select angle and length, place with [Left Click]"), 1, 6000) |
784 ShowMission(loc("The Shadow Falls"), loc("Under Construction"), loc("Return to Leaks A Lot!") .. "|" .. loc("To place a girder, select it, use [Left] and [Right] to select angle and length, place with [Left Click]"), 1, 6000) |
696 end |
785 end |
697 |
786 |
698 function CheckNeedWeapons() |
787 function CheckNeedWeapons() |
|
788 if stage == loseStage then |
|
789 return false |
|
790 end |
699 return GetX(dense) > 2522 and StoppedGear(dense) |
791 return GetX(dense) > 2522 and StoppedGear(dense) |
700 end |
792 end |
701 |
793 |
702 function DoNeedWeapons() |
794 function DoNeedWeapons() |
|
795 if stage == loseStage then |
|
796 return |
|
797 end |
703 grenadeCrate = SpawnAmmoCrate(2550, 800, amGrenade) |
798 grenadeCrate = SpawnAmmoCrate(2550, 800, amGrenade) |
704 shotgunCrate = SpawnAmmoCrate(2610, 850, amShotgun) |
799 shotgunCrate = SpawnAmmoCrate(2610, 850, amShotgun) |
705 AddCaption(loc("A little gift from the cyborgs")) |
800 AddCaption(loc("A little gift from the cyborgs")) |
706 end |
801 end |
707 |
802 |
708 function CheckReadyForStronglings() |
803 function CheckReadyForStronglings() |
|
804 if stage == loseStage then |
|
805 return false |
|
806 end |
709 return (shotgunTaken and grenadeTaken) or GetX(dense) > 2700 |
807 return (shotgunTaken and grenadeTaken) or GetX(dense) > 2700 |
710 end |
808 end |
711 |
809 |
712 function DoReadyForStronglings() |
810 function DoReadyForStronglings() |
|
811 if stage == loseStage then |
|
812 return |
|
813 end |
713 ShowMission(loc("The Shadow Falls"), loc("The guardian"), loc("Protect yourselves!|Grenade hint: set the timer with [1-5], aim with [Up]/[Down] and hold [Space] to set power"), 1, 8000) |
814 ShowMission(loc("The Shadow Falls"), loc("The guardian"), loc("Protect yourselves!|Grenade hint: set the timer with [1-5], aim with [Up]/[Down] and hold [Space] to set power"), 1, 8000) |
714 AddAmmo(dense, amSkip, 100) |
815 AddAmmo(dense, amSkip, 100) |
715 AddAmmo(dense, amSwitch, 100) |
816 AddAmmo(dense, amSwitch, 100) |
716 AddAmmo(leaks, amSkip, 100) |
817 AddAmmo(leaks, amSkip, 100) |
717 AddAmmo(leaks, amSwitch, 100) |
818 AddAmmo(leaks, amSwitch, 100) |
774 end |
881 end |
775 SaveCampaignVar("M2Choice", "" .. choice) |
882 SaveCampaignVar("M2Choice", "" .. choice) |
776 end |
883 end |
777 |
884 |
778 function DoStronglingsDeadAttacked() |
885 function DoStronglingsDeadAttacked() |
|
886 if stage == loseStage then |
|
887 return |
|
888 end |
779 SaveCampaignVar("M2DenseDead", "1") |
889 SaveCampaignVar("M2DenseDead", "1") |
780 SaveCampaignVar("M2RamonDead", "0") |
890 SaveCampaignVar("M2RamonDead", "0") |
781 SaveCampaignVar("M2SpikyDead", "0") |
891 SaveCampaignVar("M2SpikyDead", "0") |
782 if progress and progress<2 then |
892 if progress and progress<2 then |
783 SaveCampaignVar("Progress", "2") |
893 SaveCampaignVar("Progress", "2") |