95 function onGameStart() |
95 function onGameStart() |
96 AnimWait(hero.gear, 3000) |
96 AnimWait(hero.gear, 3000) |
97 FollowGear(hero.gear) |
97 FollowGear(hero.gear) |
98 |
98 |
99 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
99 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
|
100 AddEvent(onRunnerDeath, {runner.gear}, runnerDeath, {runner.gear}, 0) |
100 |
101 |
101 if record ~= nil then |
102 if record ~= nil then |
102 goals[dialog01][3] = goals[dialog01][3] .. "|" .. string.format(loc("Personal best: %.3f seconds"), record/1000) |
103 goals[dialog01][3] = goals[dialog01][3] .. "|" .. string.format(loc("Personal best: %.3f seconds"), record/1000) |
103 end |
104 end |
104 AddAmmo(hero.gear, amRope, 1) |
105 AddAmmo(hero.gear, amRope, 1) |
192 return true |
193 return true |
193 end |
194 end |
194 return false |
195 return false |
195 end |
196 end |
196 |
197 |
|
198 function onRunnerDeath(gear) |
|
199 if not GetHealth(runner.gear) then |
|
200 return true |
|
201 end |
|
202 return false |
|
203 end |
|
204 |
197 -------------- ACTIONS ------------------ |
205 -------------- ACTIONS ------------------ |
198 |
206 |
199 function heroDeath(gear) |
207 function heroDeath(gear) |
200 lose() |
208 lose() |
|
209 end |
|
210 |
|
211 function runnerDeath(gear) |
|
212 loseRunnerDeath() |
201 end |
213 end |
202 |
214 |
203 -------------- ANIMATIONS ------------------ |
215 -------------- ANIMATIONS ------------------ |
204 |
216 |
205 function Skipanim(anim) |
217 function Skipanim(anim) |
310 SendStat(siPointType, "!EMPTY") |
322 SendStat(siPointType, "!EMPTY") |
311 SendStat(siPlayerKills, "0", teamA.name) |
323 SendStat(siPlayerKills, "0", teamA.name) |
312 EndGame() |
324 EndGame() |
313 end |
325 end |
314 |
326 |
|
327 function loseRunnerDeath() |
|
328 if lostGame then |
|
329 return |
|
330 end |
|
331 lostGame = true |
|
332 SendStat(siGameResult, loc("Race failed!")) |
|
333 SendStat(siCustomAchievement, loc("The other hog has died, he should have survived!")) |
|
334 SendStat(siCustomAchievement, loc("You have to catch the other hog 3 times.")) |
|
335 SendStat(siTeamRank, "1") |
|
336 SendStat(siPlayerKills, tostring(GetTeamStats(teamB.name).Kills), teamB.name) |
|
337 SendStat(siTeamRank, "1") |
|
338 SendStat(siPlayerKills, tostring(GetTeamStats(teamA.name).Kills), teamA.name) |
|
339 EndGame() |
|
340 end |
|
341 |
315 function win() |
342 function win() |
316 SendStat(siGameResult, loc("Congratulations, you are the fastest!")) |
343 SendStat(siGameResult, loc("Congratulations, you are the fastest!")) |
317 -- siCustomAchievements were added earlier |
344 -- siCustomAchievements were added earlier |
318 SendStat(siPointType, "!TIME") |
345 SendStat(siPointType, "!TIME") |
319 SendStat(siPlayerKills, tostring(winningTime), teamA.name) |
346 SendStat(siPlayerKills, tostring(winningTime), teamA.name) |