increase health by 5 everytime hero spawn on checkpoint3 spacecampaign
authorPeriklis Ntanasis <pntanasis@gmail.com>
Tue, 30 Jul 2013 15:30:22 +0300
branchspacecampaign
changeset 9398 3f2ec6e1032f
parent 9396 fb56c2225f25
child 9400 b0c1b1972947
increase health by 5 everytime hero spawn on checkpoint3
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua	Tue Jul 30 15:00:13 2013 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua	Tue Jul 30 15:30:22 2013 +0300
@@ -95,9 +95,27 @@
 	Map = "ice01_map"
 	Theme = "Snow"
 	
+	-- get the check point
+	if tonumber(GetCampaignVar("Ice01CheckPoint")) then
+		checkPointReached = tonumber(GetCampaignVar("Ice01CheckPoint"))
+	end
+	-- get hero health
+	local heroHealth = 100
+	if tonumber(GetCampaignVar("HeroHealth")) then
+		heroHealth = tonumber(GetCampaignVar("HeroHealth"))
+	end
+	
+	if heroHealth ~= 100 then
+		heroHealth = heroHealth + 5
+		if heroHealth > 100 then
+			heroHealth = 100
+		end
+		SaveCampaignVar("HeroHealth", heroHealth)	
+	end
+	
 	-- Hog Solo
 	AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy")
-	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
+	hero.gear = AddHog(hero.name, 0, heroHealth, "war_desertgrenadier1")
 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
 	HogTurnLeft(hero.gear, true)
 	-- Ally
@@ -120,11 +138,6 @@
 	AnimSetGearPosition(bandit5.gear, bandit5.x, bandit5.y)
 	HogTurnLeft(bandit5.gear, true)
 	
-	-- get the check point
-	if tonumber(GetCampaignVar("Ice01CheckPoint")) then
-		checkPointReached = tonumber(GetCampaignVar("Ice01CheckPoint"))
-	end
-	
 	if checkPointReached == 1 then
 		-- Start of the game
 	elseif checkPointReached == 2 then
@@ -210,8 +223,7 @@
 	elseif checkPointReached == 3 then
 		AddAmmo(hero.gear, amIceGun, 6)
 		AnimCaption(hero.gear, loc("Go to Thanta and get the device part!"), 5000)
-	end
-	
+	end	
 end
 
 function onNewTurn()