share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/family.lua
changeset 7675 58620e9e5ed5
parent 7520 dd0b68bbe456
child 8043 da083f8d95e6
equal deleted inserted replaced
7673:e06b83cbde74 7675:58620e9e5ed5
   184   HideHedge(cyborg)
   184   HideHedge(cyborg)
   185   SetupPlace3()
   185   SetupPlace3()
   186   SetGearMessage(natives[1], 0)
   186   SetGearMessage(natives[1], 0)
   187   AddNewEvent(CheckPrincessFreed, {}, DoPrincessFreed, {}, 0)
   187   AddNewEvent(CheckPrincessFreed, {}, DoPrincessFreed, {}, 0)
   188   TurnTimeLeft = 0
   188   TurnTimeLeft = 0
   189   ShowMission(loc("Family Reunion"), loc("Salvation"), loc("Get your teammates out of their natural prison and save the princess!|Hint: Drilling holes should solve everything.|Hint: All your hedgehogs need to be above the marked height!|Hint: Leaks A Lot needs to get really close to the princess!"), 1, 7000)
   189   ShowMission(loc("Family Reunion"), loc("Salvation"), loc("Get your teammates out of their natural prison and save the princess!|Hint: Drilling holes should solve everything.|Hint: It might be a good idea to place a girder before starting to drill. Just saying.|Hint: All your hedgehogs need to be above the marked height!|Hint: Leaks A Lot needs to get really close to the princess!"), 1, 7000)
   190   vCirc = AddVisualGear(0,0,vgtCircle,0,true)
   190   vCirc = AddVisualGear(0,0,vgtCircle,0,true)
   191   SetVisualGearValues(vCirc, 2625, 1500, 100, 255, 1, 10, 0, 120, 3, 0xff00ffff)
   191   SetVisualGearValues(vCirc, 2625, 1500, 100, 255, 1, 10, 0, 120, 3, 0xff00ffff)
   192 end
   192 end
   193   
   193   
   194 function SkipMidAnim()
   194 function SkipMidAnim()
   197 end
   197 end
   198 
   198 
   199 function SetupPlace3()
   199 function SetupPlace3()
   200   SpawnUtilityCrate(2086, 1887, amRope, 1)
   200   SpawnUtilityCrate(2086, 1887, amRope, 1)
   201   SpawnUtilityCrate(2147, 728, amBlowTorch, 2)
   201   SpawnUtilityCrate(2147, 728, amBlowTorch, 2)
   202   SpawnUtilityCrate(2778, 1372, amPickHammer, 2)
   202   SpawnUtilityCrate(2778, 1372, amPickHammer, 3)
   203   SpawnUtilityCrate(2579, 1886, amPickHammer, 2)
   203   SpawnUtilityCrate(2579, 1886, amPickHammer, 3)
   204   SpawnUtilityCrate(2622, 1893, amGirder, 1)
   204   SpawnUtilityCrate(2622, 1893, amGirder, 1)
   205   SpawnUtilityCrate(2671, 1883, amPortalGun, 3)
   205   SpawnUtilityCrate(2671, 1883, amPortalGun, 3)
   206   SpawnUtilityCrate(2831, 1384, amGirder, 3)
   206   SpawnUtilityCrate(2831, 1384, amGirder, 3)
   207 
   207 
   208   SetTimer(AddGear(2725, 1387, gtMine, 0, 0, 0, 0), 5000)
   208   SetTimer(AddGear(2725, 1387, gtMine, 0, 0, 0, 0), 5000)
   273 	SpawnUtilityCrate(530, 1747, amPortalGun, 1)
   273 	SpawnUtilityCrate(530, 1747, amPortalGun, 1)
   274 end
   274 end
   275 
   275 
   276 -----------------------------Events------------------------------------
   276 -----------------------------Events------------------------------------
   277 function CheckPrincessFreed()
   277 function CheckPrincessFreed()
       
   278   if GetX(natives[1]) == nil or GetX(natives[2]) == nil or GetX(natives[3]) == nil or GetX(princess) == nil then
       
   279     return false
       
   280   end
   278   return math.abs(GetX(natives[1]) - GetX(princess)) <= 15 and math.abs(GetY(natives[1]) - GetY(princess)) <= 15 and StoppedGear(natives[1]) 
   281   return math.abs(GetX(natives[1]) - GetX(princess)) <= 15 and math.abs(GetY(natives[1]) - GetY(princess)) <= 15 and StoppedGear(natives[1]) 
   279         and GetY(natives[2]) < 1500 and GetY(natives[3]) < 1500 and StoppedGear(natives[2]) and StoppedGear(natives[3])
   282         and GetY(natives[2]) < 1500 and GetY(natives[3]) < 1500 and StoppedGear(natives[2]) and StoppedGear(natives[3])
   280 end
   283 end
   281 
   284 
   282 function DoPrincessFreed()
   285 function DoPrincessFreed()
   346 function CheckOutOfGrenade()
   349 function CheckOutOfGrenade()
   347   return CheckGearDead(grenadeCrate1) and CheckGearDead(grenadeCrate2) and GetAmmoCount(natives[1], amGrenade) == 0
   350   return CheckGearDead(grenadeCrate1) and CheckGearDead(grenadeCrate2) and GetAmmoCount(natives[1], amGrenade) == 0
   348 end
   351 end
   349 
   352 
   350 function DoOutOfCluster()
   353 function DoOutOfCluster()
       
   354   if (GetX(natives[1]) == nil) then
       
   355     return
       
   356   end
   351   clusterCrate = SpawnAmmoCrate(GetX(natives[1]) - 50, GetY(natives[1]) - 50, amClusterBomb, 3)
   357   clusterCrate = SpawnAmmoCrate(GetX(natives[1]) - 50, GetY(natives[1]) - 50, amClusterBomb, 3)
   352 end
   358 end
   353 
   359 
   354 function DoOutOfGrenade()
   360 function DoOutOfGrenade()
       
   361   if (GetX(natives[1]) == nil) then
       
   362     return
       
   363   end
   355   grenadeCrate2 = SpawnAmmoCrate(GetX(natives[1]) - 50, GetY(natives[1]) - 50, amGrenade, 3)
   364   grenadeCrate2 = SpawnAmmoCrate(GetX(natives[1]) - 50, GetY(natives[1]) - 50, amGrenade, 3)
   356 end
   365 end
   357 
   366 
   358 function CheckNeedToHide()
   367 function CheckNeedToHide()
   359   if gearDead[princess] == true then
   368   if gearDead[princess] == true then
   402   AddAmmo(cyborgs[1], amClusterBomb, 100)
   411   AddAmmo(cyborgs[1], amClusterBomb, 100)
   403   AddAmmo(cyborgs[1], amSniperRifle, 1)
   412   AddAmmo(cyborgs[1], amSniperRifle, 1)
   404   AddAmmo(cyborgs[1], amDynamite, 100)
   413   AddAmmo(cyborgs[1], amDynamite, 100)
   405   AddAmmo(cyborgs[1], amBaseballBat, 100)
   414   AddAmmo(cyborgs[1], amBaseballBat, 100)
   406   AddAmmo(cyborgs[1], amMolotov, 100)
   415   AddAmmo(cyborgs[1], amMolotov, 100)
       
   416   AddAmmo(cyborgs[1], amWatermelon, 1)
       
   417   AddAmmo(cyborgs[1], amAirStrike, 2)
       
   418   AddAmmo(cyborgs[1], amDrillStrike, 1)
   407 end
   419 end
   408 
   420 
   409 function AddHogs()
   421 function AddHogs()
   410 	AddTeam(loc("Natives"), 29439, "Bone", "Island", "HillBilly", "cm_birdy")
   422 	AddTeam(loc("Natives"), 29439, "Bone", "Island", "HillBilly", "cm_birdy")
   411   for i = 7, 9 do
   423   for i = 7, 9 do
   440   end
   452   end
   441 end
   453 end
   442 
   454 
   443 function CondNeedToTurn(hog1, hog2)
   455 function CondNeedToTurn(hog1, hog2)
   444   xl, xd = GetX(hog1), GetX(hog2)
   456   xl, xd = GetX(hog1), GetX(hog2)
       
   457   if xl == nil or xd == nil then
       
   458     return
       
   459   end
   445   if xl > xd then
   460   if xl > xd then
   446     AnimInsertStepNext({func = AnimTurn, args = {hog1, "Left"}})
   461     AnimInsertStepNext({func = AnimTurn, args = {hog1, "Left"}})
   447     AnimInsertStepNext({func = AnimTurn, args = {hog2, "Right"}})
   462     AnimInsertStepNext({func = AnimTurn, args = {hog2, "Right"}})
   448   elseif xl < xd then
   463   elseif xl < xd then
   449     AnimInsertStepNext({func = AnimTurn, args = {hog2, "Left"}})
   464     AnimInsertStepNext({func = AnimTurn, args = {hog2, "Left"}})