share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon01.lua
branchspacecampaign
changeset 9312 f6bec1cfbfbd
parent 9310 1469147c110f
child 9314 b7ee054888f8
equal deleted inserted replaced
9310:1469147c110f 9312:f6bec1cfbfbd
       
     1 ------------------- ABOUT ----------------------
       
     2 --
       
     3 -- This is the first stop of hero's journey.
       
     4 -- Here he'll get fuels to continue traveling.
       
     5 -- However, the PAoTH allies of the hero have
       
     6 -- been taken hostages by professor Hogevil.
       
     7 -- So hero has to get whatever available equipement
       
     8 -- there is and rescue them.
       
     9 
       
    10 -- TODO
       
    11 -- Fix some glitches when gaining control on animations
       
    12 -- Continue with the rest :P
       
    13 
     1 HedgewarsScriptLoad("/Scripts/Locale.lua")
    14 HedgewarsScriptLoad("/Scripts/Locale.lua")
     2 HedgewarsScriptLoad("/Scripts/Animate.lua")
    15 HedgewarsScriptLoad("/Scripts/Animate.lua")
     3 
    16 
     4 ----------------- VARIABLES --------------------
    17 ----------------- VARIABLES --------------------
     5 
    18 -- globals
       
    19 local campaignName = loc("A Space Adventure")
       
    20 local missionName = loc("Moon, stop for fuels!")
       
    21 -- dialogs
       
    22 local dialog01 = {}
       
    23 local dialog02 = {}
       
    24 -- mission objectives
       
    25 local goals = {
       
    26 	[dialog01] = {missionName, loc("Getting ready"), loc("Go to the upper platform and get the weapons in the crates!"), 1, 4500},
       
    27 	[dialog02] = {missionName, loc("Prepare to fight"), loc("Go down and save these PAoTH hogs!"), 1, 5000}
       
    28 }
       
    29 -- crates
       
    30 local weaponsY = 100
       
    31 local bazookaX = 70
       
    32 local parachuteX = 110
       
    33 local grenadeX = 160
       
    34 local deserteagleX = 200
       
    35 local torchblowX = 3270
       
    36 -- hogs
       
    37 local hero = {}
       
    38 local paoth1 = {}
       
    39 local paoth2 = {}
       
    40 local paoth3 = {}
       
    41 local paoth4 = {}
       
    42 local professor = {}
       
    43 local minion1 = {}
       
    44 local minion2 = {}
       
    45 local minion3 = {}
       
    46 local minion4 = {}
       
    47 -- teams
       
    48 local teamA = {}
       
    49 local teamB = {}
       
    50 local teamC = {}
       
    51 local teamD = {}
       
    52 -- hedgehogs values
       
    53 hero.name = "Hog Solo"
       
    54 hero.x = 1380
       
    55 hero.y = 1750
       
    56 paoth1.name = "Joe"
       
    57 paoth1.x = 1430
       
    58 paoth1.y = 1750
       
    59 paoth2.name = "Bruce"
       
    60 paoth2.x = 3760
       
    61 paoth2.y = 1800
       
    62 paoth3.name = "Helena"
       
    63 paoth3.x = 3800
       
    64 paoth3.y = 1800
       
    65 paoth4.name = "Boris"
       
    66 paoth4.x = 3860
       
    67 paoth4.y = 1800
       
    68 professor.name = "Pr.Hogevil"
       
    69 professor.x = 3710
       
    70 professor.y = 1650
       
    71 minion1.name = "Minion"
       
    72 minion1.x = 2460
       
    73 minion1.y = 1450
       
    74 minion2.name = "Minion"
       
    75 minion2.x = 2450
       
    76 minion2.y = 1900
       
    77 minion3.name = "Minion"
       
    78 minion3.x = 3500
       
    79 minion3.y = 1750
       
    80 teamA.name = loc("PAoTH")
       
    81 teamA.color = tonumber("FF0000",16) -- red
       
    82 teamB.name = loc("Minions")
       
    83 teamB.color = tonumber("0033FF",16) -- blue
       
    84 teamC.name = loc("Professor")
       
    85 teamC.color = tonumber("0033FF",16) -- blue
       
    86 teamD.name = loc("Hog Solo")
       
    87 teamD.color = tonumber("38D61C",16) -- green
     6 
    88 
     7 -------------- LuaAPI EVENT HANDLERS ------------------
    89 -------------- LuaAPI EVENT HANDLERS ------------------
     8 
    90 
     9 function onGameInit()
    91 function onGameInit()
    10 	Seed = 1
    92 	Seed = 1
    11 	GameFlags = gfInfAttack + gfSolidLand + gfDisableWind 
    93 	GameFlags = gfInfAttack + gfSolidLand + gfDisableWind 
    12 	TurnTime = 100000 
    94 	TurnTime = 45000
    13 	CaseFreq = 0
    95 	CaseFreq = 0
    14 	MinesNum = 0
    96 	MinesNum = 0
    15 	MinesTime = 3000
    97 	MinesTime = 3000
    16 	Explosives = 0
    98 	Explosives = 0
    17 	Delay = 10 
    99 	Delay = 5 
    18 	Map = "moon01_map"
   100 	Map = "moon01_map"
    19 	Theme = "Cheese"
   101 	Theme = "Cheese" -- Because ofc moon is made of cheese :)
       
   102 	-- Hog Solo
       
   103 	AddTeam(teamD.name, teamD.color, "Bone", "Island", "HillBilly", "cm_birdy")
       
   104 	hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
       
   105 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
       
   106 	-- PAoTH
       
   107 	AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
       
   108 	paoth1.gear = AddHog(paoth1.name, 0, 100, "war_desertgrenadier1")
       
   109 	AnimSetGearPosition(paoth1.gear, paoth1.x, paoth1.y)
       
   110 	HogTurnLeft(paoth1.gear, true)
       
   111 	paoth2.gear = AddHog(paoth2.name, 0, 100, "war_desertgrenadier1")
       
   112 	AnimSetGearPosition(paoth2.gear, paoth2.x, paoth2.y)
       
   113 	HogTurnLeft(paoth2.gear, true)
       
   114 	paoth3.gear = AddHog(paoth3.name, 0, 100, "war_desertgrenadier1")
       
   115 	AnimSetGearPosition(paoth3.gear, paoth3.x, paoth3.y)
       
   116 	HogTurnLeft(paoth3.gear, true)
       
   117 	paoth4.gear = AddHog(paoth4.name, 0, 100, "war_desertgrenadier1")
       
   118 	AnimSetGearPosition(paoth4.gear, paoth4.x, paoth4.y)
       
   119 	HogTurnLeft(paoth4.gear, true)
       
   120 	-- Professor
       
   121 	AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy")
       
   122 	professor.gear = AddHog(professor.name, 0, 100, "war_desertgrenadier1")
       
   123 	AnimSetGearPosition(professor.gear, professor.x, professor.y)
       
   124 	HogTurnLeft(professor.gear, true)
       
   125 	-- Minions
       
   126 	AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy")
       
   127 	minion1.gear = AddHog(minion1.name, 0, 100, "war_desertgrenadier1")
       
   128 	AnimSetGearPosition(minion1.gear, minion1.x, minion1.y)
       
   129 	HogTurnLeft(minion1.gear, true)
       
   130 	minion2.gear = AddHog(minion2.name, 0, 100, "war_desertgrenadier1")
       
   131 	AnimSetGearPosition(minion2.gear, minion2.x, minion2.y)
       
   132 	HogTurnLeft(minion2.gear, true)
       
   133 	minion3.gear = AddHog(minion3.name, 0, 100, "war_desertgrenadier1")
       
   134 	AnimSetGearPosition(minion3.gear, minion3.x, minion3.y)
       
   135 	HogTurnLeft(minion3.gear, true)	
       
   136 	
       
   137 	AnimInit()
       
   138 	AnimationSetup()	
    20 end
   139 end
    21 
   140 
    22 function onGameStart()
   141 function onGameStart()
    23 
   142 	-- wait for the first turn to start
    24 end
   143 	AnimWait(hero.gear, 3000)
       
   144 
       
   145 	FollowGear(hero.gear)
       
   146 	
       
   147 	ShowMission(campaignName, missionName, loc("Hog Solo has to refuel his saucer.")..
       
   148 	"|"..loc("Rescue the imprisoned PAoTH team and get your fuels!"), -amSkip, 0)
       
   149 	
       
   150 	AddAmmo(hero.gear, amRope, 2)
       
   151 	SpawnAmmoCrate(bazookaX, weaponsY, amBazooka)
       
   152 	SpawnAmmoCrate(parachuteX, weaponsY, amParachute)
       
   153 	SpawnAmmoCrate(grenadeX, weaponsY, amGrenade)
       
   154 	SpawnAmmoCrate(deserteagleX, weaponsY, amDEagle)
       
   155 	
       
   156 	AddEvent(onWeaponsPlatform, {hero.gear}, weaponsPlatform, {hero.gear}, 0)
       
   157 
       
   158 	AddAnim(dialog01)
       
   159 end
       
   160 
       
   161 function onAmmoStoreInit()
       
   162 	SetAmmo(amBazooka, 0, 0, 0, 2)
       
   163 	SetAmmo(amParachute, 0, 0, 0, 2)
       
   164 	SetAmmo(amGrenade, 0, 0, 0, 2)
       
   165 	SetAmmo(amDEagle, 0, 0, 0, 2)
       
   166 end
       
   167 
       
   168 function onGameTick()
       
   169 	AnimUnWait()
       
   170 	if ShowAnimation() == false then
       
   171 		return
       
   172 	end
       
   173 	ExecuteAfterAnimations()
       
   174 	CheckEvents()
       
   175 end
       
   176 
       
   177 function onPrecise()
       
   178 	if GameTime > 3000 then
       
   179 		SetAnimSkip(true)   
       
   180 	end
       
   181 end
       
   182 
       
   183 -------------- EVENTS ------------------
       
   184 
       
   185 function onWeaponsPlatform(gear)
       
   186 	if GetX(gear) > bazookaX-200 and GetX(gear) < deserteagleX+400  and GetY(gear) < weaponsY+150 and StoppedGear(gear) then
       
   187 		return true
       
   188 	end
       
   189 	return false
       
   190 end
       
   191 
       
   192 -------------- OUTCOMES ------------------
       
   193 
       
   194 function weaponsPlatform(gear)
       
   195 	AddAnim(dialog02)
       
   196 end
       
   197 
       
   198 -------------- ANIMATIONS ------------------
       
   199 
       
   200 function Skipanim(anim)
       
   201 	if goals[anim] ~= nil then
       
   202 		ShowMission(unpack(goals[anim]))
       
   203     end
       
   204 end
       
   205 
       
   206 function AnimationSetup()
       
   207 	-- DIALOG 01 - Start, welcome to moon
       
   208 	AddSkipFunction(dialog01, Skipanim, {dialog01})
       
   209 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
       
   210 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Near PAoTH base at moon..."),  4000}})
       
   211 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("Hey Hog Solo! Finaly you have come..."), SAY_SAY, 2000}})
       
   212 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("It seems that Professor Hogevil learned for your arrival!"), SAY_SAY, 4000}})
       
   213 	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}})
       
   214 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("We have to hurry! Are you armed?"), SAY_SAY, 4300}})
       
   215 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
       
   216 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("No, I am afraid I had to travel light"), SAY_SAY, 2500}})
       
   217 	table.insert(dialog01, {func = AnimWait, args = {paoth1.gear, 500}})
       
   218 	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}})
       
   219 	table.insert(dialog01, {func = AnimSay, args = {paoth1.gear, loc("They are up there! Take that rope and hurry!"), SAY_SAY, 7000}})
       
   220 	table.insert(dialog01, {func = AnimSay, args = {hero.gear, loc("Ehm... ok..."), SAY_SAY, 2500}})
       
   221 	table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
       
   222 	-- DIALOG 02 - To the weapons platform
       
   223 	AddSkipFunction(dialog02, Skipanim, {dialog02})
       
   224 	table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Checkpoint reached!"),  4000}})
       
   225 	table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I've made it! YEAAAAAH!"), SAY_SHOUT, 4000}})
       
   226 	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}})
       
   227 	table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}})
       
   228 end