added saved hero health between missions spacecampaign
authorPeriklis Ntanasis <pntanasis@gmail.com>
Thu, 11 Jul 2013 04:00:11 +0300 (2013-07-11)
branchspacecampaign
changeset 9326 689f591aa226
parent 9324 98368198a75d
child 9328 811574013fed
added saved hero health between missions
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua	Thu Jul 11 02:05:59 2013 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua	Thu Jul 11 04:00:11 2013 +0300
@@ -292,8 +292,11 @@
 function moonLanding(gear)
 	WriteLnToConsole("MOON LANDING, HOORAY!")
 	AnimCaption(hero.gear,loc("Welcome to the moon!"))
-	SaveCampaignVar("CosmosCheckPoint", "4")
-	SaveCampaignVar("UnlockedMissions", "2")	
+	if checkPointReached ~= 5 then
+		SaveCampaignVar("CosmosCheckPoint", "4")
+		SaveCampaignVar("HeroHealth",GetHealth(hero.gear))
+	end
+	SaveCampaignVar("UnlockedMissions", "2")
 	SaveCampaignVar("Mission1", "2")
 	SaveCampaignVar("Mission2", "1")
 	EndGame()
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua	Thu Jul 11 02:05:59 2013 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua	Thu Jul 11 04:00:11 2013 +0300
@@ -114,7 +114,11 @@
 	Theme = "Cheese" -- Because ofc moon is made of cheese :)
 	-- Hog Solo
 	AddTeam(teamD.name, teamD.color, "Bone", "Island", "HillBilly", "cm_birdy")
-	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
+	if GetCampaignVar("HeroHealth") then
+		hero.gear = AddHog(hero.name, 0, tonumber(GetCampaignVar("HeroHealth")), "war_desertgrenadier1")
+	else
+		hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
+	end
 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
 	-- PAoTH
 	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
@@ -201,7 +205,7 @@
 		AddAmmo(hero.gear, amParachute, 2)
 		AddAmmo(hero.gear, amGrenade, 2)
 		AddAmmo(hero.gear, amDEagle, 2)
-		SetWind(80)		
+		SetWind(60)		
 		GameFlags = bor(GameFlags,gfDisableWind)
 		weaponsAcquired = true
 		TurnTimeLeft = 0
@@ -310,10 +314,11 @@
 -------------- OUTCOMES ------------------
 
 function weaponsPlatform(gear)	
-	SaveCampaignVar("Moon01CheckPoint", "2")
+	SaveCampaignVar("Moon01CheckPoint", "2")	
+	SaveCampaignVar("HeroHealth",GetHealth(hero.gear))
 	TurnTimeLeft = 0
 	weaponsAqcuired = true
-	SetWind(80)		
+	SetWind(60)		
 	GameFlags = bor(GameFlags,gfDisableWind)
 	AddAnim(dialog02)
 end
@@ -418,8 +423,6 @@
 
 function startCombat()
 	-- use this so guard2 will gain control
-	HealthCaseProb = 100 
-	HealthCaseAmount = 50
 	AnimSwitchHog(minion3.gear)
 	TurnTimeLeft = 0
 end