share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/shadow.lua
changeset 7213 fce7de71742f
parent 7211 a1e9335f1d50
child 7225 e3f2280d9000
equal deleted inserted replaced
7211:a1e9335f1d50 7213:fce7de71742f
    71 ramonDead = false
    71 ramonDead = false
    72 denseDead = false
    72 denseDead = false
    73 leaksDead = false
    73 leaksDead = false
    74 ramonHidden = false
    74 ramonHidden = false
    75 spikyHidden = false
    75 spikyHidden = false
       
    76 grenadeUsed = false
       
    77 shotgunUsed = false
    76 
    78 
    77 
    79 
    78 hogNr = {}
    80 hogNr = {}
    79 cannibalDead = {}
    81 cannibalDead = {}
    80 isHidden = {}
    82 isHidden = {}
   220 
   222 
   221 function AfterAttackedAnim()
   223 function AfterAttackedAnim()
   222   stage = aloneStage
   224   stage = aloneStage
   223   HideHog(cyborg)
   225   HideHog(cyborg)
   224   ShowMission("The Shadow Falls", "The Individualist", "Defeat the cannibals!|Grenade hint: set the timer with [1-5], aim with [Up]/[Down] and hold [Space] to set power", 1, 8000)
   226   ShowMission("The Shadow Falls", "The Individualist", "Defeat the cannibals!|Grenade hint: set the timer with [1-5], aim with [Up]/[Down] and hold [Space] to set power", 1, 8000)
       
   227   AddAmmo(cannibals[6], amGrenade, 5)
       
   228   AddAmmo(cannibals[6], amFirePunch, 0)
       
   229   AddAmmo(cannibals[6], amBaseballBat, 0)
       
   230   SetGearMessage(leaks, 0)
       
   231   TurnTimeLeft = TurnTime
       
   232   AddEvent(CheckStronglingsDead, {}, DoStronglingsDeadAttacked, {}, 0)
       
   233 end
       
   234 
       
   235 function SkipAttackedAnim()
       
   236   if denseDead == false then
       
   237     DeleteGear(dense)
       
   238   end
   225   SpawnAmmoCrate(2551, 994, amGrenade)
   239   SpawnAmmoCrate(2551, 994, amGrenade)
   226   SpawnAmmoCrate(3551, 994, amGrenade)
   240   SpawnAmmoCrate(3551, 994, amGrenade)
   227   SpawnAmmoCrate(3392, 1101, amShotgun)
   241   SpawnAmmoCrate(3392, 1101, amShotgun)
   228   SpawnAmmoCrate(3192, 1101, amShotgun)
   242   SpawnAmmoCrate(3192, 1101, amShotgun)
   229   AddAmmo(cannibals[6], amGrenade, 5)
       
   230   SetGearMessage(leaks, 0)
       
   231   TurnTimeLeft = TurnTime
       
   232   AddEvent(CheckStronglingsDead, {}, DoStronglingsDeadAttacked, {}, 0)
       
   233 end
       
   234 
       
   235 function SkipAttackedAnim()
       
   236   if denseDead == false then
       
   237     SetHealth(dense)
       
   238   end
       
   239   SetGearPosition(cyborg, unpack(cyborgPos))
   243   SetGearPosition(cyborg, unpack(cyborgPos))
   240   SetState(cyborg, gstInvisible)
   244   SetState(cyborg, gstInvisible)
   241   AnimSwitchHog(leaks)
   245   AnimSwitchHog(leaks)
   242   SetInputMask(0xFFFFFFFF)
   246   SetInputMask(0xFFFFFFFF)
   243 end
   247 end
   244 
   248 
   245   
   249   
   246 -----------------------------Animations--------------------------------
   250 -----------------------------Animations--------------------------------
       
   251 
       
   252 function SpawnCrates()
       
   253   SpawnAmmoCrate(2551, 994, amGrenade)
       
   254   SpawnAmmoCrate(3551, 994, amGrenade)
       
   255   SpawnAmmoCrate(3392, 1101, amShotgun)
       
   256   SpawnAmmoCrate(3192, 1101, amShotgun)
       
   257   return true
       
   258 end
   247 
   259 
   248 function EmitDenseClouds(anim, dir)
   260 function EmitDenseClouds(anim, dir)
   249   local dif
   261   local dif
   250   if dir == "left" then 
   262   if dir == "left" then 
   251     dif = 10
   263     dif = 10
   271   AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + 10, GetY(dense), vgtExplosion, 0, true}, swh = false})
   283   AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + 10, GetY(dense), vgtExplosion, 0, true}, swh = false})
   272   AnimInsertStepNext({func = AnimWait, args = {dense, 100}})
   284   AnimInsertStepNext({func = AnimWait, args = {dense, 100}})
   273   AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) - 10, GetY(dense), vgtExplosion, 0, true}, swh = false})
   285   AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) - 10, GetY(dense), vgtExplosion, 0, true}, swh = false})
   274   AnimInsertStepNext({func = AnimWait, args = {dense, 100}})
   286   AnimInsertStepNext({func = AnimWait, args = {dense, 100}})
   275   AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) - 20, GetY(dense), vgtExplosion, 0, true}, swh = false})
   287   AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) - 20, GetY(dense), vgtExplosion, 0, true}, swh = false})
       
   288 end
       
   289 
       
   290 function SetupAcceptedSurvivedFinalAnim()
       
   291   table.insert(acceptedSurvivedFinalAnim, {func = AnimCustomFunction, args = {dense, CondNeedToTurn, {leaks, dense}}})
       
   292   table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {leaks, "Pfew! That was close!", SAY_SAY, 3000}})
       
   293   if grenadeUsed and shotgunUsed then
       
   294     table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {leaks, "Where did you get the exploding apples and the magic bow that shoots many arrows?", SAY_SAY, 9000}})
       
   295   elseif grenadeUsed then
       
   296     table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {leaks, "Where did you get the exploding apples?", SAY_SAY, 6000}})
       
   297   elseif shotgunUsed then
       
   298     table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {leaks, "Where did you get the magic bow that shoots many arrows?", SAY_SAY, 8000}})
       
   299   else
       
   300     table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {leaks, "Did you warn the village?", SAY_SAY, 4000}})
       
   301     table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {dense, "No, I came back to help you out...", SAY_SAY, 5000}})
       
   302   end
       
   303   if grenadeUsed or shotgunUsed then
       
   304     table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {dense, "Uhm...I met one of them and took his weapons.", SAY_SAY, 5000}})
       
   305   end
       
   306   table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {dense, "We should head back to the village now.", SAY_SAY, 5000}})
   276 end
   307 end
   277 
   308 
   278 function AnimationSetup()
   309 function AnimationSetup()
   279   table.insert(startDialogue, {func = AnimWait, args = {dense, 4000}})
   310   table.insert(startDialogue, {func = AnimWait, args = {dense, 4000}})
   280   table.insert(startDialogue, {func = AnimCaption, args = {leaks, "After the shock caused by the enemy spy, Leaks A Lot and Dense Cloud went hunting to relax.", 6000}})
   311   table.insert(startDialogue, {func = AnimCaption, args = {leaks, "After the shock caused by the enemy spy, Leaks A Lot and Dense Cloud went hunting to relax.", 6000}})
   301   table.insert(startDialogue, {func = AnimSay, args = {cannibals[1], "Not you again! My head still hurts from last time!", SAY_SHOUT, 6000}})
   332   table.insert(startDialogue, {func = AnimSay, args = {cannibals[1], "Not you again! My head still hurts from last time!", SAY_SHOUT, 6000}})
   302   table.insert(startDialogue, {func = AnimSwitchHog, args = {leaks}})
   333   table.insert(startDialogue, {func = AnimSwitchHog, args = {leaks}})
   303   AddSkipFunction(startDialogue, StartSkipFunc, {})
   334   AddSkipFunction(startDialogue, StartSkipFunc, {})
   304 
   335 
   305   table.insert(weaklingsAnim, {func = AnimGearWait, args = {leaks, 1000}})
   336   table.insert(weaklingsAnim, {func = AnimGearWait, args = {leaks, 1000}})
   306   table.insert(weaklingsAnim, {func = AnimCustomFunction, args = {leaks, UnHideWeaklings, {}}})
       
   307   table.insert(weaklingsAnim, {func = AnimCustomFunction, args = {leaks, CondNeedToTurn, {leaks, dense}}})
   337   table.insert(weaklingsAnim, {func = AnimCustomFunction, args = {leaks, CondNeedToTurn, {leaks, dense}}})
   308   table.insert(weaklingsAnim, {func = AnimSay, args = {leaks, "Did you see him coming?", SAY_SAY, 3500}})
   338   table.insert(weaklingsAnim, {func = AnimSay, args = {leaks, "Did you see him coming?", SAY_SAY, 3500}})
   309   table.insert(weaklingsAnim, {func = AnimSay, args = {dense, "No. Where did he come from?", SAY_SAY, 3500}})
   339   table.insert(weaklingsAnim, {func = AnimSay, args = {dense, "No. Where did he come from?", SAY_SAY, 3500}})
       
   340   table.insert(weaklingsAnim, {func = AnimCustomFunction, args = {leaks, UnHideWeaklings, {}}})
   310   table.insert(weaklingsAnim, {func = AnimOutOfNowhere, args = {cannibals[2], unpack(cannibalPos[2])}})
   341   table.insert(weaklingsAnim, {func = AnimOutOfNowhere, args = {cannibals[2], unpack(cannibalPos[2])}})
   311   table.insert(weaklingsAnim, {func = AnimGiveState, args = {cannibals[2], 0}})
   342   table.insert(weaklingsAnim, {func = AnimGiveState, args = {cannibals[2], 0}})
   312   table.insert(weaklingsAnim, {func = AnimWait, args = {leaks, 400}})
   343   table.insert(weaklingsAnim, {func = AnimWait, args = {leaks, 400}})
   313   table.insert(weaklingsAnim, {func = AnimGiveState, args = {cannibals[3], 0}})
   344   table.insert(weaklingsAnim, {func = AnimGiveState, args = {cannibals[3], 0}})
   314   table.insert(weaklingsAnim, {func = AnimOutOfNowhere, args = {cannibals[3], unpack(cannibalPos[3])}})
   345   table.insert(weaklingsAnim, {func = AnimOutOfNowhere, args = {cannibals[3], unpack(cannibalPos[3])}})
   351   table.insert(stronglingsAnim, {func = AnimWait, args = {leaks, 700}})
   382   table.insert(stronglingsAnim, {func = AnimWait, args = {leaks, 700}})
   352   table.insert(stronglingsAnim, {func = AnimTurn, args = {leaks, "Left"}})
   383   table.insert(stronglingsAnim, {func = AnimTurn, args = {leaks, "Left"}})
   353   table.insert(stronglingsAnim, {func = AnimSay, args = {leaks, "We can't defeat them!", SAY_THINK, 3000}})
   384   table.insert(stronglingsAnim, {func = AnimSay, args = {leaks, "We can't defeat them!", SAY_THINK, 3000}})
   354   table.insert(stronglingsAnim, {func = AnimSay, args = {leaks, "I'll hold them up while you return to the village!", SAY_SAY, 6000}})
   385   table.insert(stronglingsAnim, {func = AnimSay, args = {leaks, "I'll hold them up while you return to the village!", SAY_SAY, 6000}})
   355   table.insert(stronglingsAnim, {func = AnimFollowGear, args = {cyborg}, swh = false})
   386   table.insert(stronglingsAnim, {func = AnimFollowGear, args = {cyborg}, swh = false})
   356   table.insert(stronglingsAnim, {func = AnimWait, args = {cyborg, 1000}})
   387   table.insert(stronglingsAnim, {func = AnimCaption, args = {cyborg, "30 minutes later..."}, swh = false})
       
   388   table.insert(stronglingsAnim, {func = AnimWait, args = {cyborg, 2000}})
   357   table.insert(stronglingsAnim, {func = AnimSetGearPosition, args = {dense, 1420, 1315}})
   389   table.insert(stronglingsAnim, {func = AnimSetGearPosition, args = {dense, 1420, 1315}})
   358   table.insert(stronglingsAnim, {func = AnimMove, args = {dense, "left", 1400, 0}})
   390   table.insert(stronglingsAnim, {func = AnimMove, args = {dense, "left", 1400, 0}})
   359   table.insert(stronglingsAnim, {func = AnimCustomFunction, args = {dense, EmitDenseClouds, {stronglingsAnim, "left"}}})
   391   table.insert(stronglingsAnim, {func = AnimCustomFunction, args = {dense, EmitDenseClouds, {stronglingsAnim, "left"}}})
   360   table.insert(stronglingsAnim, {func = AnimMove, args = {dense, "left", 1350, 0}})
   392   table.insert(stronglingsAnim, {func = AnimMove, args = {dense, "left", 1350, 0}})
   361   table.insert(stronglingsAnim, {func = AnimOutOfNowhere, args = {cyborg, 1250, 1320}})
   393   table.insert(stronglingsAnim, {func = AnimOutOfNowhere, args = {cyborg, 1250, 1320}})
   378   table.insert(acceptedAnim, {func = AnimSay, args = {cyborg, "In the meantime, take these and return to your \"friend\"!", SAY_SAY, 6000}})
   410   table.insert(acceptedAnim, {func = AnimSay, args = {cyborg, "In the meantime, take these and return to your \"friend\"!", SAY_SAY, 6000}})
   379   table.insert(acceptedAnim, {func = AnimGiveState, args = {cyborg, gstInvisible}})
   411   table.insert(acceptedAnim, {func = AnimGiveState, args = {cyborg, gstInvisible}})
   380   table.insert(acceptedAnim, {func = AnimDisappear, args = {cyborg, unpack(cyborgPos)}})
   412   table.insert(acceptedAnim, {func = AnimDisappear, args = {cyborg, unpack(cyborgPos)}})
   381   table.insert(acceptedAnim, {func = AnimSwitchHog, args = {dense}})
   413   table.insert(acceptedAnim, {func = AnimSwitchHog, args = {dense}})
   382   AddSkipFunction(acceptedAnim, SkipAcceptedAnim, {}) 
   414   AddSkipFunction(acceptedAnim, SkipAcceptedAnim, {}) 
   383 
       
   384   table.insert(acceptedSurvivedFinalAnim, {func = AnimCustomFunction, args = {dense, CondNeedToTurn, {leaks, dense}}})
       
   385   table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {leaks, "Pfew! That was close!", SAY_SAY, 3000}})
       
   386   table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {leaks, "Where did you get the exploding apples and the magic bow that shoots many arrows?", SAY_SAY, 9000}})
       
   387   table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {dense, "Uhm...I met one of them and took his weapons.", SAY_SAY, 5000}})
       
   388   table.insert(acceptedSurvivedFinalAnim, {func = AnimSay, args = {dense, "We should head back to the village now.", SAY_SAY, 5000}})
       
   389 
   415 
   390   table.insert(acceptedDiedFinalAnim, {func = AnimSay, args = {leaks, "Pfew! That was close!", SAY_THINK, 3000}})
   416   table.insert(acceptedDiedFinalAnim, {func = AnimSay, args = {leaks, "Pfew! That was close!", SAY_THINK, 3000}})
   391   table.insert(acceptedDiedFinalAnim, {func = AnimSay, args = {leaks, "Your death will not be in vain, Dense Cloud!", SAY_THINK, 5000}})
   417   table.insert(acceptedDiedFinalAnim, {func = AnimSay, args = {leaks, "Your death will not be in vain, Dense Cloud!", SAY_THINK, 5000}})
   392   table.insert(acceptedDiedFinalAnim, {func = AnimSay, args = {dense, "You will be avenged!", SAY_SAY, 3000}})
   418   table.insert(acceptedDiedFinalAnim, {func = AnimSay, args = {dense, "You will be avenged!", SAY_SAY, 3000}})
   393 
   419 
   426   table.insert(attackedAnim, {func = AnimDisappear, args = {cyborg, unpack(cyborgPos)}})
   452   table.insert(attackedAnim, {func = AnimDisappear, args = {cyborg, unpack(cyborgPos)}})
   427   table.insert(attackedAnim, {func = AnimGiveState, args = {cyborg, gstInvisible}})
   453   table.insert(attackedAnim, {func = AnimGiveState, args = {cyborg, gstInvisible}})
   428   table.insert(attackedAnim, {func = AnimSwitchHog, args = {leaks}})
   454   table.insert(attackedAnim, {func = AnimSwitchHog, args = {leaks}})
   429   table.insert(attackedAnim, {func = AnimSay, args = {leaks, "I wonder where Dense Cloud is...", SAY_THINK, 4000}})
   455   table.insert(attackedAnim, {func = AnimSay, args = {leaks, "I wonder where Dense Cloud is...", SAY_THINK, 4000}})
   430   table.insert(attackedAnim, {func = AnimSay, args = {leaks, "I can't wait any more, I have to save myself!", SAY_THINK, 5000}})
   456   table.insert(attackedAnim, {func = AnimSay, args = {leaks, "I can't wait any more, I have to save myself!", SAY_THINK, 5000}})
       
   457   table.insert(attackedAnim, {func = AnimCustomFunction, args = {leaks, SpawnCrates, {}}})
       
   458   table.insert(attackedAnim, {func = AnimWait, args = {leaks, 1500}})
       
   459   table.insert(attackedAnim, {func = AnimSay, args = {leaks, "Where are all these crates coming from?!", SAY_THINK, 5500}})
   431   AddSkipFunction(attackedAnim, SkipAttackedAnim, {})
   460   AddSkipFunction(attackedAnim, SkipAttackedAnim, {})
   432   
   461   
       
   462   table.insert(attackedFinalAnim, {func = AnimWait, args = {leaks, 2000}})
   433   table.insert(attackedFinalAnim, {func = AnimSay, args = {leaks, "I have to get back to the village!", SAY_THINK, 5000}})
   463   table.insert(attackedFinalAnim, {func = AnimSay, args = {leaks, "I have to get back to the village!", SAY_THINK, 5000}})
   434   table.insert(attackedFinalAnim, {func = AnimSay, args = {leaks, "Dense Cloud must have already told them everything...", SAY_THINK, 7000}})
   464   table.insert(attackedFinalAnim, {func = AnimSay, args = {leaks, "Dense Cloud must have already told them everything...", SAY_THINK, 7000}})
   435 
   465 
   436 end
   466 end
   437 
   467 
   454   SetGearMessage(ramon, 0)
   484   SetGearMessage(ramon, 0)
   455   SetGearMessage(spiky, 0)
   485   SetGearMessage(spiky, 0)
   456 end
   486 end
   457 
   487 
   458 function AddHogs()
   488 function AddHogs()
   459 	AddTeam("Natives", 1117585, "Bone", "Island", "HillBilly", "cm_birdy")
   489 	AddTeam("Natives", 2567585, "Bone", "Island", "HillBilly", "cm_birdy")
   460   ramon = AddHog("Ramon", 0, 100, "rasta")
   490   ramon = AddHog("Ramon", 0, 100, "rasta")
   461 	leaks = AddHog("Leaks A Lot", 0, 100, "Rambo")
   491 	leaks = AddHog("Leaks A Lot", 0, 100, "Rambo")
   462   dense = AddHog("Dense Cloud", 0, 100, "RobinHood")
   492   dense = AddHog("Dense Cloud", 0, 100, "RobinHood")
   463   spiky = AddHog("Spiky Cheese", 0, 100, "hair_yellow")
   493   spiky = AddHog("Spiky Cheese", 0, 100, "hair_yellow")
   464 
   494 
   603 function DoWeaklingsKilled()
   633 function DoWeaklingsKilled()
   604   TurnTimeLeft = 0
   634   TurnTimeLeft = 0
   605   AddAnim(stronglingsAnim)
   635   AddAnim(stronglingsAnim)
   606   AddFunction({func = AfterStronglingsAnim, args = {}})
   636   AddFunction({func = AfterStronglingsAnim, args = {}})
   607   stage = interWeakStage
   637   stage = interWeakStage
       
   638   ParseCommand("teamgone Weaklings")
   608 end
   639 end
   609 
   640 
   610 function CheckRefuse()
   641 function CheckRefuse()
   611   return GetX(dense) > 1400 and StoppedGear(dense)
   642   return GetX(dense) > 1400 and StoppedGear(dense)
   612 end
   643 end
   683 function DoStronglingsDead()
   714 function DoStronglingsDead()
   684   if denseDead == true then
   715   if denseDead == true then
   685     AddAnim(acceptedDiedFinalAnim)
   716     AddAnim(acceptedDiedFinalAnim)
   686     SaveCampaignVar("M2DenseDead", "1")
   717     SaveCampaignVar("M2DenseDead", "1")
   687   else
   718   else
       
   719     SetupAcceptedSurvivedFinalAnim()
   688     AddAnim(acceptedSurvivedFinalAnim)
   720     AddAnim(acceptedSurvivedFinalAnim)
   689     SaveCampaignVar("M2DenseDead", "0")
   721     SaveCampaignVar("M2DenseDead", "0")
   690   end
   722   end
   691   SaveCampaignVar("M2RamonDead", "0")
   723   SaveCampaignVar("M2RamonDead", "0")
   692   SaveCampaignVar("M2SpikyDead", "0")
   724   SaveCampaignVar("M2SpikyDead", "0")
   719 
   751 
   720 function DoStronglingsDeadAttacked()
   752 function DoStronglingsDeadAttacked()
   721   SaveCampaignVar("M2DenseDead", "1")
   753   SaveCampaignVar("M2DenseDead", "1")
   722   SaveCampaignVar("M2RamonDead", "0")
   754   SaveCampaignVar("M2RamonDead", "0")
   723   SaveCampaignVar("M2SpikyDead", "0")
   755   SaveCampaignVar("M2SpikyDead", "0")
       
   756   SaveCampaignVar("Progress", "2")
       
   757   SaveCampaignVar("M2Choice", "" .. choice)
   724   AddAnim(attackedFinalAnim)
   758   AddAnim(attackedFinalAnim)
   725   AddFunction({func = KillCyborg, args = {}})
   759   AddFunction({func = KillCyborg, args = {}})
   726   SaveCampaignVar("Progress", "2")
       
   727   SaveCampaignVar("M2Choice", "" .. choice)
       
   728 end
   760 end
   729 
   761 
   730 function CheckStronglingsDead()
   762 function CheckStronglingsDead()
   731   if leaksDead == true then
   763   if leaksDead == true then
   732     return false
   764     return false
   825     end
   857     end
   826   end
   858   end
   827 end
   859 end
   828 
   860 
   829 function onGearAdd(gear)
   861 function onGearAdd(gear)
       
   862   if GetGearType(gear) == gtGrenade and GetHogTeamName(CurrentHedgehog) == "Natives" then
       
   863     grenadeUsed = true
       
   864   elseif GetGearType(gear) == gtShotgunShot and GetHogTeamName(CurrentHedgehog) == "Natives" then
       
   865     shotgunUsed = true
       
   866   end
   830 end
   867 end
   831 
   868 
   832 function onAmmoStoreInit()
   869 function onAmmoStoreInit()
   833   SetAmmo(amDEagle, 9, 0, 0, 0)
   870   SetAmmo(amDEagle, 9, 0, 0, 0)
   834   SetAmmo(amSniperRifle, 9, 0, 0, 0)
   871   SetAmmo(amSniperRifle, 9, 0, 0, 0)