18 if introStage < 100 then |
18 if introStage < 100 then |
19 introStage = 110 |
19 introStage = 110 |
20 genCounter = 0 |
20 genCounter = 0 |
21 FollowGear(CurrentHedgehog) |
21 FollowGear(CurrentHedgehog) |
22 AddCaption(loc("Good luck out there!")) |
22 AddCaption(loc("Good luck out there!")) |
23 ShowMission(loc("That Sinking Feeling"), loc("User Challenge"), loc("Save as many hapless hogs as possible!"), 4, 0) |
23 ShowMission(loc("That Sinking Feeling"), loc("Challenge"), loc("Save as many hapless hogs as possible!"), 4, 0) |
|
24 SetInputMask(0xFFFFFFFF) |
24 end |
25 end |
25 end |
26 end |
26 |
27 |
27 function onGameInit() |
28 function onGameInit() |
28 |
29 |
29 Seed = 0 |
30 Seed = 0 |
30 GameFlags = gfInfAttack + gfInvulnerable |
31 GameFlags = gfInfAttack + gfInvulnerable + gfOneClanMode |
31 TurnTime = 90000 |
32 TurnTime = 90000 |
32 CaseFreq = 0 |
33 CaseFreq = 0 |
33 MinesNum = 0 |
34 MinesNum = 0 |
34 MinesTime = 3000 |
35 MinesTime = 3000 |
35 Explosives = 0 |
36 Explosives = 0 |
36 Delay = 10 |
37 Delay = 10 |
37 Map = "Islands" |
38 Map = "Islands" |
38 Theme = "City" |
39 Theme = "City" |
39 SuddenDeathTurns = 1 |
40 SuddenDeathTurns = 1 |
40 |
41 |
41 AddTeam(loc("Nameless Heroes"), 14483456, "Simple", "Island", "Default") |
42 AddTeam(loc("Hapless Hogs"), 14483456, "Simple", "Island", "Default") |
42 player = AddHog(loc("The Nameless One"), 0, 1, "NoHat") |
|
43 |
|
44 AddTeam(loc("Hapless Hogs"), 1175851, "Simple", "Island", "Default") |
|
45 hh[0] = AddHog(loc("Sinky"), 1, 100, "fr_lemon") |
43 hh[0] = AddHog(loc("Sinky"), 1, 100, "fr_lemon") |
46 hh[1] = AddHog(loc("Drowner"), 1, 100, "fr_orange") |
44 hh[1] = AddHog(loc("Drowner"), 1, 100, "fr_orange") |
47 hh[2] = AddHog(loc("Heavy"), 1, 100, "dish_Teapot") |
45 hh[2] = AddHog(loc("Heavy"), 1, 100, "dish_Teapot") |
48 hh[3] = AddHog(loc("Clumsy"), 1, 100, "dish_SauceBoatSilver") |
46 hh[3] = AddHog(loc("Clumsy"), 1, 100, "dish_SauceBoatSilver") |
49 hh[4] = AddHog(loc("Silly"), 1, 100, "dish_Ladle") |
47 hh[4] = AddHog(loc("Silly"), 1, 100, "dish_Ladle") |
50 hh[5] = AddHog(loc("Careless"), 1, 100, "StrawHatEyes") |
48 hh[5] = AddHog(loc("Careless"), 1, 100, "StrawHatEyes") |
51 hh[6] = AddHog(loc("Sponge"), 1, 100, "sf_chunli") |
49 hh[6] = AddHog(loc("Sponge"), 1, 100, "sf_chunli") |
52 hh[7] = AddHog(loc("Deadweight"), 1, 100, "dish_Teacup") |
50 hh[7] = AddHog(loc("Deadweight"), 1, 100, "dish_Teacup") |
|
51 |
|
52 AddTeam(loc("Nameless Heroes"), 14483456, "Simple", "Island", "Default", "cm_crossedswords") |
|
53 player = AddHog(loc("The Nameless One"), 0, 1, "NoHat") |
53 |
54 |
54 SetGearPosition(player, 3992, 733) |
55 SetGearPosition(player, 3992, 733) |
55 SetGearPosition(hh[0], 938, 1369) |
56 SetGearPosition(hh[0], 938, 1369) |
56 SetGearPosition(hh[1], 1301, 1439) |
57 SetGearPosition(hh[1], 1301, 1439) |
57 SetGearPosition(hh[2], 2093, 447) |
58 SetGearPosition(hh[2], 2093, 447) |
59 SetGearPosition(hh[4], 719, 545) |
60 SetGearPosition(hh[4], 719, 545) |
60 SetGearPosition(hh[5], 1630, 821) |
61 SetGearPosition(hh[5], 1630, 821) |
61 SetGearPosition(hh[6], 2191, 810) |
62 SetGearPosition(hh[6], 2191, 810) |
62 SetGearPosition(hh[7], 3799, 945) |
63 SetGearPosition(hh[7], 3799, 945) |
63 |
64 |
|
65 -- Disable all input except [Precise] for the intro |
|
66 SetInputMask(gmPrecise) |
64 end |
67 end |
65 |
68 |
66 |
69 |
67 function onGameStart() |
70 function onGameStart() |
68 |
71 SendHealthStatsOff() |
69 ShowMission(loc("That Sinking Feeling"), loc("User Challenge"), loc("Save as many hapless hogs as possible!"), 4, 1) |
72 |
|
73 ShowMission(loc("That Sinking Feeling"), loc("Challenge"), loc("Save as many hapless hogs as possible!"), 4, 1) |
70 |
74 |
71 HogTurnLeft(hh[0], false) |
75 HogTurnLeft(hh[0], false) |
72 HogTurnLeft(hh[1], true) |
76 HogTurnLeft(hh[1], true) |
73 |
77 |
74 SpawnUtilityCrate(148,265,amLowGravity) |
78 SpawnUtilityCrate(148,265,amLowGravity) |
209 waterPix = waterPix +1 |
214 waterPix = waterPix +1 |
210 --AddCaption(waterPix) |
215 --AddCaption(waterPix) |
211 |
216 |
212 if (waterPix >= 1615) and (GameOver == false) then |
217 if (waterPix >= 1615) and (GameOver == false) then |
213 GameOver = true |
218 GameOver = true |
214 SetHealth(player, 0) |
219 AddCaption("The flood has stopped! Challenge over.") |
215 TurnTimeLeft = 1 |
220 SendStat(siGameResult, loc("Challenge completed!")) |
216 ShowMission(loc("That Sinking Feeling"), loc("MISSION SUCCESS"), loc("You saved") .. " " .. hhCount .. " " .. loc("Hapless Hogs") .."!", 0, 0) |
221 SendStat(siPlayerKills, tostring(hhCount), loc("Nameless Heroes")) |
217 |
222 SendStat(siPointType, "rescues") |
218 if hhCount == 8 then |
223 |
219 AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Lively Lifeguard"),0xffba00ff,capgrpMessage2) |
224 -- Do not count drowning hedgehogs |
|
225 local hhLeft = hhCount |
|
226 for i=1,#hh do |
|
227 local isDrowning = band(GetState(hh[i]),gstDrowning) ~= 0 |
|
228 if isDrowning then |
|
229 hhLeft = hhLeft - 1 |
|
230 end |
220 end |
231 end |
221 |
232 |
222 end |
233 SendStat(siCustomAchievement, string.format(loc("You saved %d of 8 Hapless Hogs."), hhLeft)) |
223 |
234 |
224 end |
235 if hhLeft == 8 then |
225 |
236 AddCaption(loc("Achievement obtained: Lively Lifeguard"),0xffba00ff,capgrpMessage2) |
226 end |
237 SendStat(siCustomAchievement, loc("You have obtained an achievement: Lively Lifeguard")) |
227 |
238 end |
228 if TurnTimeLeft == 1 then |
239 EndGame() |
229 SetHealth(player, 0) |
240 |
230 end |
241 end |
231 |
242 |
|
243 end |
|
244 |
|
245 end |
232 end |
246 end |
233 |
247 |
234 |
248 |
235 function onAmmoStoreInit() |
249 function onAmmoStoreInit() |
236 |
250 |
251 end |
265 end |
252 |
266 |
253 function onGearDelete(gear) |
267 function onGearDelete(gear) |
254 |
268 |
255 if GetGearType(gear) == gtHedgehog then |
269 if GetGearType(gear) == gtHedgehog then |
256 if GetHogTeamName(gear) == "Hapless Hogs" then |
270 if GetHogTeamName(gear) == loc("Hapless Hogs") then |
257 hhCount = hhCount - 1 |
271 hhCount = hhCount - 1 |
258 AddCaption(hhCount .. loc(" Hapless Hogs left!")) |
272 AddCaption(string.format(loc("%d Hapless Hogs left"), hhCount)) |
259 end |
273 end |
260 end |
274 end |
261 |
275 |
262 if ((gear == player) or (hhCount == 0)) and (GameOver == false) then |
276 if ((gear == player) or (hhCount == 0)) and (GameOver == false) then |
263 SetHealth(player, 0) |
277 SetHealth(player, 0) |
264 TurnTimeLeft = 1 |
278 AddCaption(loc("Disqualified!")) |
265 ShowMission(loc("That Sinking Feeling"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0) |
279 if gear == player then |
|
280 SendStat(siCustomAchievement, loc("Your hedgehog died!")) |
|
281 SendStat(siCustomAchievement, loc("You must survive the flood in order to score.")) |
|
282 else |
|
283 SendStat(siCustomAchievement, loc("You haven't rescued anyone.")) |
|
284 end |
|
285 SendStat(siPlayerKills, "0", loc("Nameless Heroes")) |
|
286 SendStat(siPointType, "points") |
|
287 |
|
288 SendStat(siGameResult, loc("Disqualified!")) |
266 GameOver = true |
289 GameOver = true |
267 end |
290 EndGame() |
268 |
291 end |
269 end |
292 |
|
293 end |