author | Wuzzy <almikes@aol.com> |
Wed, 13 Apr 2016 14:39:17 +0200 | |
changeset 11968 | 1de4d6b35748 |
parent 11521 | share/hedgewars/Data/Missions/Training/User_Mission_-_That_Sinking_Feeling.lua@dc36fad455f4 |
child 12344 | 877f55c77a3f |
permissions | -rw-r--r-- |
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 |
|
11521
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
15 |
local cinematic = false |
5278 | 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!")) |
|
11009 | 24 |
ShowMission(loc("That Sinking Feeling"), loc("Challenge"), loc("Save as many hapless hogs as possible!"), 4, 0) |
25 |
SetInputMask(0xFFFFFFFF) |
|
5278 | 26 |
end |
27 |
end |
|
28 |
||
29 |
function onGameInit() |
|
30 |
||
31 |
Seed = 0 |
|
11009 | 32 |
GameFlags = gfInfAttack + gfInvulnerable + gfOneClanMode |
5278 | 33 |
TurnTime = 90000 |
34 |
CaseFreq = 0 |
|
35 |
MinesNum = 0 |
|
36 |
MinesTime = 3000 |
|
37 |
Explosives = 0 |
|
38 |
Delay = 10 |
|
39 |
Map = "Islands" |
|
40 |
Theme = "City" |
|
5823 | 41 |
SuddenDeathTurns = 1 |
5278 | 42 |
|
11009 | 43 |
AddTeam(loc("Hapless Hogs"), 14483456, "Simple", "Island", "Default") |
5823 | 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") |
|
5278 | 49 |
hh[5] = AddHog(loc("Careless"), 1, 100, "StrawHatEyes") |
5823 | 50 |
hh[6] = AddHog(loc("Sponge"), 1, 100, "sf_chunli") |
51 |
hh[7] = AddHog(loc("Deadweight"), 1, 100, "dish_Teacup") |
|
5278 | 52 |
|
11009 | 53 |
AddTeam(loc("Nameless Heroes"), 14483456, "Simple", "Island", "Default", "cm_crossedswords") |
54 |
player = AddHog(loc("The Nameless One"), 0, 1, "NoHat") |
|
55 |
||
5278 | 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 |
||
11009 | 66 |
-- Disable all input except [Precise] for the intro |
67 |
SetInputMask(gmPrecise) |
|
5278 | 68 |
end |
69 |
||
70 |
||
71 |
function onGameStart() |
|
11521
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
72 |
cinematic = true |
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
73 |
SetCinematicMode(true) |
11009 | 74 |
SendHealthStatsOff() |
5278 | 75 |
|
11009 | 76 |
ShowMission(loc("That Sinking Feeling"), loc("Challenge"), loc("Save as many hapless hogs as possible!"), 4, 1) |
5278 | 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 |
||
5823 | 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 |
|
5278 | 104 |
|
5823 | 105 |
|
106 |
--AddCaption(loc("Press [Precise] to skip intro")) |
|
5278 | 107 |
genCounter = genCounter + 1 |
108 |
||
109 |
if introStage == 0 then |
|
110 |
||
5823 | 111 |
|
112 |
--FollowGear(hh[0]) |
|
5278 | 113 |
|
114 |
if genCounter == 2000 then |
|
5823 | 115 |
watGear = hh[0] |
5278 | 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 |
|
5823 | 123 |
|
124 |
--FollowGear(hh[1]) |
|
5278 | 125 |
|
126 |
if genCounter == 2000 then |
|
5823 | 127 |
watGear = hh[1] |
5278 | 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 |
||
5823 | 136 |
--FollowGear(hh[0]) |
5278 | 137 |
|
138 |
if genCounter == 2000 then |
|
5823 | 139 |
watGear = hh[0] |
5278 | 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 |
||
5823 | 148 |
--FollowGear(hh[1]) |
5278 | 149 |
|
150 |
if genCounter == 2000 then |
|
5823 | 151 |
watGear = hh[1] |
5278 | 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 |
||
5823 | 160 |
--FollowGear(hh[0]) |
5278 | 161 |
|
162 |
if genCounter == 2000 then |
|
5823 | 163 |
watGear = hh[0] |
5278 | 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 |
||
5823 | 173 |
--FollowGear(hh[1]) |
5278 | 174 |
|
175 |
if genCounter == 2000 then |
|
5823 | 176 |
watGear = hh[1] |
5278 | 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 |
||
5823 | 186 |
--FollowGear(hh[0]) |
5278 | 187 |
|
188 |
if genCounter == 2000 then |
|
5823 | 189 |
watGear = hh[0] |
5278 | 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) |
|
11009 | 203 |
SetInputMask(0xFFFFFFFF) |
5278 | 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 |
||
11521
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
213 |
if cinematic then |
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
214 |
SetCinematicMode(false) |
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
215 |
cinematic = false |
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
216 |
end |
dc36fad455f4
add cinematic effect to "sinking feeling" intro sequence
sheepluva
parents:
11262
diff
changeset
|
217 |
|
5278 | 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 |
|
11262
6e1aa1144a2b
- Finally added rus localization for all User Missions
antonc27 <antonc27@mail.ru>
parents:
11009
diff
changeset
|
227 |
AddCaption(loc("The flood has stopped! Challenge over.")) |
11009 | 228 |
SendStat(siGameResult, loc("Challenge completed!")) |
229 |
SendStat(siPlayerKills, tostring(hhCount), loc("Nameless Heroes")) |
|
11262
6e1aa1144a2b
- Finally added rus localization for all User Missions
antonc27 <antonc27@mail.ru>
parents:
11009
diff
changeset
|
230 |
SendStat(siPointType, loc("rescues")) |
5823 | 231 |
|
11009 | 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 |
|
5823 | 239 |
end |
240 |
||
11009 | 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 |
||
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 |
|
293 |
SendStat(siPlayerKills, "0", loc("Nameless Heroes")) |
|
11262
6e1aa1144a2b
- Finally added rus localization for all User Missions
antonc27 <antonc27@mail.ru>
parents:
11009
diff
changeset
|
294 |
SendStat(siPointType, loc("points")) |
11009 | 295 |
|
296 |
SendStat(siGameResult, loc("Disqualified!")) |
|
5278 | 297 |
GameOver = true |
11009 | 298 |
EndGame() |
5278 | 299 |
end |
300 |
||
301 |
end |