share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert03.lua
changeset 9758 3b8058b251b8
parent 9642 8a691e0f117a
child 11692 68eddcdc9f26
equal deleted inserted replaced
9757:9be28be004d4 9758:3b8058b251b8
     7 HedgewarsScriptLoad("/Scripts/Animate.lua")
     7 HedgewarsScriptLoad("/Scripts/Animate.lua")
     8 HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
     8 HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
     9 
     9 
    10 -- globals
    10 -- globals
    11 local missionName = loc("Precise flying")
    11 local missionName = loc("Precise flying")
    12 local challengeObjectives = loc("Use the rc plane and destroy the all the targets").."|"..
    12 local challengeObjectives = loc("Use the RC plane and destroy the all the targets").."|"..
    13 	loc("Each time you destroy your level targets you'll get teleported to the next level").."|"..
    13 	loc("Each time you destroy all the targets on your current level you'll get teleported to the next level").."|"..
    14 	loc("You'll have only one rc plane at the start of the mission").."|"..
    14 	loc("You'll have only one RC plane at the start of the mission").."|"..
    15 	loc("During the game you can get new planes by getting the weapon crates")
    15 	loc("During the game you can get new RC planes by collecting the weapon crates")
    16 local currentTarget = 1
    16 local currentTarget = 1
    17 -- dialogs
    17 -- dialogs
    18 local dialog01 = {}
    18 local dialog01 = {}
    19 -- mission objectives
    19 -- mission objectives
    20 local goals = {
    20 local goals = {
    64 	MinesNum = 0
    64 	MinesNum = 0
    65 	MinesTime = 1
    65 	MinesTime = 1
    66 	Explosives = 0
    66 	Explosives = 0
    67 	Map = "desert03_map"
    67 	Map = "desert03_map"
    68 	Theme = "Desert"
    68 	Theme = "Desert"
    69 	
    69 
    70 	-- Hog Solo
    70 	-- Hog Solo
    71 	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
    71 	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
    72 	hero.gear = AddHog(hero.name, 0, 1, "war_desertgrenadier1")
    72 	hero.gear = AddHog(hero.name, 0, 1, "war_desertgrenadier1")
    73 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
    73 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
    74 	
    74 
    75 	initCheckpoint("desert03")
    75 	initCheckpoint("desert03")
    76 	
    76 
    77 	AnimInit()
    77 	AnimInit()
    78 	AnimationSetup()
    78 	AnimationSetup()
    79 end
    79 end
    80 
    80 
    81 function onGameStart()
    81 function onGameStart()
    87 	AddEvent(onLose, {hero.gear}, lose, {hero.gear}, 0)
    87 	AddEvent(onLose, {hero.gear}, lose, {hero.gear}, 0)
    88 
    88 
    89 	-- original crates and targets
    89 	-- original crates and targets
    90 	SpawnAmmoCrate(rcCrates[1].x, rcCrates[1].y, amRCPlane)
    90 	SpawnAmmoCrate(rcCrates[1].x, rcCrates[1].y, amRCPlane)
    91 	targets[1].gear = AddGear(targets[1].x, targets[1].y, gtTarget, 0, 0, 0, 0)
    91 	targets[1].gear = AddGear(targets[1].x, targets[1].y, gtTarget, 0, 0, 0, 0)
    92 	
    92 
    93 	-- hero ammo
    93 	-- hero ammo
    94 	AddAmmo(hero.gear, amRCPlane, 1)
    94 	AddAmmo(hero.gear, amRCPlane, 1)
    95 
    95 
    96 	SendHealthStatsOff()
    96 	SendHealthStatsOff()
    97 	AddAnim(dialog01)
    97 	AddAnim(dialog01)
   115 	SetAmmo(amRCPlane, 0, 0, 0, 1)
   115 	SetAmmo(amRCPlane, 0, 0, 0, 1)
   116 end
   116 end
   117 
   117 
   118 function onPrecise()
   118 function onPrecise()
   119 	if GameTime > 3000 then
   119 	if GameTime > 3000 then
   120 		SetAnimSkip(true)   
   120 		SetAnimSkip(true)
   121 	end
   121 	end
   122 end
   122 end
   123 
   123 
   124 -------------- EVENTS ------------------
   124 -------------- EVENTS ------------------
   125 
   125 
   157 
   157 
   158 function AnimationSetup()
   158 function AnimationSetup()
   159 	-- DIALOG 01 - Start, game instructions
   159 	-- DIALOG 01 - Start, game instructions
   160 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   160 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   161 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
   161 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
   162 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("In the Desert Planet, Hog Solo found some time to play with his RC plane..."), 3000}})
   162 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("On the Desert Planet, Hog Solo found some time to play with his RC plane..."), 3000}})
   163 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Each time you destroy your level targets you'll get teleported to the next level"), 5000}})
   163 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Each time you destroy all the targets on your current level you'll get teleported to the next level"), 5000}})
   164 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You'll have only one rc plane at the start of the mission"), 5000}})
   164 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("You'll have only one RC plane at the start of the mission"), 5000}})
   165 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("During the game you can get new planes by getting the weapon crates"), 5000}})
   165 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("During the game you can get new RC planes by collecting the weapon crates"), 5000}})
   166 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})	
   166 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   167 end
   167 end
   168 
   168 
   169 ----------------- Other Functions -----------------
   169 ----------------- Other Functions -----------------
   170 
   170 
   171 function checkTargetsDestroyed()
   171 function checkTargetsDestroyed()
   182 			SetGearPosition(hero.gear, 1110, 580)
   182 			SetGearPosition(hero.gear, 1110, 580)
   183 			currentTarget = 3
   183 			currentTarget = 3
   184 			setTargets(currentTarget)
   184 			setTargets(currentTarget)
   185 		end
   185 		end
   186 	elseif currentTarget == 3 then
   186 	elseif currentTarget == 3 then
   187 		
   187 
   188 	else
   188 	else
   189 		win()
   189 		win()
   190 	end
   190 	end
   191 end
   191 end
   192 
   192 
   207 end
   207 end
   208 
   208 
   209 function win()
   209 function win()
   210 	saveBonus(1, 1)
   210 	saveBonus(1, 1)
   211 	SendStat(siGameResult, loc("Congratulations, you are the best!"))
   211 	SendStat(siGameResult, loc("Congratulations, you are the best!"))
   212 	SendStat(siCustomAchievement, loc("You have destroyed all the targets"))	
   212 	SendStat(siCustomAchievement, loc("You have destroyed all the targets"))
   213 	SendStat(siCustomAchievement, loc("You are indeed the best PAotH pilot"))
   213 	SendStat(siCustomAchievement, loc("You are indeed the best PAotH pilot"))
   214 	SendStat(siCustomAchievement, loc("Next you play \"Searching in the dust\" you'll have an RC plane available"))
   214 	SendStat(siCustomAchievement, loc("Next time you play \"Searching in the dust\" you'll have an RC plane available"))
   215 	SendStat(siPlayerKills,'1',teamA.name)
   215 	SendStat(siPlayerKills,'1',teamA.name)
   216 	EndGame()
   216 	EndGame()
   217 end
   217 end
   218 
   218 
   219 function gameOver()
   219 function gameOver()
   220 	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
   220 	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
   221 	SendStat(siCustomAchievement, loc("You have to destroy all the targets"))		
   221 	SendStat(siCustomAchievement, loc("You have to destroy all the targets"))
   222 	SendStat(siCustomAchievement, loc("You will fail if you run out of ammo and there are still targets available"))		
   222 	SendStat(siCustomAchievement, loc("You will fail if you run out of ammo and there are still targets available"))
   223 	SendStat(siCustomAchievement, loc("Read the Challenge Objectives from within the mission for more details"))		
   223 	SendStat(siCustomAchievement, loc("Read the Challenge Objectives from within the mission for more details"))
   224 	SendStat(siPlayerKills,'0',teamA.name)
   224 	SendStat(siPlayerKills,'0',teamA.name)
   225 	EndGame()
   225 	EndGame()
   226 end
   226 end