share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua
branchspacecampaign
changeset 9640 a6a903a6c2b3
parent 9639 6b2ae2eaf1b2
child 9642 8a691e0f117a
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua	Wed Sep 18 04:02:13 2013 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua	Wed Sep 18 04:24:10 2013 +0300
@@ -107,7 +107,7 @@
 	Theme = "Cheese" -- Because ofc moon is made of cheese :)
 	-- Hog Solo
 	AddTeam(teamD.name, teamD.color, "Bone", "Island", "HillBilly", "cm_birdy")
-	if GetCampaignVar("HeroHealth") and string.len(GetCampaignVar("HeroHealth")) > 0 then
+	if tonumber(GetCampaignVar("HeroHealth")) then
 		hero.gear = AddHog(hero.name, 0, tonumber(GetCampaignVar("HeroHealth")), "war_desertgrenadier1")
 	else
 		hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
@@ -150,6 +150,11 @@
 		-- Start of the game
 	elseif checkPointReached == 2 then
 		AnimSetGearPosition(hero.gear, parachuteX, weaponsY)
+		if GetHealth(hero.gear) + 5 > 100 then			
+			SaveCampaignVar("HeroHealth", 100)
+		else
+			SaveCampaignVar("HeroHealth", GetHealth(hero.gear) + 5)
+		end
 	end
 	
 	AnimInit()