126 end |
126 end |
127 |
127 |
128 function onGameStart() |
128 function onGameStart() |
129 --SetClanColor(ClansCount-1, 0x0000ffff) appears to be broken |
129 --SetClanColor(ClansCount-1, 0x0000ffff) appears to be broken |
130 SendHealthStatsOff() |
130 SendHealthStatsOff() |
|
131 local recordInfo = "" |
|
132 if isSinglePlayer then |
|
133 recordInfo = getReadableChallengeRecord("Highscore") |
|
134 end |
131 ShowMission(loc("Climb Home"), |
135 ShowMission(loc("Climb Home"), |
132 loc("Challenge"), |
136 loc("Challenge"), |
133 loc("You are far from home, and the water is rising, climb up as high as you can!|Your score will be based on your height."), |
137 loc("You are far from home, and the water is rising, climb up as high as you can!|Your score will be based on your height.") |
|
138 .. "|" .. recordInfo, |
134 -amRope, 0) |
139 -amRope, 0) |
135 local x = 1818 |
140 local x = 1818 |
136 for h,i in pairs(HH) do |
141 for h,i in pairs(HH) do |
137 if h ~= nil then |
142 if h ~= nil then |
138 -- SetGearPosition(h,x,32549) |
143 -- SetGearPosition(h,x,32549) |
417 distance = distanceFromWater |
422 distance = distanceFromWater |
418 } |
423 } |
419 end |
424 end |
420 end |
425 end |
421 |
426 |
422 local finishTime = (GameTime-startTime)/1000 |
427 local rawFinishTime = GameTime-startTime |
|
428 local finishTime = rawFinishTime/1000 |
423 local roundedFinishTime = math.ceil(math.floor(finishTime+0.5)) |
429 local roundedFinishTime = math.ceil(math.floor(finishTime+0.5)) |
424 if isSinglePlayer then |
430 if isSinglePlayer then |
425 if distanceFromWater < 0 and not YouLost and not YouWon then |
431 if distanceFromWater < 0 and not YouLost and not YouWon then |
426 makeSinglePlayerLoserStats() |
432 makeSinglePlayerLoserStats() |
427 YouLost = true |
433 YouLost = true |
437 PlaySound(sndVictory,CurrentHedgehog) |
443 PlaySound(sndVictory,CurrentHedgehog) |
438 SetState(CurrentHedgehog, gstWinner) |
444 SetState(CurrentHedgehog, gstWinner) |
439 SendStat(siGameResult, loc("You have beaten the challenge!")) |
445 SendStat(siGameResult, loc("You have beaten the challenge!")) |
440 SendStat(siGraphTitle, loc("Your height over time")) |
446 SendStat(siGraphTitle, loc("Your height over time")) |
441 SendStat(siCustomAchievement, string.format(loc("%s reached home in %.3f seconds. Congratulations!"), GetHogName(CurrentHedgehog), finishTime)) |
447 SendStat(siCustomAchievement, string.format(loc("%s reached home in %.3f seconds. Congratulations!"), GetHogName(CurrentHedgehog), finishTime)) |
|
448 updateChallengeRecord("TimeRecord", rawFinishTime, false) |
442 SendStat(siCustomAchievement, string.format(loc("%s bravely climbed up to a dizzy height of %d to reach home."), GetHogName(CurrentHedgehog), getActualHeight(RecordHeight))) |
449 SendStat(siCustomAchievement, string.format(loc("%s bravely climbed up to a dizzy height of %d to reach home."), GetHogName(CurrentHedgehog), getActualHeight(RecordHeight))) |
|
450 updateChallengeRecord("Highscore", getActualHeight(RecordHeight)) |
443 SendStat(siPointType, loc("seconds")) |
451 SendStat(siPointType, loc("seconds")) |
444 SendStat(siPlayerKills, tostring(roundedFinishTime), GetHogTeamName(CurrentHedgehog)) |
452 SendStat(siPlayerKills, tostring(roundedFinishTime), GetHogTeamName(CurrentHedgehog)) |
445 |
453 |
446 EndGame() |
454 EndGame() |
447 onAchievementsDeclaration() |
455 onAchievementsDeclaration() |
681 if actualHeight > 1500 then |
689 if actualHeight > 1500 then |
682 SendStat(siCustomAchievement, string.format(text, RecordHeightHogName, actualHeight)) |
690 SendStat(siCustomAchievement, string.format(text, RecordHeightHogName, actualHeight)) |
683 else |
691 else |
684 SendStat(siCustomAchievement, string.format(text, RecordHeightHogName)) |
692 SendStat(siCustomAchievement, string.format(text, RecordHeightHogName)) |
685 end |
693 end |
|
694 |
|
695 updateChallengeRecord("Highscore", actualHeight) |
686 SendStat(siPointType, loc("points")) |
696 SendStat(siPointType, loc("points")) |
687 SendStat(siPlayerKills, actualHeight, GetHogTeamName(CurrentHedgehog)) |
697 SendStat(siPlayerKills, actualHeight, GetHogTeamName(CurrentHedgehog)) |
688 EndGame() |
698 EndGame() |
689 onAchievementsDeclaration() |
699 onAchievementsDeclaration() |
690 end |
700 end |