share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit02.lua
branchspacecampaign
changeset 9529 e95aab9130d8
parent 9527 676fc574ff42
child 9532 4fa58a49ace1
equal deleted inserted replaced
9527:676fc574ff42 9529:e95aab9130d8
     7 HedgewarsScriptLoad("/Scripts/Animate.lua")
     7 HedgewarsScriptLoad("/Scripts/Animate.lua")
     8 
     8 
     9 ----------------- VARIABLES --------------------
     9 ----------------- VARIABLES --------------------
    10 -- globals
    10 -- globals
    11 local campaignName = loc("A Space Adventure")
    11 local campaignName = loc("A Space Adventure")
    12 local missionName = loc("Fruit planet, Searching the Part!")
    12 local missionName = loc("Fruit planet, Searching the Device!")
    13 local inBattle = false
    13 local inBattle = false
       
    14 local tookPartInBattle = false
    14 -- dialogs
    15 -- dialogs
    15 local dialog01 = {}
    16 local dialog01 = {}
    16 local dialog02 = {}
    17 local dialog02 = {}
    17 local dialog03 = {}
    18 local dialog03 = {}
    18 -- mission objectives
    19 -- mission objectives
    19 local goals = {
    20 local goals = {
    20 	[dialog01] = {missionName, loc("Ready for Battle?"), loc("Walk left if you want to join Captain Lime or right if you want to decline his offer"), 1, 4000},
    21 	[dialog01] = {missionName, loc("Getting the Device"), loc("With the help of the other hogs search for the device").."|"..loc("Hog Solo has to reach the last crates"), 1, 4000},
    21 	[dialog02] = {missionName, loc("Battle Starts Now!"), loc("You have choose to fight! Lead the Green Bananas to battle and try not to let them be killed"), 1, 4000},
    22 	[dialog02] = {missionName, loc("Battle Starts Now!"), loc("You have choose to fight! Lead the Green Bananas to battle and try not to let them be killed"), 1, 4000},
    22 	[dialog03] = {missionName, loc("Ready for Battle?"), loc("You have choose to flee... Unfortunately the only place where you can launch your saucer is in the most left side of the map"), 1, 4000},
    23 	[dialog03] = {missionName, loc("Ready for Battle?"), loc("You have choose to flee... Unfortunately the only place where you can launch your saucer is in the most left side of the map"), 1, 4000},
    23 }
    24 }
    24 -- crates types=[0:ammo,1:utility,2:health]
    25 -- crates types=[0:ammo,1:utility,2:health]
    25 local crates = {
    26 local crates = {
    99 		redHedgehogs[i].gear =  AddHog(redHedgehogs[i].name, 0, 100, "war_desertgrenadier1")
   100 		redHedgehogs[i].gear =  AddHog(redHedgehogs[i].name, 0, 100, "war_desertgrenadier1")
   100 		AnimSetGearPosition(redHedgehogs[i].gear, 2010 + 50*i, 630)
   101 		AnimSetGearPosition(redHedgehogs[i].gear, 2010 + 50*i, 630)
   101 	end
   102 	end
   102 
   103 
   103 	AnimInit()
   104 	AnimInit()
   104 	--AnimationSetup()	
   105 	AnimationSetup()	
   105 end
   106 end
   106 
   107 
   107 function onGameStart()
   108 function onGameStart()
   108 	AnimWait(hero.gear, 3000)
   109 	AnimWait(hero.gear, 3000)
   109 	FollowGear(hero.gear)
   110 	FollowGear(hero.gear)
       
   111 	
       
   112 	if GetCampaignVar(Fruit01JoinedBattle) and GetCampaignVar(Fruit01JoinedBattle) == "true" then
       
   113 		tookPartInBattle = true
       
   114 	end
   110 	
   115 	
   111 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   116 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   112 	
   117 	
   113 	-- Hog Solo and GB weapons
   118 	-- Hog Solo and GB weapons
   114 	AddAmmo(hero.gear, amFirePunch, 3)
   119 	AddAmmo(hero.gear, amFirePunch, 3)
   155 	AddGear(3105, 1680, gtMine, 0, 0, 0, 0)
   160 	AddGear(3105, 1680, gtMine, 0, 0, 0, 0)
   156 	AddGear(3095, 1680, gtMine, 0, 0, 0, 0)
   161 	AddGear(3095, 1680, gtMine, 0, 0, 0, 0)
   157 	AddGear(3085, 1680, gtMine, 0, 0, 0, 0)
   162 	AddGear(3085, 1680, gtMine, 0, 0, 0, 0)
   158 	AddGear(3075, 1680, gtMine, 0, 0, 0, 0)
   163 	AddGear(3075, 1680, gtMine, 0, 0, 0, 0)
   159 	
   164 	
   160 	--AddAnim(dialog01)
   165 	if tookPartInBattle then
       
   166 		AddAnim(dialog01)
       
   167 	else
       
   168 		AddAnim(dialog02)
       
   169 	end
       
   170 	
   161 	SendHealthStatsOff()
   171 	SendHealthStatsOff()
   162 end
   172 end
   163 
   173 
   164 function onNewTurn()
   174 function onNewTurn()
   165 	if CurrentHedgehog == green1.gear then
   175 	if CurrentHedgehog == green1.gear then
   219 		ShowMission(unpack(goals[anim]))
   229 		ShowMission(unpack(goals[anim]))
   220     end
   230     end
   221 end
   231 end
   222 
   232 
   223 function AnimationSetup()
   233 function AnimationSetup()
   224 	-- DIALOG 01 - Start, Captain Lime talks explains to Hog Solo
   234 	-- DIALOG 01 - Start, Captain Lime helps Hog Solo because he took part in the battle
   225 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   235 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   226 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
   236 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
   227 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere in the planet of fruits a terrible war is about to begin..."), 5000}})
   237 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere else in the planet of fruits Captain Lime helps Hog Solo..."), 5000}})
   228 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("I was told that as the leader of the king's guard, no one knows this world better than you!"), SAY_SAY, 5000}})
   238 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("You fought bravely and you helped us win this battle!"), SAY_SAY, 5000}})
   229 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("So, I kindly ask for your help."), SAY_SAY, 3000}})
   239 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("So, as promised I have brought you where I think that the device you are looking is hidden."), SAY_SAY, 7000}})
   230 	table.insert(dialog01, {func = AnimWait, args = {green1.gear, 2000}})
   240 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("I know that your resources are low due to the battle but I'll send with you two of my best hogs to assist you."), SAY_SAY, 7000}})
   231 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("You couldn't have come to a worse time Hog Solo!"), SAY_SAY, 3000}})
   241 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("Good luck!"), SAY_SAY, 2000}})
   232 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("The clan of the Red Strawberry wants to take over the dominion and overthrone king Pineapple."), SAY_SAY, 5000}})
       
   233 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("Under normal circumstances we could easily defeat them but we have kindly sent most of our men to the kingdom of sand to help to the annual dusting of the king's palace."), SAY_SAY, 8000}})
       
   234 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("However the army of Yellow Watermelons is about to attack any moment now."), SAY_SAY, 4000}})
       
   235 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("I would gladly help you if we won this battle but under these circumstances I'll only help you if you fight for our side."), SAY_SAY, 6000}})
       
   236 	table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("What do you say? Will you fight for us?"), SAY_SAY, 3000}})
       
   237 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   242 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   238 	table.insert(dialog01, {func = ShowMission, args = {missionName, loc("Ready for Battle?"), loc("Walk left if you want to join Captain Lime or right if you want to decline his offer"), 1, 7000}})
       
   239 	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
   243 	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
       
   244 	-- DIALOG02 - Start, Hog Solo escaped from the previous battle
       
   245 	AddSkipFunction(dialog02, Skipanim, {dialog02})
       
   246 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3000}})
       
   247 	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Somewhere else in the planet of fruits Hog Solo gets closer to the device..."), 5000}})
       
   248 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You are the one who fled! So, you are alive..."), SAY_SAY, 4000}})
       
   249 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I'm still low on hogs. If you are not afraid I could use a set of extra hands"), SAY_SAY, 4000}})
       
   250 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 8000}})
       
   251 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I am sorry but I was looking for a device that may be hidden somewhere around here"), SAY_SAY, 4500}})
       
   252 	table.insert(dialog02, {func = AnimWait, args = {green1.gear, 12500}})
       
   253 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Many long forgotten things can be found in the same tunnels that we are about to search!"), SAY_SAY, 7000}})
       
   254 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("If you help us you can keep the device if you find it but we'll keep everything else"), SAY_SAY, 7000}})
       
   255 	table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("What do you say? Are you in?"), SAY_SAY, 3000}})
       
   256 	table.insert(dialog02, {func = AnimWait, args = {hero.gear, 1800}})
       
   257 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("Ok then!"), SAY_SAY, 2000}})
       
   258 	table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}})
   240 end
   259 end
   241 
   260 
   242 ------------- OTHER FUNCTIONS ---------------
   261 ------------- OTHER FUNCTIONS ---------------
   243 
   262