21 local show = (type(highscore) == "number") and (highscore > 0) |
22 local show = (type(highscore) == "number") and (highscore > 0) |
22 local recordInfo = "" |
23 local recordInfo = "" |
23 if show then |
24 if show then |
24 recordInfo = getReadableChallengeRecord("Highscore") |
25 recordInfo = getReadableChallengeRecord("Highscore") |
25 end |
26 end |
26 ShowMission(loc("That Sinking Feeling"), loc("Challenge"), loc("Save as many hapless hogs as possible!") |
27 ShowMission(loc("That Sinking Feeling"), loc("Challenge"), loc("Save as many hogs as possible!") |
27 .. "|" .. recordInfo, 4, 0) |
28 .. "|" .. recordInfo, 4, 0) |
28 end |
29 end |
29 |
30 |
30 -- allow skipping of the intro via hitting precise key |
31 -- allow skipping of the intro via hitting precise key |
31 function onPrecise() |
32 function onPrecise() |
51 Map = "Islands" |
52 Map = "Islands" |
52 Theme = "City" |
53 Theme = "City" |
53 HealthDecrease = 0 |
54 HealthDecrease = 0 |
54 WaterRise = 0 |
55 WaterRise = 0 |
55 |
56 |
56 AddTeam(loc("Hapless Hogs"), -1, "Simple", "Island", "Default") |
57 local idx = AddTeam(loc("Hapless Hogs"), -1, "Simple", "Island", "Default") |
|
58 haplessTeamName = GetTeamName(idx) |
57 hh[0] = AddHog(loc("Sinky"), 1, 100, "fr_lemon") |
59 hh[0] = AddHog(loc("Sinky"), 1, 100, "fr_lemon") |
58 hh[1] = AddHog(loc("Drowner"), 1, 100, "fr_orange") |
60 hh[1] = AddHog(loc("Drowner"), 1, 100, "fr_orange") |
59 hh[2] = AddHog(loc("Heavy"), 1, 100, "dish_Teapot") |
61 hh[2] = AddHog(loc("Heavy"), 1, 100, "dish_Teapot") |
60 hh[3] = AddHog(loc("Clumsy"), 1, 100, "dish_SauceBoatSilver") |
62 hh[3] = AddHog(loc("Clumsy"), 1, 100, "dish_SauceBoatSilver") |
61 hh[4] = AddHog(loc("Silly"), 1, 100, "dish_Ladle") |
63 hh[4] = AddHog(loc("Silly"), 1, 100, "dish_Ladle") |
62 hh[5] = AddHog(loc("Careless"), 1, 100, "StrawHatEyes") |
64 hh[5] = AddHog(loc("Careless"), 1, 100, "StrawHatEyes") |
63 hh[6] = AddHog(loc("Sponge"), 1, 100, "sf_chunli") |
65 hh[6] = AddHog(loc("Sponge"), 1, 100, "sf_chunli") |
64 hh[7] = AddHog(loc("Deadweight"), 1, 100, "dish_Teacup") |
66 hh[7] = AddHog(loc("Deadweight"), 1, 100, "dish_Teacup") |
65 |
67 |
66 AddTeam(loc("Nameless Heroes"), -1, "Simple", "Island", "Default", "cm_crossedswords") |
68 idx = AddMissionTeam(-1) |
67 player = AddHog(loc("The Nameless One"), 0, 1, "NoHat") |
69 playerTeamName = GetTeamName(idx) |
|
70 player = AddMissionHog(1) |
68 |
71 |
69 SetGearPosition(player, 3992, 733) |
72 SetGearPosition(player, 3992, 733) |
70 SetGearPosition(hh[0], 938, 1369) |
73 SetGearPosition(hh[0], 938, 1369) |
71 SetGearPosition(hh[1], 1301, 1439) |
74 SetGearPosition(hh[1], 1301, 1439) |
72 SetGearPosition(hh[2], 2093, 447) |
75 SetGearPosition(hh[2], 2093, 447) |
239 if (waterPix >= 1615) and (GameOver == false) then |
242 if (waterPix >= 1615) and (GameOver == false) then |
240 GameOver = true |
243 GameOver = true |
241 AddCaption(loc("The flood has stopped! Challenge over.")) |
244 AddCaption(loc("The flood has stopped! Challenge over.")) |
242 SendStat(siGameResult, loc("Challenge completed!")) |
245 SendStat(siGameResult, loc("Challenge completed!")) |
243 SendStat(siPointType, loc("rescues")) |
246 SendStat(siPointType, loc("rescues")) |
244 SendStat(siPlayerKills, tostring(hhCount), loc("Nameless Heroes")) |
247 SendStat(siPlayerKills, tostring(hhCount), playerTeamName) |
245 |
248 |
246 -- Do not count drowning hedgehogs |
249 -- Do not count drowning hedgehogs |
247 local hhLeft = hhCount |
250 local hhLeft = hhCount |
248 for i=1,#hh do |
251 for i=1,#hh do |
249 local isDrowning = band(GetState(hh[i]),gstDrowning) ~= 0 |
252 local isDrowning = band(GetState(hh[i]),gstDrowning) ~= 0 |
250 if isDrowning then |
253 if isDrowning then |
251 hhLeft = hhLeft - 1 |
254 hhLeft = hhLeft - 1 |
252 end |
255 end |
253 end |
256 end |
254 |
257 |
255 SendStat(siCustomAchievement, string.format(loc("You saved %d of 8 Hapless Hogs."), hhLeft)) |
258 SendStat(siCustomAchievement, string.format(loc("You saved %d of 8 hegehogs."), hhLeft)) |
256 |
259 |
257 -- Update highscore |
260 -- Update highscore |
258 updateChallengeRecord("Highscore", hhLeft) |
261 updateChallengeRecord("Highscore", hhLeft) |
259 |
262 |
260 if hhLeft == 8 then |
263 if hhLeft == 8 then |
306 SendStat(siCustomAchievement, loc("You must survive the flood in order to score.")) |
309 SendStat(siCustomAchievement, loc("You must survive the flood in order to score.")) |
307 else |
310 else |
308 SendStat(siCustomAchievement, loc("You haven't rescued anyone.")) |
311 SendStat(siCustomAchievement, loc("You haven't rescued anyone.")) |
309 end |
312 end |
310 SendStat(siPointType, loc("points")) |
313 SendStat(siPointType, loc("points")) |
311 SendStat(siPlayerKills, "0", loc("Nameless Heroes")) |
314 SendStat(siPlayerKills, "0", playerTeamName) |
312 local highscore = tonumber(GetMissionVar("Highscore")) |
315 local highscore = tonumber(GetMissionVar("Highscore")) |
313 show = (type(highscore) == "number") and (highscore > 0) |
316 show = (type(highscore) == "number") and (highscore > 0) |
314 updateChallengeRecord("Highscore", 0, show) |
317 updateChallengeRecord("Highscore", 0, show) |
315 |
318 |
316 SendStat(siGameResult, loc("Disqualified!")) |
319 SendStat(siGameResult, loc("Disqualified!")) |