map changes to let hog climb, checkpoint one after icegun,starting dialog spacecampaign
authorPeriklis Ntanasis <pntanasis@gmail.com>
Sun, 28 Jul 2013 17:16:35 +0300
branchspacecampaign
changeset 9386 808d38b2182c
parent 9384 557ae509547b
child 9388 790d4f7d57d1
map changes to let hog climb, checkpoint one after icegun,starting dialog
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.hwp
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua
Binary file share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.hwp has changed
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua	Sat Jul 27 20:58:18 2013 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua	Sun Jul 28 17:16:35 2013 +0300
@@ -10,16 +10,26 @@
 -- maybe use rope challenge to go there
 -- add checkpoints
 -- fix the stats
--- add mines to the higher place/final stage
+-- Add first checkpoint save if icegun is taken
 
 HedgewarsScriptLoad("/Scripts/Locale.lua")
 HedgewarsScriptLoad("/Scripts/Animate.lua")
 
 ----------------- VARIABLES --------------------
 -- globals
+local campaignName = loc("A Space Adventure")
+local missionName = loc("Ice planet, a frozen adventure!")
 local heroAtAntiFlyArea = false
 local heroVisitedAntiFlyArea = false
 local heroAtFinaleStep = false
+local iceGunTaken = false
+local checkPointReached = 1 -- 1 is normal spawn
+-- dialogs
+local dialog01 = {}
+-- mission objectives
+local goals = {
+	[dialog01] = {missionName, loc("Getting ready"), loc("Collect the icegun and get the device part from Thanta"), 1, 4500},
+}
 -- crates
 local icegunY = 1950
 local icegunX = 260
@@ -74,9 +84,9 @@
 	TurnTime = 25000
 	CaseFreq = 0
 	MinesNum = 0
-	MinesTime = 3000
+	MinesTime = 1
 	Explosives = 0
-	Delay = 5 
+	Delay = 3
 	Map = "ice01_map"
 	Theme = "Snow"
 	
@@ -105,6 +115,17 @@
 	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
+		AnimSetGearPosition(hero.gear, 840, 1650)
+	end
+	
 	AnimInit()
 	AnimationSetup()	
 end
@@ -120,21 +141,18 @@
 	AddGear(1655, 960, gtMine, 0, 0, 0, 0)
 	AddGear(1665, 965, gtMine, 0, 0, 0, 0)
 	
-	
 	AddGear(1800, 1000, gtMine, 0, 0, 0, 0)
 	AddGear(1810, 1005, gtMine, 0, 0, 0, 0)
 	AddGear(1820, 1010, gtMine, 0, 0, 0, 0)
 	AddGear(1830, 1015, gtMine, 0, 0, 0, 0)
 	AddGear(1840, 1020, gtMine, 0, 0, 0, 0)
 	
-	
 	AddGear(1900, 1020, gtMine, 0, 0, 0, 0)
 	AddGear(1910, 1020, gtMine, 0, 0, 0, 0)
 	AddGear(1920, 1020, gtMine, 0, 0, 0, 0)
 	AddGear(1930, 1030, gtMine, 0, 0, 0, 0)
 	AddGear(1940, 1040, gtMine, 0, 0, 0, 0)
 	
-	
 	AddGear(2130, 1110, gtMine, 0, 0, 0, 0)
 	AddGear(2140, 1120, gtMine, 0, 0, 0, 0)
 	AddGear(2180, 1120, gtMine, 0, 0, 0, 0)
@@ -160,14 +178,22 @@
 	AddEvent(onNonAntiFlyArea, {hero.gear}, nonAntiFlyArea, {hero.gear}, 1)
 	
 	AddAmmo(hero.gear, amJetpack, 99)
-	AddAmmo(hero.gear, amBazooka, 1)
 	AddAmmo(bandit1.gear, amBazooka, 5)
 	AddAmmo(bandit2.gear, amBazooka, 4)
 	AddAmmo(bandit3.gear, amMine, 2)
 	AddAmmo(bandit3.gear, amGrenade, 3)
 	AddAmmo(bandit4.gear, amBazooka, 5)
 	AddAmmo(bandit5.gear, amBazooka, 5)
-	SpawnAmmoCrate(icegunX, icegunY, amIceGun)
+	
+	if checkPointReached == 1 then
+		AddAmmo(hero.gear, amBazooka, 1)
+		SpawnAmmoCrate(icegunX, icegunY, amIceGun)
+		AddEvent(onColumnCheckPoint, {hero.gear}, columnCheckPoint, {hero.gear}, 0)
+		AddEvent(onHeroAtIceGun, {hero.gear}, heroAtIceGun, {hero.gear}, 0)
+		AddAnim(dialog01)
+	elseif checkPointReached == 2 then		
+		AddAmmo(hero.gear, amIceGun, 8)
+	end
 	
 end
 
@@ -204,6 +230,12 @@
 	end
 end
 
+function onPrecise()
+	if GameTime > 3000 then
+		SetAnimSkip(true)   
+	end
+end
+
 -------------- EVENTS ------------------
 
 function onAntiFlyArea(gear)
@@ -234,6 +266,20 @@
 	return false
 end
 
+function onColumnCheckPoint(gear)
+	if not hero.dead and iceGunTaken and GetX(gear) < 870 and GetX(gear) > 850 and GetY(gear) > 1500 and StoppedGear(gear) then
+		return true
+	end
+	return false
+end
+
+function onHeroAtIceGun(gear)
+	if not hero.dead and GetX(gear) < icegunX+15 and GetX(gear) > icegunX-15 and GetY(gear) > icegunY-15 and GetY(gear) < icegunY+15 then
+		return true
+	end
+	return false
+end
+
 -------------- OUTCOMES ------------------
 
 function antiFlyArea(gear)
@@ -266,8 +312,40 @@
 	heroAtFinaleStep = true
 end
 
+function columnCheckPoint(gear)
+	SaveCampaignVar("Ice01CheckPoint", "2")
+	WriteLnToConsole("I AM HERE")
+	AnimCaption(hero.gear, loc("Checkpoint reached!"), 5000)
+end
+
+function heroAtIceGun(gear)
+	iceGunTaken=true
+end
+
 -------------- ANIMATIONS ------------------
 
+function Skipanim(anim)
+	if goals[anim] ~= nil then
+		ShowMission(unpack(goals[anim]))
+    end
+end
+
 function AnimationSetup()
-
+	-- DIALOG 01 - Start, welcome to moon
+	AddSkipFunction(dialog01, Skipanim, {dialog01})
+	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
+	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("In the ice planet, where ice rules..."), 5000}})
+	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Finaly you are here..."), SAY_SAY, 2000}})
+	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 2000}})
+	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Hi! Nice to meet you"), SAY_SAY, 3000}})
+	table.insert(dialog01, {func = AnimWait, args = {ally.gear, 2000}})
+	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Listen carefuly! The bandit leader, Thanta has recently found a very strange device"), SAY_SAY, 4000}})
+	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("He doesn't know it but this device is a part of the antigravity device"), SAY_SAY, 2500}})
+	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 8000}})
+	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Nice, then I should get the part as soon as possible!"), SAY_SAY, 4000}})
+	table.insert(dialog01, {func = AnimWait, args = {ally.gear, 4000}})
+	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Be careful, your gadgets won't work in the bandit area. You should get an ice gun"), SAY_SAY, 7000}})
+	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("There is one below us!"), SAY_SAY, 4000}})
+	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
+	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
 end