1 |
|
2 |
|
3 HedgewarsScriptLoad("/Scripts/Locale.lua") |
|
4 |
|
5 local player |
|
6 local hh = {} |
|
7 local hhCount = 8 |
|
8 local GameOver = false |
|
9 local introStage = 0 |
|
10 local genCounter = 0 |
|
11 local waterCounter = 0 |
|
12 local waterPix = 0 |
|
13 local frig = 0 |
|
14 local watGear = nil |
|
15 local cinematic = false |
|
16 |
|
17 -- allow skipping of the intro via hitting precise key |
|
18 function onPrecise() |
|
19 if introStage < 100 then |
|
20 introStage = 110 |
|
21 genCounter = 0 |
|
22 FollowGear(CurrentHedgehog) |
|
23 AddCaption(loc("Good luck out there!")) |
|
24 ShowMission(loc("That Sinking Feeling"), loc("Challenge"), loc("Save as many hapless hogs as possible!"), 4, 0) |
|
25 SetInputMask(0xFFFFFFFF) |
|
26 end |
|
27 end |
|
28 |
|
29 function onGameInit() |
|
30 |
|
31 Seed = 0 |
|
32 GameFlags = gfInfAttack + gfInvulnerable + gfOneClanMode |
|
33 TurnTime = 90000 |
|
34 CaseFreq = 0 |
|
35 MinesNum = 0 |
|
36 MinesTime = 3000 |
|
37 Explosives = 0 |
|
38 Delay = 10 |
|
39 Map = "Islands" |
|
40 Theme = "City" |
|
41 SuddenDeathTurns = 1 |
|
42 |
|
43 AddTeam(loc("Hapless Hogs"), 14483456, "Simple", "Island", "Default") |
|
44 hh[0] = AddHog(loc("Sinky"), 1, 100, "fr_lemon") |
|
45 hh[1] = AddHog(loc("Drowner"), 1, 100, "fr_orange") |
|
46 hh[2] = AddHog(loc("Heavy"), 1, 100, "dish_Teapot") |
|
47 hh[3] = AddHog(loc("Clumsy"), 1, 100, "dish_SauceBoatSilver") |
|
48 hh[4] = AddHog(loc("Silly"), 1, 100, "dish_Ladle") |
|
49 hh[5] = AddHog(loc("Careless"), 1, 100, "StrawHatEyes") |
|
50 hh[6] = AddHog(loc("Sponge"), 1, 100, "sf_chunli") |
|
51 hh[7] = AddHog(loc("Deadweight"), 1, 100, "dish_Teacup") |
|
52 |
|
53 AddTeam(loc("Nameless Heroes"), 14483456, "Simple", "Island", "Default", "cm_crossedswords") |
|
54 player = AddHog(loc("The Nameless One"), 0, 1, "NoHat") |
|
55 |
|
56 SetGearPosition(player, 3992, 733) |
|
57 SetGearPosition(hh[0], 938, 1369) |
|
58 SetGearPosition(hh[1], 1301, 1439) |
|
59 SetGearPosition(hh[2], 2093, 447) |
|
60 SetGearPosition(hh[3], 2971, 926) |
|
61 SetGearPosition(hh[4], 719, 545) |
|
62 SetGearPosition(hh[5], 1630, 821) |
|
63 SetGearPosition(hh[6], 2191, 810) |
|
64 SetGearPosition(hh[7], 3799, 945) |
|
65 |
|
66 -- Disable all input except [Precise] for the intro |
|
67 SetInputMask(gmPrecise) |
|
68 end |
|
69 |
|
70 |
|
71 function onGameStart() |
|
72 cinematic = true |
|
73 SetCinematicMode(true) |
|
74 SendHealthStatsOff() |
|
75 |
|
76 ShowMission(loc("That Sinking Feeling"), loc("Challenge"), loc("Save as many hapless hogs as possible!"), 4, 1) |
|
77 |
|
78 HogTurnLeft(hh[0], false) |
|
79 HogTurnLeft(hh[1], true) |
|
80 |
|
81 SpawnUtilityCrate(148,265,amLowGravity) |
|
82 SpawnUtilityCrate(2124,1516,amJetpack) |
|
83 |
|
84 end |
|
85 |
|
86 |
|
87 function onNewTurn() |
|
88 TurnTimeLeft = -1 |
|
89 end |
|
90 |
|
91 function onGameTick() |
|
92 |
|
93 -- intro sequence |
|
94 if introStage < 100 then |
|
95 |
|
96 frig = frig + 1 |
|
97 if frig == 50 then |
|
98 frig = 0 |
|
99 AddCaption(loc("Press [Precise] to skip intro")) |
|
100 if watGear ~= nil then |
|
101 FollowGear(watGear) |
|
102 end |
|
103 end |
|
104 |
|
105 |
|
106 --AddCaption(loc("Press [Precise] to skip intro")) |
|
107 genCounter = genCounter + 1 |
|
108 |
|
109 if introStage == 0 then |
|
110 |
|
111 |
|
112 --FollowGear(hh[0]) |
|
113 |
|
114 if genCounter == 2000 then |
|
115 watGear = hh[0] |
|
116 HogSay(hh[0], loc("This rain is really something..."), SAY_SAY,2) |
|
117 elseif genCounter == 5000 then |
|
118 introStage = 1 |
|
119 genCounter = 0 |
|
120 end |
|
121 |
|
122 elseif introStage == 1 then |
|
123 |
|
124 --FollowGear(hh[1]) |
|
125 |
|
126 if genCounter == 2000 then |
|
127 watGear = hh[1] |
|
128 HogSay(hh[1], loc("Heh, it's not that bad."), SAY_SAY,2) |
|
129 elseif genCounter == 5000 then |
|
130 introStage = 2 |
|
131 genCounter = 0 |
|
132 end |
|
133 |
|
134 elseif introStage == 2 then |
|
135 |
|
136 --FollowGear(hh[0]) |
|
137 |
|
138 if genCounter == 2000 then |
|
139 watGear = hh[0] |
|
140 HogSay(hh[0], loc("You'd almost swear the water was rising!"), SAY_SHOUT,2) |
|
141 elseif genCounter == 6000 then |
|
142 introStage = 3 |
|
143 genCounter = 0 |
|
144 end |
|
145 |
|
146 elseif introStage == 3 then |
|
147 |
|
148 --FollowGear(hh[1]) |
|
149 |
|
150 if genCounter == 2000 then |
|
151 watGear = hh[1] |
|
152 HogSay(hh[1], loc("Haha, now THAT would be something!"), SAY_SAY,2) |
|
153 elseif genCounter == 6000 then |
|
154 introStage = 4 |
|
155 genCounter = 0 |
|
156 end |
|
157 |
|
158 elseif introStage == 4 then |
|
159 |
|
160 --FollowGear(hh[0]) |
|
161 |
|
162 if genCounter == 2000 then |
|
163 watGear = hh[0] |
|
164 HogSay(hh[0], loc("Hahahaha!"), SAY_SHOUT,2) |
|
165 HogSay(hh[1], loc("Hahahaha!"), SAY_SHOUT,2) |
|
166 elseif genCounter == 3000 then |
|
167 introStage = 5 |
|
168 genCounter = 0 |
|
169 end |
|
170 |
|
171 elseif introStage == 5 then |
|
172 |
|
173 --FollowGear(hh[1]) |
|
174 |
|
175 if genCounter == 2000 then |
|
176 watGear = hh[1] |
|
177 HogSay(hh[0], loc("..."), SAY_THINK,2) |
|
178 HogSay(hh[1], loc("..."), SAY_THINK,2) |
|
179 elseif genCounter == 5000 then |
|
180 introStage = 6 |
|
181 genCounter = 0 |
|
182 end |
|
183 |
|
184 elseif introStage == 6 then |
|
185 |
|
186 --FollowGear(hh[0]) |
|
187 |
|
188 if genCounter == 2000 then |
|
189 watGear = hh[0] |
|
190 HogSay(hh[0], loc("It's a good thing SUDDEN DEATH is 99 turns away..."), SAY_THINK,2) |
|
191 elseif genCounter == 6000 then |
|
192 introStage = 7 |
|
193 genCounter = 0 |
|
194 end |
|
195 |
|
196 |
|
197 elseif introStage == 7 then |
|
198 |
|
199 if genCounter == 2000 then |
|
200 introStage = 110 |
|
201 FollowGear(CurrentHedgehog) |
|
202 ShowMission(loc("That Sinking Feeling"), loc("User Challenge"), loc("Save as many hapless hogs as possible!"), 4, 0) |
|
203 SetInputMask(0xFFFFFFFF) |
|
204 end |
|
205 |
|
206 end |
|
207 |
|
208 end |
|
209 |
|
210 -- start the water rising when the intro is finished |
|
211 if introStage == 110 then |
|
212 |
|
213 if cinematic then |
|
214 SetCinematicMode(false) |
|
215 cinematic = false |
|
216 end |
|
217 |
|
218 waterCounter = waterCounter + 1 |
|
219 if (waterCounter == 100) and (waterPix < 1615) then |
|
220 waterCounter = 0 |
|
221 SetTag(AddGear(0, 0, gtWaterUp, 0, 0, 0, 0), 1) |
|
222 waterPix = waterPix +1 |
|
223 --AddCaption(waterPix) |
|
224 |
|
225 if (waterPix >= 1615) and (GameOver == false) then |
|
226 GameOver = true |
|
227 AddCaption(loc("The flood has stopped! Challenge over.")) |
|
228 SendStat(siGameResult, loc("Challenge completed!")) |
|
229 SendStat(siPlayerKills, tostring(hhCount), loc("Nameless Heroes")) |
|
230 SendStat(siPointType, loc("rescues")) |
|
231 |
|
232 -- Do not count drowning hedgehogs |
|
233 local hhLeft = hhCount |
|
234 for i=1,#hh do |
|
235 local isDrowning = band(GetState(hh[i]),gstDrowning) ~= 0 |
|
236 if isDrowning then |
|
237 hhLeft = hhLeft - 1 |
|
238 end |
|
239 end |
|
240 |
|
241 SendStat(siCustomAchievement, string.format(loc("You saved %d of 8 Hapless Hogs."), hhLeft)) |
|
242 |
|
243 if hhLeft == 8 then |
|
244 AddCaption(loc("Achievement obtained: Lively Lifeguard"),0xffba00ff,capgrpMessage2) |
|
245 SendStat(siCustomAchievement, loc("You have obtained an achievement: Lively Lifeguard")) |
|
246 end |
|
247 EndGame() |
|
248 |
|
249 end |
|
250 |
|
251 end |
|
252 |
|
253 end |
|
254 end |
|
255 |
|
256 |
|
257 function onAmmoStoreInit() |
|
258 |
|
259 SetAmmo(amBazooka, 9, 0, 0, 0) |
|
260 |
|
261 SetAmmo(amRope, 9, 0, 0, 0) |
|
262 SetAmmo(amParachute, 9, 0, 0, 0) |
|
263 SetAmmo(amJetpack, 2, 0, 0, 2) |
|
264 |
|
265 SetAmmo(amGirder, 9, 0, 0, 0) |
|
266 SetAmmo(amBaseballBat, 9, 0, 0, 0) |
|
267 |
|
268 SetAmmo(amTeleport, 1, 0, 0, 1) |
|
269 SetAmmo(amPortalGun, 3, 0, 0, 1) |
|
270 |
|
271 SetAmmo(amLowGravity, 0, 0, 0, 1) |
|
272 |
|
273 end |
|
274 |
|
275 function onGearDelete(gear) |
|
276 |
|
277 if GetGearType(gear) == gtHedgehog then |
|
278 if GetHogTeamName(gear) == loc("Hapless Hogs") then |
|
279 hhCount = hhCount - 1 |
|
280 AddCaption(string.format(loc("%d Hapless Hogs left"), hhCount)) |
|
281 end |
|
282 end |
|
283 |
|
284 if ((gear == player) or (hhCount == 0)) and (GameOver == false) then |
|
285 SetHealth(player, 0) |
|
286 AddCaption(loc("Disqualified!")) |
|
287 if gear == player then |
|
288 SendStat(siCustomAchievement, loc("Your hedgehog died!")) |
|
289 SendStat(siCustomAchievement, loc("You must survive the flood in order to score.")) |
|
290 else |
|
291 SendStat(siCustomAchievement, loc("You haven't rescued anyone.")) |
|
292 end |
|
293 SendStat(siPlayerKills, "0", loc("Nameless Heroes")) |
|
294 SendStat(siPointType, loc("points")) |
|
295 |
|
296 SendStat(siGameResult, loc("Disqualified!")) |
|
297 GameOver = true |
|
298 EndGame() |
|
299 end |
|
300 |
|
301 end |
|