21 local GREEN = 0x38d61cff |
21 local GREEN = 0x38d61cff |
22 local challengeObjectives = loc("To win the game you have to pass into the rings in time.").. |
22 local challengeObjectives = loc("To win the game you have to pass into the rings in time.").. |
23 "|"..loc("You'll get extra time in case you need it when you pass a ring.").."|".. |
23 "|"..loc("You'll get extra time in case you need it when you pass a ring.").."|".. |
24 loc("Every 2 rings, the ring color will be green and you'll get an extra flying saucer.").."|".. |
24 loc("Every 2 rings, the ring color will be green and you'll get an extra flying saucer.").."|".. |
25 loc("Use the attack key twice to change the flying saucer while floating in mid-air.") |
25 loc("Use the attack key twice to change the flying saucer while floating in mid-air.") |
|
26 local timeRecord |
26 -- dialogs |
27 -- dialogs |
27 local dialog01 = {} |
28 local dialog01 = {} |
28 -- mission objectives |
|
29 local goals = { |
|
30 ["init"] = {missionName, loc("Getting ready"), challengeObjectives, 1, 25000}, |
|
31 } |
|
32 -- hogs |
29 -- hogs |
33 local hero = {} |
30 local hero = {} |
34 local ally = {} |
31 local ally = {} |
35 -- teams |
32 -- teams |
36 local teamA = {} |
33 local teamA = {} |
92 AddTeam(teamB.name, teamB.color, "heart", "Island", "Default", "cm_face") |
89 AddTeam(teamB.name, teamB.color, "heart", "Island", "Default", "cm_face") |
93 ally.gear = AddHog(ally.name, 0, 100, "war_airwarden02") |
90 ally.gear = AddHog(ally.name, 0, 100, "war_airwarden02") |
94 AnimSetGearPosition(ally.gear, ally.x, ally.y) |
91 AnimSetGearPosition(ally.gear, ally.x, ally.y) |
95 HogTurnLeft(ally.gear, true) |
92 HogTurnLeft(ally.gear, true) |
96 |
93 |
|
94 timeRecord = tonumber(GetCampaignVar("IceStadiumBestTime")) |
|
95 |
97 initCheckpoint("ice02") |
96 initCheckpoint("ice02") |
98 |
97 |
99 AnimInit(true) |
98 AnimInit(true) |
100 AnimationSetup() |
99 AnimationSetup() |
|
100 end |
|
101 |
|
102 function ShowGoals() |
|
103 -- mission objectives |
|
104 local goalStr = challengeObjectives |
|
105 if timeRecord ~= nil then |
|
106 local personalBestStr = string.format(loc("Personal best: %.3f seconds"), timeRecord/1000) |
|
107 goalStr = goalStr .. "|" .. personalBestStr |
|
108 end |
|
109 ShowMission(missionName, loc("Getting ready"), goalStr, 1, 25000) |
101 end |
110 end |
102 |
111 |
103 function onGameStart() |
112 function onGameStart() |
104 AnimWait(hero.gear, 3000) |
113 AnimWait(hero.gear, 3000) |
105 FollowGear(hero.gear) |
114 FollowGear(hero.gear) |
106 ShowMission(unpack(goals["init"])) |
115 ShowGoals() |
107 HideMission() |
116 HideMission() |
108 |
117 |
109 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
118 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
110 |
119 |
111 AddAmmo(hero.gear, amJetpack, 3) |
120 AddAmmo(hero.gear, amJetpack, 3) |
143 local totalTimePrinted = totalTime / 1000 |
152 local totalTimePrinted = totalTime / 1000 |
144 local saucersLeft = GetAmmoCount(hero.gear, amJetpack) |
153 local saucersLeft = GetAmmoCount(hero.gear, amJetpack) |
145 local saucersUsed = totalSaucers - saucersLeft |
154 local saucersUsed = totalSaucers - saucersLeft |
146 SendStat(siGameResult, loc("Hooray! You are a champion!")) |
155 SendStat(siGameResult, loc("Hooray! You are a champion!")) |
147 SendStat(siCustomAchievement, string.format(loc("You completed the mission in %.3f seconds."), totalTimePrinted)) |
156 SendStat(siCustomAchievement, string.format(loc("You completed the mission in %.3f seconds."), totalTimePrinted)) |
148 local record = tonumber(GetCampaignVar("IceStadiumBestTime")) |
157 if timeRecord ~= nil and totalTime >= timeRecord then |
149 if record ~= nil and totalTime >= record then |
158 SendStat(siCustomAchievement, string.format(loc("Your personal best time so far: %.3f seconds"), timeRecord/1000)) |
150 SendStat(siCustomAchievement, string.format(loc("Your personal best time so far: %.3f seconds"), record/1000)) |
159 end |
151 end |
160 if timeRecord == nil or totalTime < timeRecord then |
152 if record == nil or totalTime < record then |
|
153 SaveCampaignVar("IceStadiumBestTime", tostring(totalTime)) |
161 SaveCampaignVar("IceStadiumBestTime", tostring(totalTime)) |
154 if record ~= nil then |
162 if timeRecord ~= nil then |
155 SendStat(siCustomAchievement, loc("This is a new personal best time, congratulations!")) |
163 SendStat(siCustomAchievement, loc("This is a new personal best time, congratulations!")) |
156 end |
164 end |
157 end |
165 end |
158 SendStat(siCustomAchievement, string.format(loc("You have used %d flying saucers."), saucersUsed)) |
166 SendStat(siCustomAchievement, string.format(loc("You have used %d flying saucers."), saucersUsed)) |
159 SendStat(siCustomAchievement, string.format(loc("You had %d additional flying saucers left."), saucersLeft)) |
167 SendStat(siCustomAchievement, string.format(loc("You had %d additional flying saucers left."), saucersLeft)) |
160 |
168 |
161 record = tonumber(GetCampaignVar("IceStadiumLeastSaucersUsed")) |
169 local leastSaucersRecord = tonumber(GetCampaignVar("IceStadiumLeastSaucersUsed")) |
162 if record == nil or saucersUsed < record then |
170 if leastSaucersRecord == nil or saucersUsed < leastSaucersRecord then |
163 SaveCampaignVar("IceStadiumLeastSaucersUsed", tostring(saucersUsed)) |
171 SaveCampaignVar("IceStadiumLeastSaucersUsed", tostring(saucersUsed)) |
164 end |
172 end |
165 |
173 |
166 sendSimpleTeamRankings({teamA.name}) |
174 SendStat(siPointType, loc("milliseconds")) |
|
175 SendStat(siPlayerKills, totalTime, GetHogTeamName(hero.gear)) |
167 SaveCampaignVar("Mission6Won", "true") |
176 SaveCampaignVar("Mission6Won", "true") |
168 checkAllMissionsCompleted() |
177 checkAllMissionsCompleted() |
169 EndGame() |
178 EndGame() |
170 end |
179 end |
171 end |
180 end |
219 table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("This is the Olympic Stadium of Saucer Flying."), SAY_SAY, 4000}}) |
228 table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("This is the Olympic Stadium of Saucer Flying."), SAY_SAY, 4000}}) |
220 table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("All the saucer pilots dream to come here one day in order to compete with the best!"), SAY_SAY, 5000}}) |
229 table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("All the saucer pilots dream to come here one day in order to compete with the best!"), SAY_SAY, 5000}}) |
221 table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Now you have the chance to try and claim the place that you deserve among the best."), SAY_SAY, 6000}}) |
230 table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Now you have the chance to try and claim the place that you deserve among the best."), SAY_SAY, 6000}}) |
222 table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Can you do it?"), SAY_SAY, 2000}}) |
231 table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Can you do it?"), SAY_SAY, 2000}}) |
223 table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}}) |
232 table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}}) |
224 table.insert(dialog01, {func = ShowMission, args = goals["init"]}) |
233 table.insert(dialog01, {func = ShowGoals, args = {}}) |
225 table.insert(dialog01, {func = startFlying, args = {hero.gear}}) |
234 table.insert(dialog01, {func = startFlying, args = {hero.gear}}) |
226 end |
235 end |
227 |
236 |
228 ------------------ Other Functions ------------------- |
237 ------------------ Other Functions ------------------- |
229 |
238 |