share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua
changeset 9758 3b8058b251b8
parent 9642 8a691e0f117a
child 9765 6cad4393a315
equal deleted inserted replaced
9757:9be28be004d4 9758:3b8058b251b8
    22 local checkPointReached = 1 -- 1 is normal spawn
    22 local checkPointReached = 1 -- 1 is normal spawn
    23 -- dialogs
    23 -- dialogs
    24 local dialog01 = {}
    24 local dialog01 = {}
    25 -- mission objectives
    25 -- mission objectives
    26 local goals = {
    26 local goals = {
    27 	[dialog01] = {missionName, loc("Getting ready"), loc("The part is hidden in one of the crates! Go and get it!"), 1, 4500},
    27 	[dialog01] = {missionName, loc("Getting ready"), loc("The device part is hidden in one of the crates! Go and get it!"), 1, 4500},
    28 }
    28 }
    29 -- crates
    29 -- crates
    30 local btorch1Y = 60
    30 local btorch1Y = 60
    31 local btorch1X = 2700
    31 local btorch1X = 2700
    32 local btorch2Y = 1900
    32 local btorch2Y = 1900
    88 	Explosives = 0
    88 	Explosives = 0
    89 	Delay = 3
    89 	Delay = 3
    90 	HealthCaseAmount = 30
    90 	HealthCaseAmount = 30
    91 	Map = "desert01_map"
    91 	Map = "desert01_map"
    92 	Theme = "Desert"
    92 	Theme = "Desert"
    93 	
    93 
    94 	-- get the check point
    94 	-- get the check point
    95 	checkPointReached = initCheckpoint("desert01")
    95 	checkPointReached = initCheckpoint("desert01")
    96 	-- get hero health
    96 	-- get hero health
    97 	local heroHealth = 100
    97 	local heroHealth = 100
    98 	if checkPointReached > 1 and tonumber(GetCampaignVar("HeroHealth")) then
    98 	if checkPointReached > 1 and tonumber(GetCampaignVar("HeroHealth")) then
    99 		heroHealth = tonumber(GetCampaignVar("HeroHealth"))
    99 		heroHealth = tonumber(GetCampaignVar("HeroHealth"))
   100 	end
   100 	end
   101 	
   101 
   102 	-- Hog Solo
   102 	-- Hog Solo
   103 	AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy")
   103 	AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy")
   104 	hero.gear = AddHog(hero.name, 0, heroHealth, "war_desertgrenadier1")
   104 	hero.gear = AddHog(hero.name, 0, heroHealth, "war_desertgrenadier1")
   105 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
   105 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
   106 	HogTurnLeft(hero.gear, true)
   106 	HogTurnLeft(hero.gear, true)
   111 	-- Smugglers
   111 	-- Smugglers
   112 	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy")
   112 	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy")
   113 	smuggler1.gear = AddHog(smuggler1.name, 1, 100, "hair_orange")
   113 	smuggler1.gear = AddHog(smuggler1.name, 1, 100, "hair_orange")
   114 	AnimSetGearPosition(smuggler1.gear, smuggler1.x, smuggler1.y)
   114 	AnimSetGearPosition(smuggler1.gear, smuggler1.x, smuggler1.y)
   115 	smuggler2.gear = AddHog(smuggler2.name, 1, 100, "lambda")
   115 	smuggler2.gear = AddHog(smuggler2.name, 1, 100, "lambda")
   116 	AnimSetGearPosition(smuggler2.gear, smuggler2.x, smuggler2.y)	
   116 	AnimSetGearPosition(smuggler2.gear, smuggler2.x, smuggler2.y)
   117 	smuggler3.gear = AddHog(smuggler3.name, 1, 100, "beefeater")
   117 	smuggler3.gear = AddHog(smuggler3.name, 1, 100, "beefeater")
   118 	AnimSetGearPosition(smuggler3.gear, smuggler3.x, smuggler3.y)	
   118 	AnimSetGearPosition(smuggler3.gear, smuggler3.x, smuggler3.y)
   119 	
   119 
   120 	if checkPointReached == 1 then
   120 	if checkPointReached == 1 then
   121 		-- Start of the game
   121 		-- Start of the game
   122 	elseif checkPointReached == 2 then
   122 	elseif checkPointReached == 2 then
   123 		AnimSetGearPosition(hero.gear, 1050, 615)
   123 		AnimSetGearPosition(hero.gear, 1050, 615)
   124 		HogTurnLeft(hero.gear, true)
   124 		HogTurnLeft(hero.gear, true)
   128 	elseif checkPointReached == 4 then
   128 	elseif checkPointReached == 4 then
   129 		AnimSetGearPosition(hero.gear, 1160, 1180)
   129 		AnimSetGearPosition(hero.gear, 1160, 1180)
   130 	elseif checkPointReached == 5 then
   130 	elseif checkPointReached == 5 then
   131 		AnimSetGearPosition(hero.gear, girderX+40, girderY-30)
   131 		AnimSetGearPosition(hero.gear, girderX+40, girderY-30)
   132 	end
   132 	end
   133 	
   133 
   134 	AnimInit()
   134 	AnimInit()
   135 	AnimationSetup()	
   135 	AnimationSetup()
   136 end
   136 end
   137 
   137 
   138 function onGameStart()
   138 function onGameStart()
   139 	AnimWait(hero.gear, 3000)
   139 	AnimWait(hero.gear, 3000)
   140 	FollowGear(hero.gear)
   140 	FollowGear(hero.gear)
   141 	
   141 
   142 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   142 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   143 	AddEvent(onHeroAtFirstBattle, {hero.gear}, heroAtFirstBattle, {hero.gear}, 1)
   143 	AddEvent(onHeroAtFirstBattle, {hero.gear}, heroAtFirstBattle, {hero.gear}, 1)
   144 	AddEvent(onHeroFleeFirstBattle, {hero.gear}, heroFleeFirstBattle, {hero.gear}, 1)
   144 	AddEvent(onHeroFleeFirstBattle, {hero.gear}, heroFleeFirstBattle, {hero.gear}, 1)
   145 	AddEvent(onHeroAtCheckpoint4, {hero.gear}, heroAtCheckpoint4, {hero.gear}, 0)
   145 	AddEvent(onHeroAtCheckpoint4, {hero.gear}, heroAtCheckpoint4, {hero.gear}, 0)
   146 	AddEvent(onHeroAtThirdBattle, {hero.gear}, heroAtThirdBattle, {hero.gear}, 0)
   146 	AddEvent(onHeroAtThirdBattle, {hero.gear}, heroAtThirdBattle, {hero.gear}, 0)
   147 	AddEvent(onCheckForWin1, {hero.gear}, checkForWin1, {hero.gear}, 0)
   147 	AddEvent(onCheckForWin1, {hero.gear}, checkForWin1, {hero.gear}, 0)
   148 	AddEvent(onCheckForWin2, {hero.gear}, checkForWin2, {hero.gear}, 0)
   148 	AddEvent(onCheckForWin2, {hero.gear}, checkForWin2, {hero.gear}, 0)
   149 	
   149 
   150 	-- smugglers ammo
   150 	-- smugglers ammo
   151 	AddAmmo(smuggler1.gear, amBazooka, 2)
   151 	AddAmmo(smuggler1.gear, amBazooka, 2)
   152 	AddAmmo(smuggler1.gear, amGrenade, 2)
   152 	AddAmmo(smuggler1.gear, amGrenade, 2)
   153 	AddAmmo(smuggler1.gear, amDEagle, 2)	
   153 	AddAmmo(smuggler1.gear, amDEagle, 2)
   154 	AddAmmo(smuggler3.gear, amRope, 2)
   154 	AddAmmo(smuggler3.gear, amRope, 2)
   155 	
   155 
   156 	-- spawn crates
   156 	-- spawn crates
   157 	SpawnAmmoCrate(btorch2X, btorch2Y, amBlowTorch)
   157 	SpawnAmmoCrate(btorch2X, btorch2Y, amBlowTorch)
   158 	SpawnAmmoCrate(btorch3X, btorch3Y, amBlowTorch)
   158 	SpawnAmmoCrate(btorch3X, btorch3Y, amBlowTorch)
   159 	SpawnAmmoCrate(rope1X, rope1Y, amRope)
   159 	SpawnAmmoCrate(rope1X, rope1Y, amRope)
   160 	SpawnAmmoCrate(rope2X, rope2Y, amRope)
   160 	SpawnAmmoCrate(rope2X, rope2Y, amRope)
   161 	SpawnAmmoCrate(rope3X, rope3Y, amRope)
   161 	SpawnAmmoCrate(rope3X, rope3Y, amRope)
   162 	SpawnAmmoCrate(portalX, portalY, amPortalGun)	
   162 	SpawnAmmoCrate(portalX, portalY, amPortalGun)
   163 	SpawnAmmoCrate(girderX, girderY, amGirder)
   163 	SpawnAmmoCrate(girderX, girderY, amGirder)
   164 	
   164 
   165 	SpawnHealthCrate(3300, 970)
   165 	SpawnHealthCrate(3300, 970)
   166 	
   166 
   167 	-- adding mines - BOOM!
   167 	-- adding mines - BOOM!
   168 	AddGear(1280, 460, gtMine, 0, 0, 0, 0)
   168 	AddGear(1280, 460, gtMine, 0, 0, 0, 0)
   169 	AddGear(270, 460, gtMine, 0, 0, 0, 0)
   169 	AddGear(270, 460, gtMine, 0, 0, 0, 0)
   170 	AddGear(3460, 60, gtMine, 0, 0, 0, 0)
   170 	AddGear(3460, 60, gtMine, 0, 0, 0, 0)
   171 	AddGear(3500, 240, gtMine, 0, 0, 0, 0)
   171 	AddGear(3500, 240, gtMine, 0, 0, 0, 0)
   172 	AddGear(3410, 670, gtMine, 0, 0, 0, 0)
   172 	AddGear(3410, 670, gtMine, 0, 0, 0, 0)
   173 	AddGear(3450, 720, gtMine, 0, 0, 0, 0)
   173 	AddGear(3450, 720, gtMine, 0, 0, 0, 0)
   174 	
   174 
   175 	local x = 800
   175 	local x = 800
   176 	while x < 1630 do
   176 	while x < 1630 do
   177 		AddGear(x, 900, gtMine, 0, 0, 0, 0)
   177 		AddGear(x, 900, gtMine, 0, 0, 0, 0)
   178 		x = x + math.random(8,20)
   178 		x = x + math.random(8,20)
   179 	end
   179 	end
   190 	x = 1570
   190 	x = 1570
   191 	while x < 2900 do
   191 	while x < 2900 do
   192 		AddGear(x, 470, gtMine, 0, 0, 0, 0)
   192 		AddGear(x, 470, gtMine, 0, 0, 0, 0)
   193 		x = x + math.random(8,20)
   193 		x = x + math.random(8,20)
   194 	end
   194 	end
   195 	
   195 
   196 	if checkPointReached == 1 then	
   196 	if checkPointReached == 1 then
   197 		AddEvent(onHeroAtCheckpoint2, {hero.gear}, heroAtCheckpoint2, {hero.gear}, 0)
   197 		AddEvent(onHeroAtCheckpoint2, {hero.gear}, heroAtCheckpoint2, {hero.gear}, 0)
   198 		AddEvent(onHeroAtCheckpoint3, {hero.gear}, heroAtCheckpoint3, {hero.gear}, 0)
   198 		AddEvent(onHeroAtCheckpoint3, {hero.gear}, heroAtCheckpoint3, {hero.gear}, 0)
   199 		-- crates
   199 		-- crates
   200 		SpawnAmmoCrate(btorch1X, btorch1Y, amBlowTorch)
   200 		SpawnAmmoCrate(btorch1X, btorch1Y, amBlowTorch)
   201 		SpawnHealthCrate(680, 460)
   201 		SpawnHealthCrate(680, 460)
   204 		AddAmmo(hero.gear, amBazooka, 3)
   204 		AddAmmo(hero.gear, amBazooka, 3)
   205 		AddAmmo(hero.gear, amParachute, 1)
   205 		AddAmmo(hero.gear, amParachute, 1)
   206 		AddAmmo(hero.gear, amGrenade, 6)
   206 		AddAmmo(hero.gear, amGrenade, 6)
   207 		AddAmmo(hero.gear, amDEagle, 4)
   207 		AddAmmo(hero.gear, amDEagle, 4)
   208 		AddAmmo(hero.gear, amRCPlane, tonumber(getBonus(1)))
   208 		AddAmmo(hero.gear, amRCPlane, tonumber(getBonus(1)))
   209 	
   209 
   210 		AddAnim(dialog01)
   210 		AddAnim(dialog01)
   211 	elseif checkPointReached == 2 or checkPointReached == 3 then
   211 	elseif checkPointReached == 2 or checkPointReached == 3 then
   212 		ShowMission(campaignName, missionName, loc("The part is hidden in one of the crates! Go and get it!"), -amSkip, 0)
   212 		ShowMission(campaignName, missionName, loc("The device part is hidden in one of the crates! Go and get it!"), -amSkip, 0)
   213 		loadHeroAmmo()
   213 		loadHeroAmmo()
   214 		
   214 
   215 		secondBattle()
   215 		secondBattle()
   216 	elseif checkPointReached == 4 or checkPointReached == 5 then
   216 	elseif checkPointReached == 4 or checkPointReached == 5 then
   217 		ShowMission(campaignName, missionName, loc("The part is hidden in one of the crates! Go and get it!"), -amSkip, 0)
   217 		ShowMission(campaignName, missionName, loc("The part device is hidden in one of the crates! Go and get it!"), -amSkip, 0)
   218 		loadHeroAmmo()
   218 		loadHeroAmmo()
   219 	end
   219 	end
   220 	
   220 
   221 	SendHealthStatsOff()
   221 	SendHealthStatsOff()
   222 end
   222 end
   223 
   223 
   224 function onNewTurn()
   224 function onNewTurn()
   225 	if CurrentHedgehog ~= hero.gear and not heroIsInBattle then
   225 	if CurrentHedgehog ~= hero.gear and not heroIsInBattle then
   250 end
   250 end
   251 
   251 
   252 function onAmmoStoreInit()
   252 function onAmmoStoreInit()
   253 	SetAmmo(amBlowTorch, 0, 0, 0, 1)
   253 	SetAmmo(amBlowTorch, 0, 0, 0, 1)
   254 	SetAmmo(amRope, 0, 0, 0, 1)
   254 	SetAmmo(amRope, 0, 0, 0, 1)
   255 	SetAmmo(amPortalGun, 0, 0, 0, 1)	
   255 	SetAmmo(amPortalGun, 0, 0, 0, 1)
   256 	SetAmmo(amGirder, 0, 0, 0, 3)
   256 	SetAmmo(amGirder, 0, 0, 0, 3)
   257 end
   257 end
   258 
   258 
   259 function onGearDelete(gear)
   259 function onGearDelete(gear)
   260 	if gear == hero.gear then
   260 	if gear == hero.gear then
   265 	end
   265 	end
   266 end
   266 end
   267 
   267 
   268 function onPrecise()
   268 function onPrecise()
   269 	if GameTime > 3000 then
   269 	if GameTime > 3000 then
   270 		SetAnimSkip(true)   
   270 		SetAnimSkip(true)
   271 	end
   271 	end
   272 end
   272 end
   273 
   273 
   274 -------------- EVENTS ------------------
   274 -------------- EVENTS ------------------
   275 
   275 
   279 	end
   279 	end
   280 	return false
   280 	return false
   281 end
   281 end
   282 
   282 
   283 function onHeroAtFirstBattle(gear)
   283 function onHeroAtFirstBattle(gear)
   284 	if not hero.dead and not heroIsInBattle and GetHealth(smuggler1.gear) and GetX(hero.gear) <= 1450 
   284 	if not hero.dead and not heroIsInBattle and GetHealth(smuggler1.gear) and GetX(hero.gear) <= 1450
   285 			and GetY(hero.gear) <= GetY(smuggler1.gear)+5 and GetY(hero.gear) >= GetY(smuggler1.gear)-5 then
   285 			and GetY(hero.gear) <= GetY(smuggler1.gear)+5 and GetY(hero.gear) >= GetY(smuggler1.gear)-5 then
   286 		return true
   286 		return true
   287 	end
   287 	end
   288 	return false
   288 	return false
   289 end
   289 end
   290 
   290 
   291 function onHeroFleeFirstBattle(gear)
   291 function onHeroFleeFirstBattle(gear)
   292 	if not hero.dead and GetHealth(smuggler1.gear) and heroIsInBattle and ongoingBattle == 1 and (GetX(hero.gear) > 1450 
   292 	if not hero.dead and GetHealth(smuggler1.gear) and heroIsInBattle and ongoingBattle == 1 and (GetX(hero.gear) > 1450
   293 			or (GetY(hero.gear) < GetY(smuggler1.gear)-80 or GetY(hero.gear) > smuggler1.y+300)) then
   293 			or (GetY(hero.gear) < GetY(smuggler1.gear)-80 or GetY(hero.gear) > smuggler1.y+300)) then
   294 		return true
   294 		return true
   295 	end
   295 	end
   296 	return false
   296 	return false
   297 end
   297 end
   359 
   359 
   360 function heroAtFirstBattle(gear)
   360 function heroAtFirstBattle(gear)
   361 	AnimCaption(hero.gear, loc("A smuggler! Prepare for battle"), 5000)
   361 	AnimCaption(hero.gear, loc("A smuggler! Prepare for battle"), 5000)
   362 	TurnTimeLeft = 0
   362 	TurnTimeLeft = 0
   363 	heroIsInBattle = true
   363 	heroIsInBattle = true
   364 	ongoingBattle = 1	
   364 	ongoingBattle = 1
   365 	AnimSwitchHog(smuggler1.gear)
   365 	AnimSwitchHog(smuggler1.gear)
   366 	TurnTimeLeft = 0
   366 	TurnTimeLeft = 0
   367 end
   367 end
   368 
   368 
   369 function heroFleeFirstBattle(gear)
   369 function heroFleeFirstBattle(gear)
   392 end
   392 end
   393 
   393 
   394 function heroAtThirdBattle(gear)
   394 function heroAtThirdBattle(gear)
   395 	heroIsInBattle = true
   395 	heroIsInBattle = true
   396 	ongoingBattle = 3
   396 	ongoingBattle = 3
   397 	AnimSay(smuggler3.gear, loc("Who's there?! I'll get you..."), SAY_SHOUT, 5000)	
   397 	AnimSay(smuggler3.gear, loc("Who's there?! I'll get you..."), SAY_SHOUT, 5000)
   398 	AnimSwitchHog(smuggler3.gear)
   398 	AnimSwitchHog(smuggler3.gear)
   399 	TurnTimeLeft = 0
   399 	TurnTimeLeft = 0
   400 end
   400 end
   401 
   401 
   402 -- for some weird reson I couldn't call the same action for both events
   402 -- for some weird reson I couldn't call the same action for both events
   407 function checkForWin2(gear)
   407 function checkForWin2(gear)
   408 	-- ok lets place one more checkpoint as next part seems challenging without rope
   408 	-- ok lets place one more checkpoint as next part seems challenging without rope
   409 	if cratesFound ==  0 then
   409 	if cratesFound ==  0 then
   410 		saveCheckPointLocal("5")
   410 		saveCheckPointLocal("5")
   411 	end
   411 	end
   412 	
   412 
   413 	checkForWin()	
   413 	checkForWin()
   414 end
   414 end
   415 
   415 
   416 -------------- ANIMATIONS ------------------
   416 -------------- ANIMATIONS ------------------
   417 
   417 
   418 function Skipanim(anim)
   418 function Skipanim(anim)
   428 function AnimationSetup()
   428 function AnimationSetup()
   429 	-- DIALOG 01 - Start, getting info about the device
   429 	-- DIALOG 01 - Start, getting info about the device
   430 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   430 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   431 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
   431 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
   432 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("In the Planet of Sand, you have to double check your moves..."), 5000}})
   432 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("In the Planet of Sand, you have to double check your moves..."), 5000}})
   433 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Finaly you are here..."), SAY_SAY, 2000}})
   433 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Finally you are here..."), SAY_SAY, 2000}})
   434 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 2000}})
   434 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 2000}})
   435 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Thank you for meeting me in such a short notice!"), SAY_SAY, 3000}})
   435 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Thank you for meeting me on such a short notice!"), SAY_SAY, 3000}})
   436 	table.insert(dialog01, {func = AnimWait, args = {ally.gear, 4000}})
   436 	table.insert(dialog01, {func = AnimWait, args = {ally.gear, 4000}})
   437 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("No problem, I would do anything for H!"), SAY_SAY, 4000}})
   437 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("No problem, I would do anything for H!"), SAY_SAY, 4000}})
   438 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Now listen carefully! Below us there are tunnels that have been created naturally over the years"), SAY_SAY, 4000}})
   438 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Now listen carefully! Below us there are tunnels that have been created naturally over the years"), SAY_SAY, 4000}})
   439 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("I have heared the local tribes saying that many years ago some PAotH scientists were dumping their waste here"), SAY_SAY, 5000}})
   439 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("I have heard that the local tribes say that many years ago some PAotH scientists were dumping their waste here"), SAY_SAY, 5000}})
   440 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("H confimed that there isn't such a PAotH activity logged"), SAY_SAY, 4000}})
   440 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("H confirmed that there isn't such a PAotH activity logged"), SAY_SAY, 4000}})
   441 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("So, I believe that it's a good place to start"), SAY_SAY, 3000}})
   441 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("So, I believe that it's a good place to start"), SAY_SAY, 3000}})
   442 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Beware though! Many smugglers come often to explore these tunnels and scavage whatever valuable items they can find"), SAY_SAY, 5000}})
   442 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Beware though! Many smugglers come often to explore these tunnels and scavage whatever valuable items they can find"), SAY_SAY, 5000}})
   443 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("They won't hesitate to attack you in order to rob you!"), SAY_SAY, 4000}})
   443 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("They won't hesitate to attack you in order to rob you!"), SAY_SAY, 4000}})
   444 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 6000}})
   444 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 6000}})
   445 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("OK, I'll be extra careful!"), SAY_SAY, 4000}})
   445 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("OK, I'll be extra careful!"), SAY_SAY, 4000}})
   446 	table.insert(dialog01, {func = AnimWait, args = {ally.gear, 2000}})
   446 	table.insert(dialog01, {func = AnimWait, args = {ally.gear, 2000}})
   447 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("There is the tunnel entrance"), SAY_SAY, 3000}})
   447 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("There is the tunnel entrance"), SAY_SAY, 3000}})
   448 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Good luck!"), SAY_SAY, 3000}})
   448 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Good luck!"), SAY_SAY, 3000}})
   449 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   449 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   450 	table.insert(dialog01, {func = startMission, args = {hero.gear}})	
   450 	table.insert(dialog01, {func = startMission, args = {hero.gear}})
   451 end
   451 end
   452 
   452 
   453 --------------- OTHER FUNCTIONS ------------------
   453 --------------- OTHER FUNCTIONS ------------------
   454 
   454 
   455 function startMission()
   455 function startMission()
   459 
   459 
   460 function secondBattle()
   460 function secondBattle()
   461 	-- second battle
   461 	-- second battle
   462 	heroIsInBattle = true
   462 	heroIsInBattle = true
   463 	ongoingBattle = 2
   463 	ongoingBattle = 2
   464 	AnimSay(smuggler2.gear, loc("This is seems like a wealthy hedgehog, nice..."), SAY_THINK, 5000)	
   464 	AnimSay(smuggler2.gear, loc("This is seems like a wealthy hedgehog, nice..."), SAY_THINK, 5000)
   465 	AnimSwitchHog(smuggler2.gear)
   465 	AnimSwitchHog(smuggler2.gear)
   466 	TurnTimeLeft = 0
   466 	TurnTimeLeft = 0
   467 end
   467 end
   468 
   468 
   469 function saveCheckPointLocal(cpoint)
   469 function saveCheckPointLocal(cpoint)
   470 	-- save checkpoint
   470 	-- save checkpoint
   471 	saveCheckpoint(cpoint)	
   471 	saveCheckpoint(cpoint)
   472 	SaveCampaignVar("HeroHealth", GetHealth(hero.gear))
   472 	SaveCampaignVar("HeroHealth", GetHealth(hero.gear))
   473 	-- bazooka - grenade - rope - parachute - deagle - btorch - construct - portal - rcplane
   473 	-- bazooka - grenade - rope - parachute - deagle - btorch - construct - portal - rcplane
   474 	SaveCampaignVar("HeroAmmo", GetAmmoCount(hero.gear, amBazooka)..GetAmmoCount(hero.gear, amGrenade)..
   474 	SaveCampaignVar("HeroAmmo", GetAmmoCount(hero.gear, amBazooka)..GetAmmoCount(hero.gear, amGrenade)..
   475 			GetAmmoCount(hero.gear, amRope)..GetAmmoCount(hero.gear, amParachute)..GetAmmoCount(hero.gear, amDEagle)..
   475 			GetAmmoCount(hero.gear, amRope)..GetAmmoCount(hero.gear, amParachute)..GetAmmoCount(hero.gear, amDEagle)..
   476 			GetAmmoCount(hero.gear, amBlowTorch)..GetAmmoCount(hero.gear, amConstruction)..
   476 			GetAmmoCount(hero.gear, amBlowTorch)..GetAmmoCount(hero.gear, amConstruction)..
   495 	AddAmmo(hero.gear, amRCPlane, tonumber(ammo:sub(9,9)))
   495 	AddAmmo(hero.gear, amRCPlane, tonumber(ammo:sub(9,9)))
   496 end
   496 end
   497 
   497 
   498 function checkForWin()
   498 function checkForWin()
   499 	if cratesFound ==  0 then
   499 	if cratesFound ==  0 then
   500 		-- have to look more		
   500 		-- have to look more
   501 		AnimSay(hero.gear, loc("Haven't found it yet..."), SAY_THINK, 5000)
   501 		AnimSay(hero.gear, loc("Haven't found it yet..."), SAY_THINK, 5000)
   502 		cratesFound = cratesFound + 1
   502 		cratesFound = cratesFound + 1
   503 	elseif cratesFound == 1 then
   503 	elseif cratesFound == 1 then
   504 		-- end game
   504 		-- end game
   505 		saveCompletedStatus(5)
   505 		saveCompletedStatus(5)