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