161 SetEffect(playerHog, heInvulnerable, 1) |
161 SetEffect(playerHog, heInvulnerable, 1) |
162 SetState(playerHog, bor(GetState(playerHog), gstWinner)) |
162 SetState(playerHog, bor(GetState(playerHog), gstWinner)) |
163 SetState(playerHog, band(GetState(playerHog), bnot(gstHHDriven))) |
163 SetState(playerHog, band(GetState(playerHog), bnot(gstHHDriven))) |
164 AddCaption(loc("Challenge completed!")) |
164 AddCaption(loc("Challenge completed!")) |
165 SendStat(siGameResult, loc("Challenge completed!")) |
165 SendStat(siGameResult, loc("Challenge completed!")) |
166 SendStat(siPointType, loc("milliseconds")) |
166 SendStat(siPointType, "!TIME") |
167 local time = startTime - endTime |
167 local time = startTime - endTime |
168 SendStat(siPlayerKills, tostring(time), GetHogTeamName(playerHog)) |
168 SendStat(siPlayerKills, tostring(time), GetHogTeamName(playerHog)) |
169 SendStat(siCustomAchievement, string.format(loc("You have finished the challenge in %.3f s."), (time/1000))) |
169 SendStat(siCustomAchievement, string.format(loc("You have finished the challenge in %.3f s."), (time/1000))) |
170 SetTurnTimeLeft(0) |
170 SetTurnTimeLeft(0) |
171 updateChallengeRecord("TimeRecord", time) |
171 updateChallengeRecord("TimeRecord", time) |
172 else |
172 else |
173 SendStat(siGameResult, loc("Challenge failed!")) |
173 SendStat(siGameResult, loc("Challenge failed!")) |
174 SendStat(siPointType, loc("crate(s)")) |
174 SendStat(siPointType, "!CRATES") |
175 SendStat(siPlayerKills, tostring(cratesCollected), GetHogTeamName(playerHog)) |
175 SendStat(siPlayerKills, tostring(cratesCollected), GetHogTeamName(playerHog)) |
176 SendStat(siCustomAchievement, string.format(loc("You have collected %d out of %d crate(s)."), cratesCollected, #crates)) |
176 SendStat(siCustomAchievement, string.format(loc("You have collected %d out of %d crate(s)."), cratesCollected, #crates)) |
177 end |
177 end |
178 gameEnded = true |
178 gameEnded = true |
179 EndGame() |
179 EndGame() |