share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua
branchspacecampaign
changeset 9574 da3d39667881
parent 9572 278cff2a965f
child 9578 16139270448f
equal deleted inserted replaced
9572:278cff2a965f 9574:da3d39667881
    16 HedgewarsScriptLoad("/Scripts/Locale.lua")
    16 HedgewarsScriptLoad("/Scripts/Locale.lua")
    17 HedgewarsScriptLoad("/Scripts/Animate.lua")
    17 HedgewarsScriptLoad("/Scripts/Animate.lua")
    18 
    18 
    19 ----------------- VARIABLES --------------------
    19 ----------------- VARIABLES --------------------
    20 -- globals
    20 -- globals
    21 local campaignName = loc("A Space Adventure")
    21 local missionName = loc("Spacetrip")
    22 local missionName = loc("Cosmos")
       
    23 local timeForGuard1ToTurn = 1000 * 5 -- 5 sec
    22 local timeForGuard1ToTurn = 1000 * 5 -- 5 sec
    24 local timeForGuard1ToTurnLeft = timeForGuard1ToTurn
    23 local timeForGuard1ToTurnLeft = timeForGuard1ToTurn
    25 local saucerAcquired = false
    24 local saucerAcquired = false
    26 local checkPointReached = 1 -- 1 is start of the game
    25 local checkPointReached = 1 -- 1 is start of the game
    27 -- dialogs
    26 -- dialogs
    31 local dialog04 = {}
    30 local dialog04 = {}
    32 local dialog05 = {}
    31 local dialog05 = {}
    33 local dialog06 = {}
    32 local dialog06 = {}
    34 -- mission objectives
    33 -- mission objectives
    35 local goals = {
    34 local goals = {
    36 	[dialog01] = {missionName, loc("Getting ready"), loc("Go and collect the crate on top of the column").."|"..loc("Use the sleep gas bomb if the guards spot you!"), 1, 4500},
    35 	[dialog01] = {missionName, loc("Getting ready"), loc("Go and collect the crate").."|"..loc("Try not to get spotted by the guards!"), 1, 4500},
    37 	[dialog02] = {missionName, loc("The adventure begins!"), loc("Use the saucer and fly to the moon").."|"..loc("Drive carefully as your fuels are limited"), 1, 4500},
    36 	[dialog02] = {missionName, loc("The adventure begins!"), loc("Use the saucer and fly to the moon").."|"..loc("Travel carefully as your fuels are limited"), 1, 4500},
    38 	[dialog03] = {missionName, loc("An unexpected event!"), loc("Use the saucer and fly away or use the gas bomb to neutralize the guards").."|"..loc("Beware, any damage taken will stay until you take some medicine or visit moon"), 1, 7000}
    37 	[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 mission"), 1, 7000}
    39 }
    38 }
    40 -- crates
    39 -- crates
    41 local saucerX = 3270
    40 local saucerX = 3270
    42 local saucerY = 1500
    41 local saucerY = 1500
    43 -- hogs
    42 -- hogs
   139 function onGameStart()
   138 function onGameStart()
   140 	-- wait for the first turn to start
   139 	-- wait for the first turn to start
   141 	AnimWait(hero.gear, 3000)
   140 	AnimWait(hero.gear, 3000)
   142 
   141 
   143 	FollowGear(hero.gear)
   142 	FollowGear(hero.gear)
   144 	ShowMission(loc("A Space Adventure"), loc("Cosmos"), loc("Help Hog Solo to find all the parts of the anti-gravity device.")..
   143 	ShowMission(loc("Spacetrip"), loc("Getting ready"), loc("Help Hog Solo to find all the parts of the anti-gravity device.")..
   145 	"|"..loc("Travel to all the neighbor planets and collect all the pieces"), -amSkip, 0)
   144 	"|"..loc("Travel to all the neighbor planets and collect all the pieces"), -amSkip, 0)
   146 	
   145 	
   147 	-- do checkpoint stuff needed after game starts
   146 	-- do checkpoint stuff needed after game starts
   148 	if checkPointReached == 1 then	
   147 	if checkPointReached == 1 then	
   149 		AddAnim(dialog01)
   148 		AddAnim(dialog01)
   304 end
   303 end
   305 
   304 
   306 -------------- OUTCOMES ------------------
   305 -------------- OUTCOMES ------------------
   307 
   306 
   308 function heroBeforeTreePosition(gear)
   307 function heroBeforeTreePosition(gear)
   309 	AnimSay(gear,loc("Now I have to climb the trees"), SAY_SAY, 4000)
   308 	AnimSay(gear,loc("Now I have to climb these trees"), SAY_SAY, 4000)
   310 	AnimCaption(hero.gear, loc("Use the rope to get to the crate"),  4000)
   309 	AnimCaption(hero.gear, loc("Use the rope to get to the crate"),  4000)
   311 end
   310 end
   312 
   311 
   313 function heroAtSaucerPosition(gear)
   312 function heroAtSaucerPosition(gear)
   314 	TurnTimeLeft = 0
   313 	TurnTimeLeft = 0
   342 
   341 
   343 function fruitPlanetLanding(gear)
   342 function fruitPlanetLanding(gear)
   344 	if checkPointReached < 5 then
   343 	if checkPointReached < 5 then
   345 		AddAnim(dialog06)
   344 		AddAnim(dialog06)
   346 	else		
   345 	else		
   347 		AnimCaption(hero.gear,loc("Welcome to the fruit planet!"))
   346 		AnimCaption(hero.gear,loc("Welcome to the Fruit Planet!"))
   348 		SaveCampaignVar("Planet", "fruitPlanet")
   347 		SaveCampaignVar("Planet", "fruitPlanet")
   349 		SaveCampaignVar("UnlockedMissions", "2")
   348 		SaveCampaignVar("UnlockedMissions", "2")
   350 		SaveCampaignVar("Mission1", "3")
   349 		SaveCampaignVar("Mission1", "3")
   351 		SaveCampaignVar("Mission2", "1")
   350 		SaveCampaignVar("Mission2", "1")
   352 		EndGame()
   351 		EndGame()
   355 
   354 
   356 function desertPlanetLanding(gear)
   355 function desertPlanetLanding(gear)
   357 	if checkPointReached < 5 then
   356 	if checkPointReached < 5 then
   358 		AddAnim(dialog06)
   357 		AddAnim(dialog06)
   359 	else		
   358 	else		
   360 		AnimCaption(hero.gear,loc("Welcome to the desert planet!"))
   359 		AnimCaption(hero.gear,loc("Welcome to the Desert Planet!"))
   361 		SaveCampaignVar("Planet", "desertPlanet")
   360 		SaveCampaignVar("Planet", "desertPlanet")
   362 		SaveCampaignVar("UnlockedMissions", "3")
   361 		SaveCampaignVar("UnlockedMissions", "3")
   363 		SaveCampaignVar("Mission1", "4")
   362 		SaveCampaignVar("Mission1", "4")
   364 		SaveCampaignVar("Mission2", "7")
   363 		SaveCampaignVar("Mission2", "7")
   365 		SaveCampaignVar("Mission3", "1")
   364 		SaveCampaignVar("Mission3", "1")
   369 
   368 
   370 function icePlanetLanding(gear)
   369 function icePlanetLanding(gear)
   371 	if checkPointReached < 5 then
   370 	if checkPointReached < 5 then
   372 		AddAnim(dialog06)
   371 		AddAnim(dialog06)
   373 	else
   372 	else
   374 		AnimCaption(hero.gear,loc("Welcome to the planet of ice!"))
   373 		AnimCaption(hero.gear,loc("Welcome to the Planet of Ice!"))
   375 		SaveCampaignVar("Planet", "icePlanet")
   374 		SaveCampaignVar("Planet", "icePlanet")
   376 		SaveCampaignVar("UnlockedMissions", "3")
   375 		SaveCampaignVar("UnlockedMissions", "3")
   377 		SaveCampaignVar("Mission1", "5")
   376 		SaveCampaignVar("Mission1", "5")
   378 		SaveCampaignVar("Mission2", "6")
   377 		SaveCampaignVar("Mission2", "6")
   379 		SaveCampaignVar("Mission3", "1")
   378 		SaveCampaignVar("Mission3", "1")
   419 
   418 
   420 function AnimationSetup()
   419 function AnimationSetup()
   421 	-- DIALOG 01 - Start
   420 	-- DIALOG 01 - Start
   422 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   421 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   423 	table.insert(dialog01, {func = AnimWait, args = {doctor.gear, 3000}})
   422 	table.insert(dialog01, {func = AnimWait, args = {doctor.gear, 3000}})
   424 	--table.insert(dialog01, {func = AnimWait, args = {hero.gear, 2500}, skipFunc = Skipanim, skipArgs = dialog01})
   423 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Near secret base 17 of PAotH in the rural Hogland..."),  4000}})
   425 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Near secret base 17 of PAoTH in the rural Hogland..."),  4000}})
       
   426 	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("So Hog Solo, here we are..."), SAY_SAY, 2000}})
   424 	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("So Hog Solo, here we are..."), SAY_SAY, 2000}})
   427 	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("Behind these trees on the East there is secret base 17"), SAY_SAY, 4000}})
   425 	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("Behind these trees on the East there is secret base 17"), SAY_SAY, 4000}})
   428 	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("You have to continue alone from now on."), SAY_SAY, 3000}})
   426 	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("You have to continue alone from now on."), SAY_SAY, 3000}})
   429 	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("Be careful, the future of Hogera is in your hands!"), SAY_SAY, 7200}})
   427 	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("Be careful, the future of Hogera is in your hands!"), SAY_SAY, 7200}})
   430 	table.insert(dialog01, {func = AnimSay, args = {doctor.gear, loc("We'll use our communicators to contact you"), SAY_SAY, 2600}})
   428 	table.insert(dialog01, {func = AnimSay, args = {doctor.gear, loc("We'll use our communicators to contact you"), SAY_SAY, 2600}})
   431 	table.insert(dialog01, {func = AnimSay, args = {doctor.gear, loc("In am also entrusting you with a rope and a sleep gas bomb"), SAY_SAY, 5000}})
   429 	table.insert(dialog01, {func = AnimSay, args = {doctor.gear, loc("In am also entrusting you with some rope"), SAY_SAY, 5000}})
   432 	table.insert(dialog01, {func = AnimSay, args = {doctor.gear, loc("You may find them handy"), SAY_SAY, 2300}})
   430 	table.insert(dialog01, {func = AnimSay, args = {doctor.gear, loc("You may find it handy"), SAY_SAY, 2300}})
   433 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Thank you Dr.Cornelius"), SAY_SAY, 1600}})
   431 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Thank you Dr.Cornelius"), SAY_SAY, 1600}})
   434 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("I'll make good use of them"), SAY_SAY, 4500}})
   432 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("I'll make good use of it"), SAY_SAY, 4500}})
   435 	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("It would be wiser to steal the space ship while PAoTH guards are taking a brake!"), SAY_SAY, 7000}})
   433 	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("It would be wiser to steal the space ship while PAotH guards are taking a brake!"), SAY_SAY, 7000}})
   436 	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("Remember! Many will seek the anti-gravity device! Now go, hurry up!"), SAY_SAY, 4000}})
   434 	table.insert(dialog01, {func = AnimSay, args = {director.gear, loc("Remember! Many will seek the anti-gravity device! Now go, hurry up!"), SAY_SAY, 4000}})
   437 	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
   435 	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
   438 	-- DIALOG 02 - Hero got the saucer
   436 	-- DIALOG 02 - Hero got the saucer
   439 	AddSkipFunction(dialog02, Skipanim, {dialog02})
   437 	AddSkipFunction(dialog02, Skipanim, {dialog02})
   440 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 500}})
   438 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 500}})
   441 	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("CheckPoint reached!"),  4000}})
   439 	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("CheckPoint reached!"),  4000}})
   442 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("Got the saucer!"), SAY_SHOUT, 2000}})
   440 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("Got the saucer!"), SAY_SHOUT, 2000}})
   443 	table.insert(dialog02, {func = AnimSay, args = {director.gear, loc("Nice!"), SAY_SHOUT, 1000}})
   441 	table.insert(dialog02, {func = AnimSay, args = {director.gear, loc("Nice!"), SAY_SHOUT, 1000}})
   444 	table.insert(dialog02, {func = AnimSay, args = {director.gear, loc("Now use it and go to the moon PAoTH station to get more fuels!"), SAY_SHOUT, 5000}})
   442 	table.insert(dialog02, {func = AnimSay, args = {director.gear, loc("Now use it and go to the moon PAotH station to get more fuels!"), SAY_SHOUT, 5000}})
   445     table.insert(dialog02, {func = AnimGearWait, args = {hero.gear, 500}})
   443     table.insert(dialog02, {func = AnimGearWait, args = {hero.gear, 500}})
   446     -- DIALOG 03 - Hero got spotted by guard
   444     -- DIALOG 03 - Hero got spotted by guard
   447 	AddSkipFunction(dialog03, Skipanim, {dialog03})
   445 	AddSkipFunction(dialog03, Skipanim, {dialog03})
   448 	table.insert(dialog03, {func = AnimWait, args = {guard1.gear, 4000}})
   446 	table.insert(dialog03, {func = AnimWait, args = {guard1.gear, 4000}})
   449 	table.insert(dialog03, {func = AnimCaption, args = {guard1.gear, loc("Prepare to battle or flee!"),  4000}})	
   447 	table.insert(dialog03, {func = AnimCaption, args = {guard1.gear, loc("Prepare to flee!"),  4000}})	
   450 	table.insert(dialog03, {func = AnimSay, args = {guard1.gear, loc("Hey").." "..guard2.name.."! "..loc("Look, someone is stealing the saucer!"), SAY_SHOUT, 4000}})
   448 	table.insert(dialog03, {func = AnimSay, args = {guard1.gear, loc("Hey").." "..guard2.name.."! "..loc("Look, someone is stealing the saucer!"), SAY_SHOUT, 4000}})
   451 	table.insert(dialog03, {func = AnimSay, args = {guard2.gear, loc("I'll get him!"), SAY_SAY, 4000}})
   449 	table.insert(dialog03, {func = AnimSay, args = {guard2.gear, loc("I'll get him!"), SAY_SAY, 4000}})
   452 	table.insert(dialog03, {func = startCombat, args = {guard1.gear}})
   450 	table.insert(dialog03, {func = startCombat, args = {guard1.gear}})
   453 	-- DIALOG 04 - Hero out of sight
   451 	-- DIALOG 04 - Hero out of sight
   454 	AddSkipFunction(dialog04, Skipanim, {dialog04})
   452 	AddSkipFunction(dialog04, Skipanim, {dialog04})