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