author | nemo |
Fri, 17 Aug 2018 22:23:19 -0400 | |
changeset 13669 | c6ee1b0b957f |
parent 13583 | 141cdfe0f3ca |
child 13742 | 2bb7141496a9 |
permissions | -rw-r--r-- |
5278 | 1 |
|
2 |
||
8043 | 3 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
13501
cbda0f842364
Standardize hidden mission achievement in new Lua library "Achievements"
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
4 |
HedgewarsScriptLoad("/Scripts/Achievements.lua") |
5278 | 5 |
|
6 |
local player |
|
7 |
local hh = {} |
|
8 |
local hhCount = 8 |
|
9 |
local GameOver = false |
|
10 |
local introStage = 0 |
|
11 |
local genCounter = 0 |
|
12 |
local waterCounter = 0 |
|
13 |
local waterPix = 0 |
|
5823 | 14 |
local frig = 0 |
15 |
local watGear = nil |
|
11521
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
16 |
local cinematic = false |
5278 | 17 |
|
18 |
-- allow skipping of the intro via hitting precise key |
|
19 |
function onPrecise() |
|
20 |
if introStage < 100 then |
|
21 |
introStage = 110 |
|
22 |
genCounter = 0 |
|
23 |
FollowGear(CurrentHedgehog) |
|
24 |
AddCaption(loc("Good luck out there!")) |
|
11009 | 25 |
ShowMission(loc("That Sinking Feeling"), loc("Challenge"), loc("Save as many hapless hogs as possible!"), 4, 0) |
26 |
SetInputMask(0xFFFFFFFF) |
|
5278 | 27 |
end |
28 |
end |
|
29 |
||
30 |
function onGameInit() |
|
31 |
||
32 |
Seed = 0 |
|
11009 | 33 |
GameFlags = gfInfAttack + gfInvulnerable + gfOneClanMode |
5278 | 34 |
TurnTime = 90000 |
35 |
CaseFreq = 0 |
|
36 |
MinesNum = 0 |
|
37 |
MinesTime = 3000 |
|
38 |
Explosives = 0 |
|
39 |
Delay = 10 |
|
40 |
Map = "Islands" |
|
41 |
Theme = "City" |
|
5823 | 42 |
SuddenDeathTurns = 1 |
5278 | 43 |
|
13583
141cdfe0f3ca
Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents:
13501
diff
changeset
|
44 |
AddTeam(loc("Hapless Hogs"), -1, "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 |
|
13583
141cdfe0f3ca
Switch almost all Lua calls of AddTeam to using default clan colors instead of hardcoded color
Wuzzy <Wuzzy2@mail.ru>
parents:
13501
diff
changeset
|
54 |
AddTeam(loc("Nameless Heroes"), -1, "Simple", "Island", "Default", "cm_crossedswords") |
11009 | 55 |
player = AddHog(loc("The Nameless One"), 0, 1, "NoHat") |
56 |
||
5278 | 57 |
SetGearPosition(player, 3992, 733) |
58 |
SetGearPosition(hh[0], 938, 1369) |
|
59 |
SetGearPosition(hh[1], 1301, 1439) |
|
60 |
SetGearPosition(hh[2], 2093, 447) |
|
61 |
SetGearPosition(hh[3], 2971, 926) |
|
62 |
SetGearPosition(hh[4], 719, 545) |
|
63 |
SetGearPosition(hh[5], 1630, 821) |
|
64 |
SetGearPosition(hh[6], 2191, 810) |
|
65 |
SetGearPosition(hh[7], 3799, 945) |
|
66 |
||
11009 | 67 |
-- Disable all input except [Precise] for the intro |
68 |
SetInputMask(gmPrecise) |
|
5278 | 69 |
end |
70 |
||
71 |
||
72 |
function onGameStart() |
|
11521
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
73 |
cinematic = true |
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
74 |
SetCinematicMode(true) |
11009 | 75 |
SendHealthStatsOff() |
5278 | 76 |
|
11009 | 77 |
ShowMission(loc("That Sinking Feeling"), loc("Challenge"), loc("Save as many hapless hogs as possible!"), 4, 1) |
5278 | 78 |
|
79 |
HogTurnLeft(hh[0], false) |
|
80 |
HogTurnLeft(hh[1], true) |
|
81 |
||
12933
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12346
diff
changeset
|
82 |
SpawnSupplyCrate(148,265,amLowGravity) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12346
diff
changeset
|
83 |
SpawnSupplyCrate(2124,1516,amJetpack) |
5278 | 84 |
|
85 |
end |
|
86 |
||
87 |
||
88 |
function onNewTurn() |
|
89 |
TurnTimeLeft = -1 |
|
90 |
end |
|
91 |
||
92 |
function onGameTick() |
|
93 |
||
94 |
-- intro sequence |
|
95 |
if introStage < 100 then |
|
96 |
||
5823 | 97 |
frig = frig + 1 |
98 |
if frig == 50 then |
|
99 |
frig = 0 |
|
100 |
AddCaption(loc("Press [Precise] to skip intro")) |
|
101 |
if watGear ~= nil then |
|
102 |
FollowGear(watGear) |
|
103 |
end |
|
104 |
end |
|
5278 | 105 |
|
5823 | 106 |
|
107 |
--AddCaption(loc("Press [Precise] to skip intro")) |
|
5278 | 108 |
genCounter = genCounter + 1 |
109 |
||
110 |
if introStage == 0 then |
|
111 |
||
5823 | 112 |
|
113 |
--FollowGear(hh[0]) |
|
5278 | 114 |
|
115 |
if genCounter == 2000 then |
|
5823 | 116 |
watGear = hh[0] |
5278 | 117 |
HogSay(hh[0], loc("This rain is really something..."), SAY_SAY,2) |
118 |
elseif genCounter == 5000 then |
|
119 |
introStage = 1 |
|
120 |
genCounter = 0 |
|
121 |
end |
|
122 |
||
123 |
elseif introStage == 1 then |
|
5823 | 124 |
|
125 |
--FollowGear(hh[1]) |
|
5278 | 126 |
|
127 |
if genCounter == 2000 then |
|
5823 | 128 |
watGear = hh[1] |
5278 | 129 |
HogSay(hh[1], loc("Heh, it's not that bad."), SAY_SAY,2) |
130 |
elseif genCounter == 5000 then |
|
131 |
introStage = 2 |
|
132 |
genCounter = 0 |
|
133 |
end |
|
134 |
||
135 |
elseif introStage == 2 then |
|
136 |
||
5823 | 137 |
--FollowGear(hh[0]) |
5278 | 138 |
|
139 |
if genCounter == 2000 then |
|
5823 | 140 |
watGear = hh[0] |
5278 | 141 |
HogSay(hh[0], loc("You'd almost swear the water was rising!"), SAY_SHOUT,2) |
142 |
elseif genCounter == 6000 then |
|
143 |
introStage = 3 |
|
144 |
genCounter = 0 |
|
145 |
end |
|
146 |
||
147 |
elseif introStage == 3 then |
|
148 |
||
5823 | 149 |
--FollowGear(hh[1]) |
5278 | 150 |
|
151 |
if genCounter == 2000 then |
|
5823 | 152 |
watGear = hh[1] |
5278 | 153 |
HogSay(hh[1], loc("Haha, now THAT would be something!"), SAY_SAY,2) |
154 |
elseif genCounter == 6000 then |
|
155 |
introStage = 4 |
|
156 |
genCounter = 0 |
|
157 |
end |
|
158 |
||
159 |
elseif introStage == 4 then |
|
160 |
||
5823 | 161 |
--FollowGear(hh[0]) |
5278 | 162 |
|
163 |
if genCounter == 2000 then |
|
5823 | 164 |
watGear = hh[0] |
5278 | 165 |
HogSay(hh[0], loc("Hahahaha!"), SAY_SHOUT,2) |
166 |
HogSay(hh[1], loc("Hahahaha!"), SAY_SHOUT,2) |
|
167 |
elseif genCounter == 3000 then |
|
168 |
introStage = 5 |
|
169 |
genCounter = 0 |
|
170 |
end |
|
171 |
||
172 |
elseif introStage == 5 then |
|
173 |
||
5823 | 174 |
--FollowGear(hh[1]) |
5278 | 175 |
|
176 |
if genCounter == 2000 then |
|
5823 | 177 |
watGear = hh[1] |
5278 | 178 |
HogSay(hh[0], loc("..."), SAY_THINK,2) |
179 |
HogSay(hh[1], loc("..."), SAY_THINK,2) |
|
180 |
elseif genCounter == 5000 then |
|
181 |
introStage = 6 |
|
182 |
genCounter = 0 |
|
183 |
end |
|
184 |
||
185 |
elseif introStage == 6 then |
|
186 |
||
5823 | 187 |
--FollowGear(hh[0]) |
5278 | 188 |
|
189 |
if genCounter == 2000 then |
|
5823 | 190 |
watGear = hh[0] |
5278 | 191 |
HogSay(hh[0], loc("It's a good thing SUDDEN DEATH is 99 turns away..."), SAY_THINK,2) |
192 |
elseif genCounter == 6000 then |
|
193 |
introStage = 7 |
|
194 |
genCounter = 0 |
|
195 |
end |
|
196 |
||
197 |
||
198 |
elseif introStage == 7 then |
|
199 |
||
200 |
if genCounter == 2000 then |
|
201 |
introStage = 110 |
|
202 |
FollowGear(CurrentHedgehog) |
|
203 |
ShowMission(loc("That Sinking Feeling"), loc("User Challenge"), loc("Save as many hapless hogs as possible!"), 4, 0) |
|
11009 | 204 |
SetInputMask(0xFFFFFFFF) |
5278 | 205 |
end |
206 |
||
207 |
end |
|
208 |
||
209 |
end |
|
210 |
||
211 |
-- start the water rising when the intro is finished |
|
212 |
if introStage == 110 then |
|
213 |
||
11521
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
214 |
if cinematic then |
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
215 |
SetCinematicMode(false) |
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
216 |
cinematic = false |
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
217 |
end |
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
218 |
|
5278 | 219 |
waterCounter = waterCounter + 1 |
220 |
if (waterCounter == 100) and (waterPix < 1615) then |
|
221 |
waterCounter = 0 |
|
222 |
SetTag(AddGear(0, 0, gtWaterUp, 0, 0, 0, 0), 1) |
|
223 |
waterPix = waterPix +1 |
|
224 |
--AddCaption(waterPix) |
|
225 |
||
226 |
if (waterPix >= 1615) and (GameOver == false) then |
|
227 |
GameOver = true |
|
11262
6e1aa1144a2b
- Finally added rus localization for all User Missions
antonc27 <antonc27@mail.ru>
parents:
11009
diff
changeset
|
228 |
AddCaption(loc("The flood has stopped! Challenge over.")) |
11009 | 229 |
SendStat(siGameResult, loc("Challenge completed!")) |
12346
fb22caa19600
Fix incorrect PointsType in sniper rifle training and That Sinking Feeling
Wuzzy <almikes@aol.com>
parents:
12344
diff
changeset
|
230 |
SendStat(siPointType, loc("rescues")) |
11009 | 231 |
SendStat(siPlayerKills, tostring(hhCount), loc("Nameless Heroes")) |
5823 | 232 |
|
11009 | 233 |
-- Do not count drowning hedgehogs |
234 |
local hhLeft = hhCount |
|
235 |
for i=1,#hh do |
|
236 |
local isDrowning = band(GetState(hh[i]),gstDrowning) ~= 0 |
|
237 |
if isDrowning then |
|
238 |
hhLeft = hhLeft - 1 |
|
239 |
end |
|
5823 | 240 |
end |
241 |
||
11009 | 242 |
SendStat(siCustomAchievement, string.format(loc("You saved %d of 8 Hapless Hogs."), hhLeft)) |
243 |
||
244 |
if hhLeft == 8 then |
|
13501
cbda0f842364
Standardize hidden mission achievement in new Lua library "Achievements"
Wuzzy <Wuzzy2@mail.ru>
parents:
12933
diff
changeset
|
245 |
awardAchievement(loc("Lively Lifeguard")) |
11009 | 246 |
end |
247 |
EndGame() |
|
248 |
||
5278 | 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 |
|
11009 | 278 |
if GetHogTeamName(gear) == loc("Hapless Hogs") then |
5278 | 279 |
hhCount = hhCount - 1 |
11009 | 280 |
AddCaption(string.format(loc("%d Hapless Hogs left"), hhCount)) |
5278 | 281 |
end |
282 |
end |
|
283 |
||
284 |
if ((gear == player) or (hhCount == 0)) and (GameOver == false) then |
|
285 |
SetHealth(player, 0) |
|
11009 | 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 |
|
12346
fb22caa19600
Fix incorrect PointsType in sniper rifle training and That Sinking Feeling
Wuzzy <almikes@aol.com>
parents:
12344
diff
changeset
|
293 |
SendStat(siPointType, loc("points")) |
11009 | 294 |
SendStat(siPlayerKills, "0", loc("Nameless Heroes")) |
295 |
||
296 |
SendStat(siGameResult, loc("Disqualified!")) |
|
5278 | 297 |
GameOver = true |
11009 | 298 |
EndGame() |
5278 | 299 |
end |
300 |
||
301 |
end |