share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua
changeset 12558 0116cfdf9074
parent 12557 b745e322a366
child 12559 199971225506
equal deleted inserted replaced
12557:b745e322a366 12558:0116cfdf9074
    38 	[dialog02] = {missionName, loc("The adventure begins!"), loc("Use the saucer and fly to the moon").."|"..loc("Travel carefully as your fuel is limited"), 1, 4500},
    38 	[dialog02] = {missionName, loc("The adventure begins!"), loc("Use the saucer and fly to the moon").."|"..loc("Travel carefully as your fuel is limited"), 1, 4500},
    39 	[dialog03] = {missionName, loc("An unexpected event!"), loc("Use the saucer and fly away").."|"..loc("Beware, any damage taken will stay until you complete the moon's main mission"), 1, 7000},
    39 	[dialog03] = {missionName, loc("An unexpected event!"), loc("Use the saucer and fly away").."|"..loc("Beware, any damage taken will stay until you complete the moon's main mission"), 1, 7000},
    40 	[dialog07] = {missionName, loc("Searching the stars!"), loc("Use the saucer and fly away").."|"..loc("Visit the planets of Ice, Desert and Fruit before you proceed to the Death Planet"), 1, 6000},
    40 	[dialog07] = {missionName, loc("Searching the stars!"), loc("Use the saucer and fly away").."|"..loc("Visit the planets of Ice, Desert and Fruit before you proceed to the Death Planet"), 1, 6000},
    41 	[dialog08] = {missionName, loc("Saving Hogera"), loc("Fly to the meteorite and detonate the explosives"), 1, 7000}
    41 	[dialog08] = {missionName, loc("Saving Hogera"), loc("Fly to the meteorite and detonate the explosives"), 1, 7000}
    42 }
    42 }
    43 goals[dialog04] = goals[dialog02]
       
    44 -- crates
    43 -- crates
    45 local saucerX = 3270
    44 local saucerX = 3270
    46 local saucerY = 1500
    45 local saucerY = 1500
    47 -- hogs
    46 -- hogs
    48 local hero = {}
    47 local hero = {}
   183 		AddAmmo(guard1.gear, amDEagle, 100)
   182 		AddAmmo(guard1.gear, amDEagle, 100)
   184 		AddAmmo(guard2.gear, amDEagle, 100)
   183 		AddAmmo(guard2.gear, amDEagle, 100)
   185 		SpawnUtilityCrate(saucerX, saucerY, amJetpack)
   184 		SpawnUtilityCrate(saucerX, saucerY, amJetpack)
   186 		-- EVENT HANDLERS
   185 		-- EVENT HANDLERS
   187 		AddEvent(onHeroBeforeTreePosition, {hero.gear}, heroBeforeTreePosition, {hero.gear}, 0)
   186 		AddEvent(onHeroBeforeTreePosition, {hero.gear}, heroBeforeTreePosition, {hero.gear}, 0)
   188 		AddEvent(onHeroAcquiredSaucer, {hero.gear}, heroAcquiredSaucer, {hero.gear}, 0)
   187 		AddEvent(onHeroAcquiredSaucer, {hero.gear}, heroAcquiredSaucer, {hero.gear}, 1)
   189 		AddEvent(onHeroOutOfGuardSight, {hero.gear}, heroOutOfGuardSight, {hero.gear}, 0)
   188 		AddEvent(onHeroOutOfGuardSight, {hero.gear}, heroOutOfGuardSight, {hero.gear}, 0)
   190 	elseif checkPointReached == 2 then
   189 	elseif checkPointReached == 2 then
   191 		AddAmmo(hero.gear, amJetpack, 1)
   190 		AddAmmo(hero.gear, amJetpack, 1)
   192 		AddAnim(dialog02)
   191 		AddAnim(dialog02)
   193 	elseif checkPointReached == 3 then
   192 	elseif checkPointReached == 3 then
   387 	AnimCaption(hero.gear, loc("Use the rope to get to the crate"),  4000)
   386 	AnimCaption(hero.gear, loc("Use the rope to get to the crate"),  4000)
   388 end
   387 end
   389 
   388 
   390 function prepareDialog02(gear)
   389 function prepareDialog02(gear)
   391 	if StoppedGear(gear) and guard1.keepTurning and checkPointReached < 2 then
   390 	if StoppedGear(gear) and guard1.keepTurning and checkPointReached < 2 then
   392 		SetGearMessage(hero.gear, 0)
   391 		SetGearMessage(gear, 0)
   393 		EndTurn(true)
   392 		EndTurn(true)
   394 		-- save check point
   393 		-- save check point
   395 		SaveCampaignVar("CosmosCheckPoint", "2")
   394 		SaveCampaignVar("CosmosCheckPoint", "2")
   396 		checkPointReached = 2
   395 		checkPointReached = 2
   397 		AddAnim(dialog02)
   396 		AddAnim(dialog02)
       
   397 
       
   398 		RemoveEventFunc(onHeroAcquiredSaucer)
   398 	end
   399 	end
   399 end
   400 end
   400 
   401 
   401 function heroAcquiredSaucer(gear)
   402 function heroAcquiredSaucer(gear)
   402 	-- check if he was spotted by the guard
   403 	-- check if he was spotted by the guard
   403 	if guard1.turn and guard1.keepTurning and GetX(hero.gear) > saucerX-150 then
   404 	if guard1.turn and guard1.keepTurning and GetX(gear) > saucerX-150 then
   404 		guard1.keepTurning = false
   405 		guard1.keepTurning = false
   405 		SetGearVelocity(gear, 0, 0)
   406 		SetGearVelocity(gear, 0, 0)
   406 		AddAnim(dialog03)
   407 		AddAnim(dialog03)
   407 	end
   408 	end
   408 
   409 
   620 	table.insert(dialog02, {func = AnimSay, args = {director.gear, loc("Now use it and go to the moon PAotH station to get more fuel!"), SAY_SHOUT, 5000}})
   621 	table.insert(dialog02, {func = AnimSay, args = {director.gear, loc("Now use it and go to the moon PAotH station to get more fuel!"), SAY_SHOUT, 5000}})
   621 	table.insert(dialog02, {func = AnimGearWait, args = {hero.gear, 500}})
   622 	table.insert(dialog02, {func = AnimGearWait, args = {hero.gear, 500}})
   622 	table.insert(dialog02, {func = ShowMission, args = goals[dialog02]})
   623 	table.insert(dialog02, {func = ShowMission, args = goals[dialog02]})
   623 	-- DIALOG 03 - Hero got spotted by guard
   624 	-- DIALOG 03 - Hero got spotted by guard
   624 	AddSkipFunction(dialog03, Skipanim, {dialog03})
   625 	AddSkipFunction(dialog03, Skipanim, {dialog03})
   625 	table.insert(dialog03, {func = AnimWait, args = {guard1.gear, 500}})
       
   626 	table.insert(dialog03, {func = AnimCaption, args = {guard1.gear, loc("Prepare to flee!"), 1000}})
       
   627 	table.insert(dialog03, {func = AnimSay, args = {guard1.gear, string.format(loc("Hey, %s! Look, someone is stealing the saucer!"), guard2.name), SAY_SHOUT, 4000}})
   626 	table.insert(dialog03, {func = AnimSay, args = {guard1.gear, string.format(loc("Hey, %s! Look, someone is stealing the saucer!"), guard2.name), SAY_SHOUT, 4000}})
   628 	table.insert(dialog03, {func = AnimSay, args = {guard2.gear, loc("I'll get him!"), SAY_SAY, 4000}})
   627 	table.insert(dialog03, {func = AnimSay, args = {guard2.gear, loc("I'll get him!"), SAY_SAY, 4000}})
       
   628 	table.insert(dialog03, {func = AnimCaption, args = {guard1.gear, loc("Prepare to flee!"), 1000}})
   629 	table.insert(dialog03, {func = startCombat, args = {guard1.gear}})
   629 	table.insert(dialog03, {func = startCombat, args = {guard1.gear}})
   630 	table.insert(dialog03, {func = ShowMission, args = goals[dialog03]})
   630 	table.insert(dialog03, {func = ShowMission, args = goals[dialog03]})
   631 	-- DIALOG 04 - Hero out of sight
   631 	-- DIALOG 04 - Hero out of sight
   632 	AddSkipFunction(dialog04, Skipanim, {dialog04})
   632 	AddSkipFunction(dialog04, Skipanim, {dialog04})
   633 	table.insert(dialog04, {func = AnimCaption, args = {guard1.gear, loc("You are out of danger, time to go to the moon!"),  4000}})
   633 	table.insert(dialog04, {func = AnimCaption, args = {guard1.gear, loc("You are out of danger, time to go to the moon!"),  4000}})
   634 	table.insert(dialog04, {func = AnimSay, args = {guard1.gear, loc("I guess we lost him!"), SAY_SAY, 3000}})
   634 	table.insert(dialog04, {func = AnimSay, args = {guard1.gear, loc("I guess we lost him!"), SAY_SAY, 3000}})
   635 	table.insert(dialog04, {func = AnimSay, args = {guard2.gear, loc("We should better report this and continue our watch!"), SAY_SAY, 5000}})
   635 	table.insert(dialog04, {func = AnimSay, args = {guard2.gear, loc("We should better report this and continue our watch!"), SAY_SAY, 5000}})
   636 	table.insert(dialog04, {func = AnimSwitchHog, args = {hero.gear}})
   636 	table.insert(dialog04, {func = AnimSwitchHog, args = {hero.gear}})
   637 	table.insert(dialog04, {func = ShowMission, args = goals[dialog03]})
       
   638 	-- DIALOG 05 - Hero returned from moon without fuels
   637 	-- DIALOG 05 - Hero returned from moon without fuels
   639 	AddSkipFunction(dialog05, Skipanim, {dialog05})
   638 	AddSkipFunction(dialog05, Skipanim, {dialog05})
   640 	table.insert(dialog05, {func = AnimSay, args = {hero.gear, loc("I guess I can't go far without fuel!"), SAY_THINK, 6000}})
   639 	table.insert(dialog05, {func = AnimSay, args = {hero.gear, loc("I guess I can't go far without fuel!"), SAY_THINK, 6000}})
   641 	if abandonedPlanetMission then
   640 	if abandonedPlanetMission then
   642 		-- Hog solo is mad he has to play the moon main mission from start. Very sarcastic tone. ;-)
   641 		-- Hog solo is mad he has to play the moon main mission from start. Very sarcastic tone. ;-)