share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice02.lua
changeset 9757 9be28be004d4
parent 9645 da7b4d8c181e
child 9810 54c0fdec4600
equal deleted inserted replaced
9756:736abcc1915f 9757:9be28be004d4
    19 local RED = 0xff0000ff
    19 local RED = 0xff0000ff
    20 local GREEN = 0x38d61cff
    20 local GREEN = 0x38d61cff
    21 local challengeObjectives = loc("To win the game you have to pass into the rings in time")..
    21 local challengeObjectives = loc("To win the game you have to pass into the rings in time")..
    22 	"|"..loc("You'll get extra time in case you need it when you pass a ring").."|"..
    22 	"|"..loc("You'll get extra time in case you need it when you pass a ring").."|"..
    23 	loc("Every 2 rings, the ring color will be green and you'll get an extra flying saucer").."|"..
    23 	loc("Every 2 rings, the ring color will be green and you'll get an extra flying saucer").."|"..
    24 	loc("Use space button twice to change flying saucer while being on air")
    24 	loc("Use space button twice to change flying saucer while floating in mid-air")
    25 -- dialogs
    25 -- dialogs
    26 local dialog01 = {}
    26 local dialog01 = {}
    27 -- mission objectives
    27 -- mission objectives
    28 local goals = {
    28 local goals = {
    29 	[dialog01] = {missionName, loc("Getting ready"), challengeObjectives, 1, 4500},
    29 	[dialog01] = {missionName, loc("Getting ready"), challengeObjectives, 1, 4500},
    46 teamA.color = tonumber("38D61C",16) -- green
    46 teamA.color = tonumber("38D61C",16) -- green
    47 teamB.name = loc("Allies")
    47 teamB.name = loc("Allies")
    48 teamB.color = tonumber("FF0000",16) -- red
    48 teamB.color = tonumber("FF0000",16) -- red
    49 -- way points
    49 -- way points
    50 local current waypoint = 1
    50 local current waypoint = 1
    51 local waypoints = { 
    51 local waypoints = {
    52 	[1] = {x=1450, y=140},
    52 	[1] = {x=1450, y=140},
    53 	[2] = {x=990, y=580},
    53 	[2] = {x=990, y=580},
    54 	[3] = {x=1650, y=950},
    54 	[3] = {x=1650, y=950},
    55 	[4] = {x=620, y=630},
    55 	[4] = {x=620, y=630},
    56 	[5] = {x=1470, y=540},
    56 	[5] = {x=1470, y=540},
    76 	MinesNum = 0
    76 	MinesNum = 0
    77 	MinesTime = 1
    77 	MinesTime = 1
    78 	Explosives = 0
    78 	Explosives = 0
    79 	Map = "ice02_map"
    79 	Map = "ice02_map"
    80 	Theme = "Snow"
    80 	Theme = "Snow"
    81 	
    81 
    82 	-- Hog Solo
    82 	-- Hog Solo
    83 	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
    83 	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
    84 	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
    84 	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
    85 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
    85 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
    86 	-- Ally
    86 	-- Ally
    87 	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy")
    87 	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy")
    88 	ally.gear = AddHog(ally.name, 0, 100, "war_airwarden02")
    88 	ally.gear = AddHog(ally.name, 0, 100, "war_airwarden02")
    89 	AnimSetGearPosition(ally.gear, ally.x, ally.y)
    89 	AnimSetGearPosition(ally.gear, ally.x, ally.y)
    90 	HogTurnLeft(ally.gear, true)
    90 	HogTurnLeft(ally.gear, true)
    91 	
    91 
    92 	initCheckpoint("ice02")
    92 	initCheckpoint("ice02")
    93 	
    93 
    94 	AnimInit()
    94 	AnimInit()
    95 	AnimationSetup()
    95 	AnimationSetup()
    96 end
    96 end
    97 
    97 
    98 function onGameStart()
    98 function onGameStart()
    99 	AnimWait(hero.gear, 3000)
    99 	AnimWait(hero.gear, 3000)
   100 	FollowGear(hero.gear)
   100 	FollowGear(hero.gear)
   101 	ShowMission(missionName, loc("Challenge Objectives"), challengeObjectives, -amSkip, 0)
   101 	ShowMission(missionName, loc("Challenge Objectives"), challengeObjectives, -amSkip, 0)
   102 	
   102 
   103 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   103 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   104 	
   104 
   105 	AddAmmo(hero.gear, amJetpack, 3)
   105 	AddAmmo(hero.gear, amJetpack, 3)
   106 	
   106 
   107 	-- place a waypoint
   107 	-- place a waypoint
   108 	placeNextWaypoint()
   108 	placeNextWaypoint()
   109 	
   109 
   110 	SendHealthStatsOff()
   110 	SendHealthStatsOff()
   111 	AddAnim(dialog01)
   111 	AddAnim(dialog01)
   112 end
   112 end
   113 
   113 
   114 function onNewTurn()
   114 function onNewTurn()
   135 			-- GAME OVER, WIN!
   135 			-- GAME OVER, WIN!
   136 			totalTime = totalTime - TurnTimeLeft
   136 			totalTime = totalTime - TurnTimeLeft
   137 			totalTime = totalTime / 1000
   137 			totalTime = totalTime / 1000
   138 			local saucersLeft = GetAmmoCount(hero.gear, amJetpack)
   138 			local saucersLeft = GetAmmoCount(hero.gear, amJetpack)
   139 			local saucersUsed = totalSaucers - saucersLeft
   139 			local saucersUsed = totalSaucers - saucersLeft
   140 			SendStat(siGameResult, loc("Hoo Ray! You are a champion!"))
   140 			SendStat(siGameResult, loc("Hoorah! You are a champion!"))
   141 			SendStat(siCustomAchievement, loc("You complete the mission in "..totalTime.." seconds"))			
   141 			SendStat(siCustomAchievement, loc("You completed the mission in "..totalTime.." seconds"))
   142 			SendStat(siCustomAchievement, loc("You have used "..saucersUsed.." flying saucers"))			
   142 			SendStat(siCustomAchievement, loc("You have used "..saucersUsed.." flying saucers"))
   143 			SendStat(siCustomAchievement, loc("You had "..saucersLeft.." more flying saucers left"))			
   143 			SendStat(siCustomAchievement, loc("You had "..saucersLeft.." more flying saucers left"))
   144 			SendStat(siPlayerKills,'1',teamA.name)
   144 			SendStat(siPlayerKills,'1',teamA.name)
   145 			EndGame()
   145 			EndGame()
   146 		end
   146 		end
   147 	end
   147 	end
   148 end
   148 end
   153 	end
   153 	end
   154 end
   154 end
   155 
   155 
   156 function onPrecise()
   156 function onPrecise()
   157 	if GameTime > 3000 then
   157 	if GameTime > 3000 then
   158 		SetAnimSkip(true)   
   158 		SetAnimSkip(true)
   159 	end
   159 	end
   160 end
   160 end
   161 
   161 
   162 -------------- EVENTS ------------------
   162 -------------- EVENTS ------------------
   163 
   163 
   187 	-- DIALOG 01 - Start, some story telling
   187 	-- DIALOG 01 - Start, some story telling
   188 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   188 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   189 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
   189 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
   190 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("In the Ice Planet flying saucer stadium..."), 5000}})
   190 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("In the Ice Planet flying saucer stadium..."), 5000}})
   191 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("This is the olympic stadium of saucer flying..."), SAY_SAY, 4000}})
   191 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("This is the olympic stadium of saucer flying..."), SAY_SAY, 4000}})
   192 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("All the saucer pilots dream one day to come here and compete with the best!"), SAY_SAY, 5000}})
   192 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("All the saucer pilots dream to come here one day in order to compete with the best!"), SAY_SAY, 5000}})
   193 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Now you have the chance to try and get the place that you deserve between the best..."), SAY_SAY, 6000}})
   193 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Now you have the chance to try and claim the place that you deserve among the best..."), SAY_SAY, 6000}})
   194 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Use the saucer and pass from the rings..."), 5000}})
   194 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Use the saucer and pass through the rings..."), 5000}})
   195 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Pause the game by pressing \"P\" for more details"), 5000}})
   195 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Pause the game by pressing the pause key (default \"P\") for more details"), 5000}})
   196 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("... can you do it?"), SAY_SAY, 2000}})
   196 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("... can you do it?"), SAY_SAY, 2000}})
   197 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   197 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   198 	table.insert(dialog01, {func = startFlying, args = {hero.gear}})	
   198 	table.insert(dialog01, {func = startFlying, args = {hero.gear}})
   199 end
   199 end
   200 
   200 
   201 ------------------ Other Functions -------------------
   201 ------------------ Other Functions -------------------
   202 
   202 
   203 function startFlying()
   203 function startFlying()
   234 				totalTime = totalTime + 6000
   234 				totalTime = totalTime + 6000
   235 				if currentWaypoint ~= 1 then
   235 				if currentWaypoint ~= 1 then
   236 					AnimCaption(hero.gear, loc("6 more seconds added to the clock"), 4000)
   236 					AnimCaption(hero.gear, loc("6 more seconds added to the clock"), 4000)
   237 				end
   237 				end
   238 			end
   238 			end
   239 		end	
   239 		end
   240 		radius = radius - 4
   240 		radius = radius - 4
   241 		currentWaypoint = currentWaypoint + 1
   241 		currentWaypoint = currentWaypoint + 1
   242 		return true
   242 		return true
   243 	else
   243 	else
   244 		AnimCaption(hero.gear, loc("Congratulations, you won!"), 4000)
   244 		AnimCaption(hero.gear, loc("Congratulations, you won!"), 4000)