share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua
branchspacecampaign
changeset 9438 77dde6234fec
parent 9436 07fe70ba7dcd
child 9441 00f07e32313a
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua	Thu Aug 01 19:50:01 2013 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua	Thu Aug 01 20:17:37 2013 +0300
@@ -9,6 +9,8 @@
 -- maybe use same name in missionName and frontend mission name..
 -- in this map I have to track the weapons the player has in checkpoints
 -- GENERAL NOTE: change hats :D
+-- Idea: game will be successfully end when the 2 lower crates are collected
+-- it would be more defficult (and sadistic) if one should collect *all* the crates
 
 HedgewarsScriptLoad("/Scripts/Locale.lua")
 HedgewarsScriptLoad("/Scripts/Animate.lua")
@@ -143,6 +145,7 @@
 	AddEvent(onHeroAtFirstBattle, {hero.gear}, heroAtFirstBattle, {hero.gear}, 1)
 	AddEvent(onHeroFleeFirstBattle, {hero.gear}, heroFleeFirstBattle, {hero.gear}, 1)
 	AddEvent(onHeroAtCheckpoint4, {hero.gear}, heroAtCheckpoint4, {hero.gear}, 0)
+	AddEvent(onHeroAtThirdBattle, {hero.gear}, heroAtThirdBattle, {hero.gear}, 0)
 	
 	-- smugglers ammo
 	AddAmmo(smuggler1.gear, amBazooka, 2)
@@ -226,6 +229,9 @@
 	elseif (CurrentHedgehog == smuggler1.gear or CurrentHedgehog == smuggler3.gear) and ongoingBattle == 2 then
 		AnimSwitchHog(hero.gear)
 		TurnTimeLeft = 0
+	elseif (CurrentHedgehog == smuggler1.gear or CurrentHedgehog == smuggler2.gear) and ongoingBattle == 3 then
+		AnimSwitchHog(hero.gear)
+		TurnTimeLeft = 0
 	elseif CurrentHedgehog == ally.gear then
 		TurnTimeLeft = 0
 	end
@@ -313,6 +319,14 @@
 	return false
 end
 
+function onHeroAtThirdBattle(gear)
+	if not hero.dead and GetX(hero.gear) > 2000 and GetX(hero.gear) < 2200
+			and GetY(hero.gear) > 1430 and GetY(hero.gear) < 1670 then
+		return true
+	end
+	return false
+end
+
 -------------- OUTCOMES ------------------
 
 function heroDeath(gear)
@@ -355,6 +369,14 @@
 	saveCheckPoint("4")
 end
 
+function heroAtThirdBattle(gear)
+	heroIsInBattle = true
+	ongoingBattle = 3
+	AnimSay(smuggler3.gear, loc("Who's there! I'll get you..."), SAY_SHOUT, 5000)	
+	AnimSwitchHog(smuggler3.gear)
+	TurnTimeLeft = 0
+end
+
 -------------- ANIMATIONS ------------------
 
 function Skipanim(anim)