share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death02.lua
changeset 9758 3b8058b251b8
parent 9644 4a19f25e86bf
child 9810 54c0fdec4600
equal deleted inserted replaced
9757:9be28be004d4 9758:3b8058b251b8
    10 ----------------- VARIABLES --------------------
    10 ----------------- VARIABLES --------------------
    11 -- globals
    11 -- globals
    12 local missionName = loc("Killing the specialists")
    12 local missionName = loc("Killing the specialists")
    13 local challengeObjectives = loc("Use your available weapons in order to eliminate the enemies").."|"..
    13 local challengeObjectives = loc("Use your available weapons in order to eliminate the enemies").."|"..
    14 	loc("Each time you play this missions enemy hogs will play in a random order").."|"..
    14 	loc("Each time you play this missions enemy hogs will play in a random order").."|"..
    15 	loc("At the start of the game each enemy hog has only the weapon that he is named of").."|"..
    15 	loc("At the start of the game each enemy hog has only the weapon that he is named after").."|"..
    16 	loc("A random hog will inherit the weapons of the deceased hogs").."|"..
    16 	loc("A random hedgehog will inherit the weapons of his deceased team-mates").."|"..
    17 	loc("If you kill a hog with the weapon your hp will be 100").."|"..
    17 	loc("If you kill a hedgehog with the respective weapon your healh points will be set to 100").."|"..
    18 	loc("If you injure a hog you'll get 35% of the damage dealt").."|"..
    18 	loc("If you injure a hedgehog you'll get 35% of the damage dealt").."|"..
    19 	loc("Every time you kill an enemy hog your ammo will get reseted").."|"..
    19 	loc("Every time you kill an enemy hog your ammo will get reset").."|"..
    20 	loc("Rope won't get reseted")
    20 	loc("Rope won't get reset")
    21 -- dialogs
    21 -- dialogs
    22 local dialog01 = {}
    22 local dialog01 = {}
    23 -- mission objectives
    23 -- mission objectives
    24 local goals = {
    24 local goals = {
    25 	[dialog01] = {missionName, loc("Challenge Objectives"), challengeObjectives, 1, 4500},
    25 	[dialog01] = {missionName, loc("Challenge Objectives"), challengeObjectives, 1, 4500},
    61 	MinesNum = 0
    61 	MinesNum = 0
    62 	MinesTime = 1
    62 	MinesTime = 1
    63 	Explosives = 0
    63 	Explosives = 0
    64 	Map = "death02_map"
    64 	Map = "death02_map"
    65 	Theme = "Hell"
    65 	Theme = "Hell"
    66 	
    66 
    67 	-- Hog Solo
    67 	-- Hog Solo
    68 	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
    68 	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
    69 	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
    69 	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
    70 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
    70 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
    71 	-- enemies
    71 	-- enemies
    73 	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy")
    73 	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy")
    74 	for i=1,table.getn(enemies) do
    74 	for i=1,table.getn(enemies) do
    75 		enemies[i].gear = AddHog(enemies[i].name, 1, 100, "war_desertgrenadier1")
    75 		enemies[i].gear = AddHog(enemies[i].name, 1, 100, "war_desertgrenadier1")
    76 		AnimSetGearPosition(enemies[i].gear, enemies[i].x, enemies[i].y)
    76 		AnimSetGearPosition(enemies[i].gear, enemies[i].x, enemies[i].y)
    77 	end
    77 	end
    78 	
    78 
    79 	initCheckpoint("death02")
    79 	initCheckpoint("death02")
    80 	
    80 
    81 	AnimInit()
    81 	AnimInit()
    82 	AnimationSetup()
    82 	AnimationSetup()
    83 end
    83 end
    84 
    84 
    85 function onGameStart()
    85 function onGameStart()
    86 	AnimWait(hero.gear, 3000)
    86 	AnimWait(hero.gear, 3000)
    87 	FollowGear(hero.gear)
    87 	FollowGear(hero.gear)
    88 	ShowMission(missionName, loc("Challenge Objectives"), challengeObjectives, -amSkip, 0)
    88 	ShowMission(missionName, loc("Challenge Objectives"), challengeObjectives, -amSkip, 0)
    89 	
    89 
    90 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
    90 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
    91 	AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 0)
    91 	AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 0)
    92 
    92 
    93 	--hero ammo
    93 	--hero ammo
    94 	AddAmmo(hero.gear, amSkip, 100)
    94 	AddAmmo(hero.gear, amSkip, 100)
   117 			hero.deagleAmmo = 0
   117 			hero.deagleAmmo = 0
   118 		elseif deadHog.weapon == amBazooka then
   118 		elseif deadHog.weapon == amBazooka then
   119 			hero.bazookaAmmo = 0
   119 			hero.bazookaAmmo = 0
   120 		elseif deadHog.weapon == amGrenade then
   120 		elseif deadHog.weapon == amGrenade then
   121 			hero.grenadeAmmo = 0
   121 			hero.grenadeAmmo = 0
   122 		end		
   122 		end
   123 		local randomHog = math.random(1,table.getn(enemies))
   123 		local randomHog = math.random(1,table.getn(enemies))
   124 		while not GetHealth(enemies[randomHog].gear) do
   124 		while not GetHealth(enemies[randomHog].gear) do
   125 			randomHog = math.random(1,table.getn(enemies))
   125 			randomHog = math.random(1,table.getn(enemies))
   126 		end
   126 		end
   127 		table.insert(enemies[randomHog].additionalWeapons, deadHog.weapon)
   127 		table.insert(enemies[randomHog].additionalWeapons, deadHog.weapon)
   147 	CheckEvents()
   147 	CheckEvents()
   148 end
   148 end
   149 
   149 
   150 function onPrecise()
   150 function onPrecise()
   151 	if GameTime > 3000 then
   151 	if GameTime > 3000 then
   152 		SetAnimSkip(true)   
   152 		SetAnimSkip(true)
   153 	end
   153 	end
   154 end
   154 end
   155 
   155 
   156 -------------- EVENTS ------------------
   156 -------------- EVENTS ------------------
   157 
   157 
   175 
   175 
   176 -------------- ACTIONS ------------------
   176 -------------- ACTIONS ------------------
   177 
   177 
   178 function heroDeath(gear)
   178 function heroDeath(gear)
   179 	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
   179 	SendStat(siGameResult, loc("Hog Solo lost, try again!"))
   180 	SendStat(siCustomAchievement, loc("You have to eliminate all the enemies"))			
   180 	SendStat(siCustomAchievement, loc("You have to eliminate all the enemies"))
   181 	SendStat(siCustomAchievement, loc("Read the Challenge Objectives from within the mission for more details"))		
   181 	SendStat(siCustomAchievement, loc("Read the Challenge Objectives from within the mission for more details"))
   182 	SendStat(siPlayerKills,'1',teamB.name)
   182 	SendStat(siPlayerKills,'1',teamB.name)
   183 	SendStat(siPlayerKills,'0',teamA.name)
   183 	SendStat(siPlayerKills,'0',teamA.name)
   184 	EndGame()
   184 	EndGame()
   185 end
   185 end
   186 
   186 
   187 function heroWin(gear)
   187 function heroWin(gear)
   188 	saveBonus(3, 4)
   188 	saveBonus(3, 4)
   189 	SendStat(siGameResult, loc("Congratulations, you won!"))
   189 	SendStat(siGameResult, loc("Congratulations, you won!"))
   190 	SendStat(siCustomAchievement, loc("You complete the mission in "..TotalRounds.." rounds"))			
   190 	SendStat(siCustomAchievement, loc("You complete the mission in "..TotalRounds.." rounds"))
   191 	SendStat(siCustomAchievement, loc("The next 4 times you'll play the \"The last encounter\" mission you'll get 20 more hit points and a Laser Sight"))		
   191 	SendStat(siCustomAchievement, loc("The next 4 times you play the \"The last encounter\" mission you'll get 20 more hit points and a Laser Sight"))
   192 	SendStat(siPlayerKills,'1',teamA.name)
   192 	SendStat(siPlayerKills,'1',teamA.name)
   193 	EndGame()
   193 	EndGame()
   194 end
   194 end
   195 
   195 
   196 -------------- ANIMATIONS ------------------
   196 -------------- ANIMATIONS ------------------
   207 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   207 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   208 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
   208 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
   209 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere in the Planet of Death..."), 3000}})
   209 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere in the Planet of Death..."), 3000}})
   210 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("...Hog Solo fights for his life"), 3000}})
   210 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("...Hog Solo fights for his life"), 3000}})
   211 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Each time you play this missions enemy hogs will play in a random order"), 5000}})
   211 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Each time you play this missions enemy hogs will play in a random order"), 5000}})
   212 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("At the start of the game each enemy hog has only the weapon that he is named of"), 5000}})
   212 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("At the start of the game each enemy hog has only the weapon that he is named after"), 5000}})
   213 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("A random hog will inherit the weapons of the deceased hogs"), 5000}})
   213 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("A random hedgehog will inherit the weapons of his deceased team-mates"), 5000}})
   214 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you kill a hog with the weapon your hp will be 100"), 5000}})
   214 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you kill a hedgehog with the respective weapon your healh points will be set to 100"), 5000}})
   215 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you injure a hog you'll get 35% of the damage dealt"), 5000}})
   215 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you injure a hedgehog you'll get 35% of the damage dealt"), 5000}})
   216 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Every time you kill an enemy hog your ammo will get reseted"), 5000}})
   216 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Every time you kill an enemy hog your ammo will get reset"), 5000}})
   217 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Rope won't get reseted"), 2000}})
   217 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Rope won't get reset"), 2000}})
   218 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   218 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   219 	table.insert(dialog01, {func = startBattle, args = {hero.gear}})	
   219 	table.insert(dialog01, {func = startBattle, args = {hero.gear}})
   220 end
   220 end
   221 
   221 
   222 ------------ Other Functions -------------------
   222 ------------ Other Functions -------------------
   223 
   223 
   224 function startBattle()
   224 function startBattle()