6 -- been taken hostages by professor Hogevil. |
6 -- been taken hostages by professor Hogevil. |
7 -- So hero has to get whatever available equipement |
7 -- So hero has to get whatever available equipement |
8 -- there is and rescue them. |
8 -- there is and rescue them. |
9 |
9 |
10 -- TODO |
10 -- TODO |
11 -- Fix some glitches when gaining control on animations |
11 -- Fix some glitches when gaining control on animations, on skip I get control of the talking hog |
12 -- Round time after check point 2 |
12 -- Round time after check point 2 |
13 -- Check if enemy weapons are good |
13 -- Check if enemy weapons are good |
14 -- Create event to end game if professor killed |
14 -- Stats |
15 -- Continue with the rest :P |
15 -- check points |
16 |
16 |
17 HedgewarsScriptLoad("/Scripts/Locale.lua") |
17 HedgewarsScriptLoad("/Scripts/Locale.lua") |
18 HedgewarsScriptLoad("/Scripts/Animate.lua") |
18 HedgewarsScriptLoad("/Scripts/Animate.lua") |
19 |
19 |
20 ----------------- VARIABLES -------------------- |
20 ----------------- VARIABLES -------------------- |
21 -- globals |
21 -- globals |
22 local campaignName = loc("A Space Adventure") |
22 local campaignName = loc("A Space Adventure") |
23 local missionName = loc("Moon, stop for fuels!") |
23 local missionName = loc("Moon, stop for fuels!") |
24 local weaponsAcquired = false |
24 local weaponsAcquired = false |
25 local battleZone = false |
25 local battleZoneReached = false |
26 local checkPointReached = 1 -- 1 is start of the game |
26 local checkPointReached = 1 -- 1 is start of the game |
27 -- dialogs |
27 -- dialogs |
28 local dialog01 = {} |
28 local dialog01 = {} |
29 local dialog02 = {} |
29 local dialog02 = {} |
30 local dialog03 = {} |
30 local dialog03 = {} |
|
31 local dialog04 = {} |
31 -- mission objectives |
32 -- mission objectives |
32 local goals = { |
33 local goals = { |
33 [dialog01] = {missionName, loc("Getting ready"), loc("Go to the upper platform and get the weapons in the crates!"), 1, 4500}, |
34 [dialog01] = {missionName, loc("Getting ready"), loc("Go to the upper platform and get the weapons in the crates!"), 1, 4500}, |
34 [dialog02] = {missionName, loc("Prepare to fight"), loc("Go down and save these PAoTH hogs!"), 1, 5000}, |
35 [dialog02] = {missionName, loc("Prepare to fight"), loc("Go down and save these PAoTH hogs!"), 1, 5000}, |
35 [dialog03] = {missionName, loc("The fight begins!"), loc("Neutralize your enemies and be careful!"), 1, 5000} |
36 [dialog03] = {missionName, loc("The fight begins!"), loc("Neutralize your enemies and be careful!"), 1, 5000}, |
|
37 [dialog04] = dialog03 |
36 } |
38 } |
37 -- crates |
39 -- crates |
38 local weaponsY = 100 |
40 local weaponsY = 100 |
39 local bazookaX = 70 |
41 local bazookaX = 70 |
40 local parachuteX = 110 |
42 local parachuteX = 110 |
177 AddAmmo(minion2.gear, amGrenade, 2) |
181 AddAmmo(minion2.gear, amGrenade, 2) |
178 AddAmmo(minion3.gear, amGrenade, 2) |
182 AddAmmo(minion3.gear, amGrenade, 2) |
179 |
183 |
180 -- check for death has to go first |
184 -- check for death has to go first |
181 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
185 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
|
186 AddEvent(onProfessorDeath, {professor.gear}, professorDeath, {professor.gear}, 0) |
182 AddEvent(onBattleZone, {hero.gear}, battleZone, {hero.gear}, 0) |
187 AddEvent(onBattleZone, {hero.gear}, battleZone, {hero.gear}, 0) |
|
188 AddEvent(onProfessorHit, {professor.gear}, professorHit, {professor.gear}, 1) |
183 |
189 |
184 if checkPointReached == 1 then |
190 if checkPointReached == 1 then |
185 AddAmmo(hero.gear, amRope, 2) |
191 AddAmmo(hero.gear, amRope, 2) |
186 SpawnAmmoCrate(bazookaX, weaponsY, amBazooka) |
192 SpawnAmmoCrate(bazookaX, weaponsY, amBazooka) |
187 SpawnAmmoCrate(parachuteX, weaponsY, amParachute) |
193 SpawnAmmoCrate(parachuteX, weaponsY, amParachute) |
224 end |
230 end |
225 |
231 |
226 function onNewTurn() |
232 function onNewTurn() |
227 WriteLnToConsole("ON NEW TURN") |
233 WriteLnToConsole("ON NEW TURN") |
228 WriteLnToConsole("HOG IS "..CurrentHedgehog.." minion 1 is "..minion1.gear) |
234 WriteLnToConsole("HOG IS "..CurrentHedgehog.." minion 1 is "..minion1.gear) |
|
235 |
|
236 if weaponsAcquired then |
|
237 WriteLnToConsole("weapons acq+++") |
|
238 end |
|
239 |
|
240 if battleZoneReached then |
|
241 WriteLnToConsole("battleZone acq+++") |
|
242 end |
229 |
243 |
230 if not weaponsAcquired and not battleZone and CurrentHedgehog ~= hero.gear then |
244 -- rounds start if hero got his weapons or got near the enemies |
|
245 if not weaponsAcquired and not battleZoneReached and CurrentHedgehog ~= hero.gear then |
231 WriteLnToConsole("TURN CASE 1") |
246 WriteLnToConsole("TURN CASE 1") |
232 TurnTimeLeft = 0 |
247 TurnTimeLeft = 0 |
233 elseif not weaponsAcquired and not battleZone and CurrentHedgehog == hero.gear then |
248 elseif not weaponsAcquired and not battleZoneReached and CurrentHedgehog == hero.gear then |
234 WriteLnToConsole("TURN CASE 2") |
249 WriteLnToConsole("TURN CASE 2") |
235 TurnTimeLeft = -1 |
250 TurnTimeLeft = -1 |
236 elseif CurrentHedgehog == paoth1.gear or CurrentHedgehog == paoth2.gear |
251 elseif CurrentHedgehog == paoth1.gear or CurrentHedgehog == paoth2.gear |
237 or CurrentHedgehog == paoth3.gear or CurrentHedgehog == paoth4.gear then |
252 or CurrentHedgehog == paoth3.gear or CurrentHedgehog == paoth4.gear then |
238 WriteLnToConsole("TURN CASE 3") |
253 WriteLnToConsole("TURN CASE 3") |
239 TurnTimeLeft = 0 |
254 TurnTimeLeft = 0 |
240 elseif CurrentHedgehog == professor.gear then |
255 elseif CurrentHedgehog == professor.gear then |
|
256 WriteLnToConsole("TURN CASE 4") |
241 AnimSwitchHog(hero.gear) |
257 AnimSwitchHog(hero.gear) |
242 TurnTimeLeft = 0 |
258 TurnTimeLeft = 0 |
243 end |
259 end |
244 end |
260 end |
245 |
261 |
290 GameFlags = bor(GameFlags,gfDisableWind) |
325 GameFlags = bor(GameFlags,gfDisableWind) |
291 AddAnim(dialog02) |
326 AddAnim(dialog02) |
292 end |
327 end |
293 |
328 |
294 function heroDeath(gear) |
329 function heroDeath(gear) |
295 |
330 -- do stats stuff here |
296 EndGame() |
331 EndGame() |
297 end |
332 end |
298 |
333 |
299 function battleZone(gear) |
334 function battleZone(gear) |
300 TurnTimeLeft = 0 |
335 TurnTimeLeft = 0 |
301 battleZone = true |
336 battleZoneReached = true |
302 AddAnim(dialog03) |
337 if weaponsAqcuired then |
|
338 AddAnim(dialog04) |
|
339 else |
|
340 AddAnim(dialog03) |
|
341 end |
|
342 end |
|
343 |
|
344 function professorHit(gear) |
|
345 if currentHedgehog ~= hero.gear then |
|
346 AnimSay(professor.gear,loc("Don't hit me you fools!"), SAY_SHOUT, 2000) |
|
347 end |
|
348 end |
|
349 |
|
350 function professorDeath(gear) |
|
351 -- do stats stuff here |
|
352 EndGame() |
303 end |
353 end |
304 |
354 |
305 -------------- ANIMATIONS ------------------ |
355 -------------- ANIMATIONS ------------------ |
306 |
356 |
307 function Skipanim(anim) |
357 function Skipanim(anim) |
308 if goals[anim] ~= nil then |
358 if goals[anim] ~= nil then |
309 ShowMission(unpack(goals[anim])) |
359 ShowMission(unpack(goals[anim])) |
310 end |
360 end |
311 if anim == dialog03 then |
361 if anim == dialog03 then |
312 startCombat() |
362 startCombat() |
|
363 else |
|
364 --TODO check if this is ok |
|
365 AnimSwitchHog(hero.gear) |
313 end |
366 end |
314 end |
367 end |
315 |
368 |
316 function AnimationSetup() |
369 function AnimationSetup() |
317 -- DIALOG 01 - Start, welcome to moon |
370 -- DIALOG 01 - Start, welcome to moon |
340 table.insert(dialog03, {func = AnimCaption, args = {hero.gear, loc("Get ready to fight!"), 4000}}) |
393 table.insert(dialog03, {func = AnimCaption, args = {hero.gear, loc("Get ready to fight!"), 4000}}) |
341 table.insert(dialog03, {func = AnimSay, args = {minion1.gear, loc("Look boss! There is the target!"), SAY_SHOUT, 4000}}) |
394 table.insert(dialog03, {func = AnimSay, args = {minion1.gear, loc("Look boss! There is the target!"), SAY_SHOUT, 4000}}) |
342 table.insert(dialog03, {func = AnimSay, args = {professor.gear, loc("Prepare for battle!"), SAY_SHOUT, 4000}}) |
395 table.insert(dialog03, {func = AnimSay, args = {professor.gear, loc("Prepare for battle!"), SAY_SHOUT, 4000}}) |
343 table.insert(dialog03, {func = AnimSay, args = {hero.gear, loc("Oops, I've been spotted and I have no weapons! I am doomed!"), SAY_THINK, 4000}}) |
396 table.insert(dialog03, {func = AnimSay, args = {hero.gear, loc("Oops, I've been spotted and I have no weapons! I am doomed!"), SAY_THINK, 4000}}) |
344 table.insert(dialog03, {func = startCombat, args = {hero.gear}}) |
397 table.insert(dialog03, {func = startCombat, args = {hero.gear}}) |
|
398 -- DIALOG 04 - Hero spotted and *HAS* weapons |
|
399 AddSkipFunction(dialog04, Skipanim, {dialog04}) |
|
400 table.insert(dialog04, {func = AnimCaption, args = {hero.gear, loc("Get ready to fight!"), 4000}}) |
|
401 table.insert(dialog04, {func = AnimSay, args = {minion1.gear, loc("Look boss! There is the target!"), SAY_SHOUT, 4000}}) |
|
402 table.insert(dialog04, {func = AnimSay, args = {professor.gear, loc("Prepare for battle!"), SAY_SHOUT, 4000}}) |
|
403 table.insert(dialog04, {func = AnimSay, args = {hero.gear, loc("Here we go!"), SAY_THINK, 4000}}) |
|
404 table.insert(dialog04, {func = startCombat, args = {hero.gear}}) |
345 end |
405 end |
346 |
406 |
347 ------------------- custom "animation" functions -------------------------- |
407 ------------------- custom "animation" functions -------------------------- |
348 |
408 |
349 function startCombat() |
409 function startCombat() |
350 -- use this so guard2 will gain control |
410 -- use this so guard2 will gain control |
|
411 HealthCaseProb = 100 |
|
412 HealthCaseAmount = 50 |
351 AnimSwitchHog(minion3.gear) |
413 AnimSwitchHog(minion3.gear) |
352 TurnTimeLeft = 0 |
414 TurnTimeLeft = 0 |
353 end |
415 end |