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