share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua
changeset 9733 37f84780eb14
parent 9642 8a691e0f117a
child 9757 9be28be004d4
equal deleted inserted replaced
9732:a13afa6c5d21 9733:37f84780eb14
    16 local campaignName = loc("A Space Adventure")
    16 local campaignName = loc("A Space Adventure")
    17 local missionName = loc("The first stop")
    17 local missionName = loc("The first stop")
    18 local weaponsAcquired = false
    18 local weaponsAcquired = false
    19 local battleZoneReached = false
    19 local battleZoneReached = false
    20 local checkPointReached = 1 -- 1 is start of the game
    20 local checkPointReached = 1 -- 1 is start of the game
       
    21 local afterDialog02 = false
    21 -- dialogs
    22 -- dialogs
    22 local dialog01 = {}
    23 local dialog01 = {}
    23 local dialog02 = {}
    24 local dialog02 = {}
    24 local dialog03 = {}
    25 local dialog03 = {}
    25 local dialog04 = {}
    26 local dialog04 = {}
   200 		AddAmmo(hero.gear, amGrenade, 6)
   201 		AddAmmo(hero.gear, amGrenade, 6)
   201 		AddAmmo(hero.gear, amDEagle, 4)
   202 		AddAmmo(hero.gear, amDEagle, 4)
   202 		SetWind(60)		
   203 		SetWind(60)		
   203 		GameFlags = bor(GameFlags,gfDisableWind)
   204 		GameFlags = bor(GameFlags,gfDisableWind)
   204 		weaponsAcquired = true
   205 		weaponsAcquired = true
       
   206 		afterDialog02 = true
   205 		TurnTimeLeft = 0
   207 		TurnTimeLeft = 0
   206 		AddAnim(dialog02)
   208 		AddAnim(dialog02)
   207 	end
   209 	end
   208 	-- this event check goes here to be executed after the onWeaponsPlatform check
   210 	-- this event check goes here to be executed after the onWeaponsPlatform check
   209 	AddEvent(onBattleZone, {hero.gear}, battleZone, {hero.gear}, 0)
   211 	AddEvent(onBattleZone, {hero.gear}, battleZone, {hero.gear}, 0)
   232 
   234 
   233 function onNewTurn()		
   235 function onNewTurn()		
   234 	-- rounds start if hero got his weapons or got near the enemies
   236 	-- rounds start if hero got his weapons or got near the enemies
   235 	if not weaponsAcquired and not battleZoneReached and CurrentHedgehog ~= hero.gear then
   237 	if not weaponsAcquired and not battleZoneReached and CurrentHedgehog ~= hero.gear then
   236 		TurnTimeLeft = 0
   238 		TurnTimeLeft = 0
   237 	elseif weaponsAcquired and not battleZoneReached and CurrentHedgehog ~= hero.gear then
   239 	elseif weaponsAcquired and not battleZoneReached and CurrentHedgehog ~= hero.gear and afterDialog02 then
   238 		battleZoneReached = true
   240 		battleZone(hero.gear)
   239 		AddAnim(dialog04)
       
   240 	elseif not weaponsAcquired and not battleZoneReached and CurrentHedgehog == hero.gear then
   241 	elseif not weaponsAcquired and not battleZoneReached and CurrentHedgehog == hero.gear then
   241 		TurnTimeLeft = -1
   242 		TurnTimeLeft = -1
   242 	elseif CurrentHedgehog == paoth1.gear or CurrentHedgehog == paoth2.gear
   243 	elseif CurrentHedgehog == paoth1.gear or CurrentHedgehog == paoth2.gear
   243 		or CurrentHedgehog == paoth3.gear or CurrentHedgehog == paoth4.gear then
   244 		or CurrentHedgehog == paoth3.gear or CurrentHedgehog == paoth4.gear then
   244 		TurnTimeLeft = 0
   245 		TurnTimeLeft = 0
   316 
   317 
   317 function weaponsPlatform(gear)
   318 function weaponsPlatform(gear)
   318 	saveCheckpoint("2")
   319 	saveCheckpoint("2")
   319 	SaveCampaignVar("HeroHealth",GetHealth(hero.gear))
   320 	SaveCampaignVar("HeroHealth",GetHealth(hero.gear))
   320 	TurnTimeLeft = 0
   321 	TurnTimeLeft = 0
   321 	weaponsAqcuired = true
   322 	weaponsAcquired = true
   322 	SetWind(60)		
   323 	SetWind(60)		
   323 	GameFlags = bor(GameFlags,gfDisableWind)
   324 	GameFlags = bor(GameFlags,gfDisableWind)
   324 	AddAmmo(hero.gear, amRope, 0)
   325 	AddAmmo(hero.gear, amRope, 0)
   325 	if GetX(hero.gear) < 1900 then
   326 	if GetX(hero.gear) < 1900 then
   326 		AddAnim(dialog02)
   327 		AddAnim(dialog02)
   336 end
   337 end
   337 
   338 
   338 function battleZone(gear)
   339 function battleZone(gear)
   339 	TurnTimeLeft = 0
   340 	TurnTimeLeft = 0
   340 	battleZoneReached = true
   341 	battleZoneReached = true
   341 	if weaponsAqcuired then
   342 	if weaponsAcquired then
   342 		AddAnim(dialog04)
   343 		AddAnim(dialog04)
   343 	else
   344 	else
   344 		AddAnim(dialog03)
   345 		AddAnim(dialog03)
   345 	end
   346 	end
   346 end
   347 end
   394 
   395 
   395 function Skipanim(anim)
   396 function Skipanim(anim)
   396 	if goals[anim] ~= nil then
   397 	if goals[anim] ~= nil then
   397 		ShowMission(unpack(goals[anim]))
   398 		ShowMission(unpack(goals[anim]))
   398     end
   399     end
   399     if anim == dialog03 then
   400     if anim == dialog02 then
       
   401 		setAfterDialog02()
       
   402     elseif anim == dialog03 then
   400 		startCombat()
   403 		startCombat()
   401 	else
   404 	else
   402 		AnimSwitchHog(hero.gear)
   405 		AnimSwitchHog(hero.gear)
   403 	end
   406 	end
   404 end
   407 end
   410 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Near PAotH base at moon..."),  4000}})
   413 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Near PAotH base at moon..."),  4000}})
   411 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Hey Hog Solo! Finaly you have come..."), SAY_SAY, 2000}})
   414 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Hey Hog Solo! Finaly you have come..."), SAY_SAY, 2000}})
   412 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("It seems that Professor Hogevil learned for your arrival!"), SAY_SAY, 4000}})
   415 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("It seems that Professor Hogevil learned for your arrival!"), SAY_SAY, 4000}})
   413 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Now he have captured the rest of the PAotH team and awaits to capture you!"), SAY_SAY, 5000}})
   416 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Now he have captured the rest of the PAotH team and awaits to capture you!"), SAY_SAY, 5000}})
   414 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("We have to hurry! Are you armed?"), SAY_SAY, 4300}})
   417 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("We have to hurry! Are you armed?"), SAY_SAY, 4300}})
   415 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   418 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 450}})
   416 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("No, I am afraid I had to travel light"), SAY_SAY, 2500}})
   419 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("No, I am afraid I had to travel light"), SAY_SAY, 2500}})
   417 	table.insert(dialog01, {func = AnimWait, args = {paoth1.gear, 500}})
   420 	table.insert(dialog01, {func = AnimWait, args = {paoth1.gear, 3200}})
   418 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Ok, then you have to go and take some of the waepons we have hidden in case of an emergency!"), SAY_SAY, 7000}})
   421 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Ok, then you have to go and take some of the waepons we have hidden in case of an emergency!"), SAY_SAY, 7000}})
   419 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("They are up there! Take that rope and hurry!"), SAY_SAY, 7000}})
   422 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("They are up there! Take that rope and hurry!"), SAY_SAY, 7000}})
   420 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Ehm... ok..."), SAY_SAY, 2500}})
   423 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Ehm... ok..."), SAY_SAY, 2500}})
   421 	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
   424 	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
   422 	-- DIALOG 02 - To the weapons platform
   425 	-- DIALOG 02 - To the weapons platform
   423 	AddSkipFunction(dialog02, Skipanim, {dialog02})
   426 	AddSkipFunction(dialog02, Skipanim, {dialog02})
   424 	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Checkpoint reached!"),  4000}})
   427 	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Checkpoint reached!"),  4000}})
   425 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I've made it! YEAAAAAH!"), SAY_SHOUT, 4000}})
   428 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I've made it! YEAAAAAH!"), SAY_SHOUT, 4000}})
   426 	table.insert(dialog02, {func = AnimSay, args = {paoth1.gear, loc("Nice! Now hurry up and get down! You have to rescue my friends!"), SAY_SHOUT, 7000}})
   429 	table.insert(dialog02, {func = AnimSay, args = {paoth1.gear, loc("Nice! Now hurry up and get down! You have to rescue my friends!"), SAY_SHOUT, 7000}})
       
   430 	table.insert(dialog02, {func = setAfterDialog02, args = {}})
   427 	table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}})
   431 	table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}})
   428 	-- DIALOG 03 - Hero spotted and has no weapons
   432 	-- DIALOG 03 - Hero spotted and has no weapons
   429 	AddSkipFunction(dialog03, Skipanim, {dialog03})
   433 	AddSkipFunction(dialog03, Skipanim, {dialog03})
   430 	table.insert(dialog03, {func = AnimCaption, args = {hero.gear, loc("Get ready to fight!"), 4000}})
   434 	table.insert(dialog03, {func = AnimCaption, args = {hero.gear, loc("Get ready to fight!"), 4000}})
   431 	table.insert(dialog03, {func = AnimSay, args = {minion1.gear, loc("Look boss! There is the target!"), SAY_SHOUT, 4000}})
   435 	table.insert(dialog03, {func = AnimSay, args = {minion1.gear, loc("Look boss! There is the target!"), SAY_SHOUT, 4000}})
   442 end
   446 end
   443 
   447 
   444 ------------------- custom "animation" functions --------------------------
   448 ------------------- custom "animation" functions --------------------------
   445 
   449 
   446 function startCombat()
   450 function startCombat()
   447 	-- use this so guard2 will gain control
   451 	-- use this so minion3 will gain control
   448 	AnimSwitchHog(minion3.gear)
   452 	AnimSwitchHog(minion3.gear)
   449 	TurnTimeLeft = 0
   453 	TurnTimeLeft = 0
   450 end
   454 end
       
   455 
       
   456 function setAfterDialog02()
       
   457 	afterDialog02 = true
       
   458 end