114 ------ HOG LIST ------ |
115 ------ HOG LIST ------ |
115 AddTeam(loc("Training Team"), 0xFF0204, "deadhog", "SteelTower", "Default", "hedgewars") |
116 AddTeam(loc("Training Team"), 0xFF0204, "deadhog", "SteelTower", "Default", "hedgewars") |
116 |
117 |
117 hhs[1] = AddHog(loc("Greenhorn"), 0, 100, "NoHat") |
118 hhs[1] = AddHog(loc("Greenhorn"), 0, 100, "NoHat") |
118 SetGearPosition(hhs[1], 404, 1714) |
119 SetGearPosition(hhs[1], 404, 1714) |
119 --SetGearPosition(hhs[1], 1368, 1400) |
|
120 SetEffect(hhs[1], heResurrectable, 1) |
120 SetEffect(hhs[1], heResurrectable, 1) |
121 |
121 |
122 hhs[2] = AddHog(loc("Rhombus"), 0, 100, "NoHat") |
122 hhs[2] = AddHog(loc("Rhombus"), 0, 100, "NoHat") |
123 SetGearPosition(hhs[2], 620, 1538) |
123 SetGearPosition(hhs[2], 620, 1538) |
124 SetEffect(hhs[2], heResurrectable, 1) |
124 SetEffect(hhs[2], heResurrectable, 1) |
182 PlaceSprite(1885, 1562, sprAmGirder, 7, 0xFFFFFFFF, nil, nil, nil, lfNormal) |
182 PlaceSprite(1885, 1562, sprAmGirder, 7, 0xFFFFFFFF, nil, nil, nil, lfNormal) |
183 PlaceSprite(2252, 1700, sprAmGirder, 2, 16448250, nil, nil, nil, lfIce) |
183 PlaceSprite(2252, 1700, sprAmGirder, 2, 16448250, nil, nil, nil, lfIce) |
184 PlaceSprite(2308, 1803, sprAmGirder, 5, 16448250, nil, nil, nil, lfIce) |
184 PlaceSprite(2308, 1803, sprAmGirder, 5, 16448250, nil, nil, nil, lfIce) |
185 PlaceSprite(2394, 1893, sprAmGirder, 1, 16448250, nil, nil, nil, lfIce) |
185 PlaceSprite(2394, 1893, sprAmGirder, 1, 16448250, nil, nil, nil, lfIce) |
186 PlaceSprite(605, 1761, sprAmGirder, 2, 0xFFFFFFFF, nil, nil, nil, lfNormal) |
186 PlaceSprite(605, 1761, sprAmGirder, 2, 0xFFFFFFFF, nil, nil, nil, lfNormal) |
187 --PlaceSprite(2429, 1817, sprAmGirder, 5, 0xFFFFFFFF, nil, nil, nil, lfNormal) |
|
188 PlaceSprite(1813, 1312, sprAmGirder, 4, 0xFFFFFFFF, nil, nil, nil, lfNormal) |
187 PlaceSprite(1813, 1312, sprAmGirder, 4, 0xFFFFFFFF, nil, nil, nil, lfNormal) |
189 PlaceSprite(1742, 1260, sprAmGirder, 2, 0xFFFFFFFF, nil, nil, nil, lfNormal) |
188 PlaceSprite(1742, 1260, sprAmGirder, 2, 0xFFFFFFFF, nil, nil, nil, lfNormal) |
190 PlaceSprite(1812, 1210, sprAmGirder, 4, 0xFFFFFFFF, nil, nil, nil, lfNormal) |
189 PlaceSprite(1812, 1210, sprAmGirder, 4, 0xFFFFFFFF, nil, nil, nil, lfNormal) |
191 PlaceSprite(1884, 1260, sprAmGirder, 2, 0xFFFFFFFF, nil, nil, nil, lfNormal) |
190 PlaceSprite(1884, 1260, sprAmGirder, 2, 0xFFFFFFFF, nil, nil, nil, lfNormal) |
192 PlaceSprite(1545, 1811, sprAmGirder, 2, 0xFFFFFFFF, nil, nil, nil, lfNormal) |
191 PlaceSprite(1545, 1811, sprAmGirder, 2, 0xFFFFFFFF, nil, nil, nil, lfNormal) |
237 crates[4] = SpawnHealthCrate(889, 1829) -- Back Jumping |
236 crates[4] = SpawnHealthCrate(889, 1829) -- Back Jumping |
238 crates[5] = SpawnHealthCrate(1486, 1694) -- Walking on Ice |
237 crates[5] = SpawnHealthCrate(1486, 1694) -- Walking on Ice |
239 crates[6] = SpawnHealthCrate(2033, 1470) -- Walking on Ice completed |
238 crates[6] = SpawnHealthCrate(2033, 1470) -- Walking on Ice completed |
240 crates[7] = SpawnHealthCrate(1297, 1683) -- Back Jumping 2 |
239 crates[7] = SpawnHealthCrate(1297, 1683) -- Back Jumping 2 |
241 crates[8] = SpawnSupplyCrate(1851, 1402, amSwitch, 100) -- Switch Hedgehog |
240 crates[8] = SpawnSupplyCrate(1851, 1402, amSwitch, 100) -- Switch Hedgehog |
242 crates[9] = SpawnHealthCrate(564, 1772) -- Mission Panel |
241 crates[9] = SpawnHealthCrate(564, 1772) -- Health |
243 crates[10] = SpawnHealthCrate(2290, 1622) -- Turning Around |
242 crates[10] = SpawnHealthCrate(2290, 1622) -- Turning Around |
244 end |
243 end |
245 |
244 |
246 local function victory() |
245 local function victory() |
247 ShowMission(loc("Basic Movement Training"), loc("Training complete!"),loc("Congratulations! You have completed the obstacle course!"), 0, 0) |
246 ShowMission(loc("Basic Movement Training"), loc("Training complete!"),loc("Congratulations! You have completed the obstacle course!"), 0, 0) |
295 loc("Attack: [Space]"), 2, 0) |
294 loc("Attack: [Space]"), 2, 0) |
296 end |
295 end |
297 |
296 |
298 -- Crate collected (or destroyed, but this should not be possible) |
297 -- Crate collected (or destroyed, but this should not be possible) |
299 elseif gear == crates[1] then |
298 elseif gear == crates[1] then |
300 ShowMission(loc("Basic Movement Training"), loc("Jumping"), |
299 ShowMission(loc("Basic Movement Training"), loc("Jumping"), |
301 loc("Get the next crate by jumping over the abyss.").."|".. |
300 loc("Get the next crate by jumping over the abyss.").."|".. |
302 loc("Careful, hedgehogs can't swim!").."|".. |
301 loc("Careful, hedgehogs can't swim!").."|".. |
303 loc("Long Jump: [Enter]"), 2, 5000) |
302 loc("Long Jump: [Enter]"), 2, 5000) |
304 elseif gear == crates[2] then |
303 elseif gear == crates[2] then |
305 victory() |
304 victory() |
333 loc("Attack: [Space]"), 2, 30000) |
332 loc("Attack: [Space]"), 2, 30000) |
334 elseif gear == crates[3] then |
333 elseif gear == crates[3] then |
335 ShowMission(loc("Basic Movement Training"), loc("Rubber"), loc("As you probably noticed, these rubber bands|are VERY elastic. Hedgehogs and many other|things will bounce off without taking any damage.").."|".. |
334 ShowMission(loc("Basic Movement Training"), loc("Rubber"), loc("As you probably noticed, these rubber bands|are VERY elastic. Hedgehogs and many other|things will bounce off without taking any damage.").."|".. |
336 loc("Now try to get out of this bounce house|and take the next crate."), 2, 8000) |
335 loc("Now try to get out of this bounce house|and take the next crate."), 2, 8000) |
337 elseif gear == crates[9] then |
336 elseif gear == crates[9] then |
338 ShowMission(loc("Basic Movement Training"), loc("Health and Mission Panel"), loc("You just got yourself some extra health.|The more health your hedgehogs have, the better!").."|".. |
337 ShowMission(loc("Basic Movement Training"), loc("Health"), loc("You just got yourself some extra health.|The more health your hedgehogs have, the better!").."|".. |
339 loc("Now go to the next crate.").."|".. |
338 loc("Now go to the next crate."), 2, 900000) |
340 -- This part is CRITICALLY important for all future missions |
|
341 loc("Hint: If this mission panel disappears, you can|see it again by hitting the Pause or Quit key.").."|".. |
|
342 loc("Quit: [Esc]").."|".. |
|
343 loc("Pause: [P]") |
|
344 , 2, 900000) |
|
345 elseif gear == crates[10] then |
339 elseif gear == crates[10] then |
346 ShowMission(loc("Basic Movement Training"), loc("Turning Around"), |
340 ShowMission(loc("Basic Movement Training"), loc("Turning Around"), |
347 loc("By the way, you can turn around without walking|by holding down Precise when you hit a walk control.").."|".. |
341 loc("By the way, you can turn around without walking|by holding down Precise when you hit a walk control.").."|".. |
348 loc("Get the final crate to the right to complete the training.").."|".. |
342 loc("Get the final crate to the right to complete the training.").."|".. |
349 loc("Turn around: [Left Shift] + [Left]/[Right]") |
343 loc("Turn around: [Left Shift] + [Left]/[Right]") |
365 -- Delay for CurrentHedgehog to update |
359 -- Delay for CurrentHedgehog to update |
366 switchTextDelay = 1 |
360 switchTextDelay = 1 |
367 end |
361 end |
368 end |
362 end |
369 |
363 |
|
364 local function firstMission() |
|
365 -- This part is CRITICALLY important for all future missions. |
|
366 -- Because the player must know how to show the current mission texts again. |
|
367 -- We force the player to hit Attack before the actual training begins. |
|
368 ShowMission(loc("Basic Movement Training"), loc("Mission Panel"), |
|
369 loc("This is the mission panel.").."|".. |
|
370 loc("Here you will find the current mission instructions.").."|".. |
|
371 loc("Normally, the mission panel disappears after a few seconds.").."|".. |
|
372 loc("IMPORTANT: To see the mission panel again, use the quit or pause key.").."| |".. |
|
373 loc("Note: This basic training assumes default controls.").."|".. |
|
374 loc("Quit: [Esc]").."|".. |
|
375 loc("Pause: [P]").."| |".. |
|
376 loc("To begin with the training, hit the attack key!").."|".. |
|
377 loc("Attack: [Space bar]"), 2, 900000) |
|
378 |
|
379 -- TODO: This and other training missions are currently hardcoding control names. |
|
380 -- This should be fixed eventually. |
|
381 end |
|
382 |
370 function onGameTick20() |
383 function onGameTick20() |
371 if switchTextDelay > 0 then |
384 if switchTextDelay > 0 then |
372 switchTextDelay = switchTextDelay - 1 |
385 switchTextDelay = switchTextDelay - 1 |
373 elseif switchTextDelay == 0 then |
386 elseif switchTextDelay == 0 then |
374 switchHedgehogText() |
387 switchHedgehogText() |
375 switchTextDelay = -1 |
388 switchTextDelay = -1 |
|
389 end |
|
390 if turnStarted and GameTime % 10000 == 0 and not missionPanelConfirmed then |
|
391 -- Forces the first mission panel to be displayed without time limit |
|
392 firstMission() |
376 end |
393 end |
377 end |
394 end |
378 |
395 |
379 function onGearResurrect(gear) |
396 function onGearResurrect(gear) |
380 AddCaption(loc("Your hedgehog has been revived!")) |
397 AddCaption(loc("Your hedgehog has been revived!")) |
389 FollowGear(gear) |
406 FollowGear(gear) |
390 end |
407 end |
391 |
408 |
392 function onNewTurn() |
409 function onNewTurn() |
393 SwitchHog(hog_greenhorn) |
410 SwitchHog(hog_greenhorn) |
394 if not walkingText then |
411 FollowGear(hog_greenhorn) |
|
412 if not missionPanelConfirmed then |
|
413 turnStarted = true |
|
414 PlaySound(sndHello, hog_greenhorn) |
|
415 firstMission() |
|
416 end |
|
417 end |
|
418 |
|
419 function onAttack() |
|
420 if not missionPanelConfirmed then |
|
421 -- Mission panel confirmed, release controls |
|
422 PlaySound(sndPlaced) |
|
423 SetInputMask(0xFFFFFFFF) |
|
424 SetSoundMask(sndYesSir, false) |
|
425 PlaySound(sndYesSir, hog_greenhorn) |
|
426 -- First mission: How to walk |
395 ShowMission(loc("Basic Movement Training"), loc("First Steps"), loc("Complete the obstacle course.") .."|".. |
427 ShowMission(loc("Basic Movement Training"), loc("First Steps"), loc("Complete the obstacle course.") .."|".. |
396 loc("To begin, walk to the crate to the right.").."|".. |
428 loc("To begin, walk to the crate to the right.").."|".. |
397 loc("Walk: [Left] and [Right]") .."|".. |
429 loc("Walk: [Left]/[Right]"), 2, 7000) |
398 -- TODO: Remove this note when it's no longer needed. |
430 missionPanelConfirmed = true |
399 -- Hardcoding control names is not good. |
|
400 loc("Note: This basic training assumes default controls."), 2, 900000) |
|
401 walkingText = true |
|
402 end |
431 end |
403 end |
432 end |
404 |
433 |
405 function onGameStart() |
434 function onGameStart() |
|
435 -- Disable input to force player to confirm first message |
|
436 SetInputMask(0) |
|
437 SetSoundMask(sndYesSir, true) |
406 LoadGearData() |
438 LoadGearData() |
407 ShowMission(loc("Basic Movement Training"), loc("Basic Training"), loc("Complete the obstacle course."), 1, 0) |
439 ShowMission(loc("Basic Movement Training"), loc("Basic Training"), loc("Complete the obstacle course."), 1, 0) |
408 FollowGear(hog_greenhorn) |
440 FollowGear(hog_greenhorn) |
409 end |
441 end |
410 |
442 |