share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua
branchspacecampaign
changeset 9400 b0c1b1972947
parent 9398 3f2ec6e1032f
child 9402 8e9d062f9a48
equal deleted inserted replaced
9398:3f2ec6e1032f 9400:b0c1b1972947
     5 -- knows where the device is hidden. Hero will be
     5 -- knows where the device is hidden. Hero will be
     6 -- able to use only the ice gun for this mission.
     6 -- able to use only the ice gun for this mission.
     7 
     7 
     8 -- TODO
     8 -- TODO
     9 -- TEST TEST AND MORE TEST
     9 -- TEST TEST AND MORE TEST
    10 -- increase health in checkpoint 3
       
    11 -- fix the stats
    10 -- fix the stats
    12 
    11 
    13 HedgewarsScriptLoad("/Scripts/Locale.lua")
    12 HedgewarsScriptLoad("/Scripts/Locale.lua")
    14 HedgewarsScriptLoad("/Scripts/Animate.lua")
    13 HedgewarsScriptLoad("/Scripts/Animate.lua")
    15 
    14 
    22 local heroAtFinalStep = false
    21 local heroAtFinalStep = false
    23 local iceGunTaken = false
    22 local iceGunTaken = false
    24 local checkPointReached = 1 -- 1 is normal spawn
    23 local checkPointReached = 1 -- 1 is normal spawn
    25 -- dialogs
    24 -- dialogs
    26 local dialog01 = {}
    25 local dialog01 = {}
       
    26 local dialog02 = {}
    27 -- mission objectives
    27 -- mission objectives
    28 local goals = {
    28 local goals = {
    29 	[dialog01] = {missionName, loc("Getting ready"), loc("Collect the icegun and get the device part from Thanta"), 1, 4500},
    29 	[dialog01] = {missionName, loc("Getting ready"), loc("Collect the icegun and get the device part from Thanta"), 1, 4500},
    30 }
    30 }
    31 -- crates
    31 -- crates
   379 	end
   379 	end
   380 	return false
   380 	return false
   381 end
   381 end
   382 
   382 
   383 function onHeroWin(gear)
   383 function onHeroWin(gear)
   384 	if (not hero.dead and not bandit1.dead) and (GetX(hero.gear)>=GetX(bandit1.gear)-15 and GetX(hero.gear)<=GetX(bandit1.gear)+15)
   384 	if (not hero.dead and not bandit1.dead) and (GetX(hero.gear)>=GetX(bandit1.gear)-80 and GetX(hero.gear)<=GetX(bandit1.gear)+80)
   385 		and (GetY(hero.gear)>=GetY(bandit1.gear)-15 and GetY(hero.gear)<=GetY(bandit1.gear)+15) then
   385 		and (GetY(hero.gear)>=GetY(bandit1.gear)-30 and GetY(hero.gear)<=GetY(bandit1.gear)+30) then
   386 		return true
   386 		return true
   387 	end
   387 	end
   388 	return false
   388 	return false
   389 end
   389 end
   390 
   390 
   438 	-- more custom stats
   438 	-- more custom stats
   439 	EndGame()
   439 	EndGame()
   440 end
   440 end
   441 
   441 
   442 function heroWin(gear)
   442 function heroWin(gear)
   443 	SendStat('siGameResult', loc("Congratulations, you got the part!"))
   443 	TurnTimeLeft=0
   444 	-- more custom stats
   444 	if GetX(hero.gear) < GetX(bandit1.gear) then
   445 	EndGame()
   445 		HogTurnLeft(bandit1.gear, true)
       
   446 	else
       
   447 		HogTurnLeft(bandit1.gear, false)
       
   448 	end
       
   449 	AddAnim(dialog02)
   446 end
   450 end
   447 
   451 
   448 -------------- ANIMATIONS ------------------
   452 -------------- ANIMATIONS ------------------
   449 
   453 
   450 function Skipanim(anim)
   454 function Skipanim(anim)
   451 	if goals[anim] ~= nil then
   455 	if goals[anim] ~= nil then
   452 		ShowMission(unpack(goals[anim]))
   456 		ShowMission(unpack(goals[anim]))
   453     end
   457     end    
       
   458     if anim == dialog02 then
       
   459 		actionsOnWin()
       
   460 	end
   454 end
   461 end
   455 
   462 
   456 function AnimationSetup()
   463 function AnimationSetup()
   457 	-- DIALOG 01 - Start, welcome to moon
   464 	-- DIALOG 01 - Start, welcome to moon
   458 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   465 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   469 	table.insert(dialog01, {func = AnimWait, args = {ally.gear, 4000}})
   476 	table.insert(dialog01, {func = AnimWait, args = {ally.gear, 4000}})
   470 	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}})
   477 	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}})
   471 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("There is one below us!"), SAY_SAY, 4000}})
   478 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("There is one below us!"), SAY_SAY, 4000}})
   472 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   479 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   473 	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
   480 	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
   474 end
   481 	-- DIALOG 02 - Hero got to Thant2
       
   482 	AddSkipFunction(dialog02, Skipanim, {dialog01})
       
   483 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3000}})
       
   484 	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Congratulations, now you can take Thanta's part..."), 5000}})
       
   485 	table.insert(dialog02, {func = AnimSay, args = {bandit1.gear, loc("Oh! Please pare me. You can take all my treasures!"), SAY_SAY, 3000}})
       
   486 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 5000}})
       
   487 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I just want the strange device you found!"), SAY_SAY, 3000}})
       
   488 	table.insert(dialog02, {func = AnimWait, args = {bandit1.gear, 4000}})
       
   489 	table.insert(dialog02, {func = AnimSay, args = {bandit1.gear, loc("Here! Take it..."), SAY_SAY, 3000}})
       
   490 	table.insert(dialog02, {func = actionsOnWin, args = {}})	
       
   491 end
       
   492 
       
   493 -------------- Other Functions -------------------
       
   494 
       
   495 function actionsOnWin()
       
   496 	SendStat('siGameResult', loc("Congratulations, you got the part!"))
       
   497 	SaveCampaignVar("IcePlanetPartAcquired", "true")
       
   498 	-- more custom stats
       
   499 	EndGame()
       
   500 end