11 local campaignName = loc("A Space Adventure") |
11 local campaignName = loc("A Space Adventure") |
12 local missionName = loc("Ice planet, A Saucer Race!") |
12 local missionName = loc("Ice planet, A Saucer Race!") |
13 local challengeStarted = false |
13 local challengeStarted = false |
14 local currentWaypoint = 1 |
14 local currentWaypoint = 1 |
15 local radius = 75 |
15 local radius = 75 |
|
16 local totalTime = 15000 |
|
17 local totalSaucers = 3 |
|
18 local gameEnded = false |
16 -- dialogs |
19 -- dialogs |
17 local dialog01 = {} |
20 local dialog01 = {} |
18 -- mission objectives |
21 -- mission objectives |
19 local goals = { |
22 local goals = { |
20 [dialog01] = {missionName, loc("Getting ready"), loc("Use your saucer and pass from the rings!"), 1, 4500}, |
23 [dialog01] = {missionName, loc("Getting ready"), loc("Use your saucer and pass from the rings!"), 1, 4500}, |
88 AnimWait(hero.gear, 3000) |
91 AnimWait(hero.gear, 3000) |
89 FollowGear(hero.gear) |
92 FollowGear(hero.gear) |
90 |
93 |
91 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
94 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
92 |
95 |
93 AddAmmo(hero.gear, amJetpack, 2) |
96 AddAmmo(hero.gear, amJetpack, 3) |
94 |
97 |
95 -- place a waypoint |
98 -- place a waypoint |
96 placeNextWaypoint() |
99 placeNextWaypoint() |
97 |
100 |
98 SendHealthStatsOff() |
101 SendHealthStatsOff() |
114 CheckEvents() |
117 CheckEvents() |
115 end |
118 end |
116 |
119 |
117 function onGameTick20() |
120 function onGameTick20() |
118 if checkIfHeroInWaypoint() then |
121 if checkIfHeroInWaypoint() then |
119 if not placeNextWaypoint() then |
122 if not gameEnded and not placeNextWaypoint() then |
|
123 gameEnded = true |
120 -- GAME OVER, WIN! |
124 -- GAME OVER, WIN! |
|
125 totalTime = totalTime - TurnTimeLeft |
|
126 totalTime = totalTime / 1000 |
|
127 local saucersLeft = GetAmmoCount(hero.gear, amJetpack) |
|
128 local saucersUsed = totalSaucers - saucersLeft |
|
129 SendStat('siGameResult', loc("Hoo Ray! You are a champion!")) --1 |
|
130 SendStat('siCustomAchievement', loc("You complete the mission in "..totalTime.." seconds")) --11 |
|
131 SendStat('siCustomAchievement', loc("You have used "..saucersUsed.." flying saucers")) --11 |
|
132 SendStat('siCustomAchievement', loc("You had "..saucersLeft.." more flying saucers left")) --11 |
|
133 SendStat('siPlayerKills','1',teamA.name) |
121 EndGame() |
134 EndGame() |
122 end |
135 end |
123 end |
136 end |
124 end |
137 end |
125 |
138 |
191 wp.gear = AddVisualGear(1,1,vgtCircle,1,true) |
204 wp.gear = AddVisualGear(1,1,vgtCircle,1,true) |
192 SetVisualGearValues(wp.gear, wp.x,wp.y, 20, 200, 0, 0, 100, radius, 3, 0xff0000ff) |
205 SetVisualGearValues(wp.gear, wp.x,wp.y, 20, 200, 0, 0, 100, radius, 3, 0xff0000ff) |
193 -- add bonus time and "fuel" |
206 -- add bonus time and "fuel" |
194 if currentWaypoint % 2 == 0 then |
207 if currentWaypoint % 2 == 0 then |
195 AddAmmo(hero.gear, amJetpack, GetAmmoCount(hero.gear, amJetpack)+1) |
208 AddAmmo(hero.gear, amJetpack, GetAmmoCount(hero.gear, amJetpack)+1) |
196 if TurnTimeLeft <= 20000 then |
209 totalSaucers = totalSaucers + 1 |
|
210 if TurnTimeLeft <= 22000 then |
197 TurnTimeLeft = TurnTimeLeft + 8000 |
211 TurnTimeLeft = TurnTimeLeft + 8000 |
|
212 totalTime = totalTime + 8000 |
198 end |
213 end |
199 else |
214 else |
200 if TurnTimeLeft <= 14000 then |
215 if TurnTimeLeft <= 16000 then |
201 TurnTimeLeft = TurnTimeLeft + 6000 |
216 TurnTimeLeft = TurnTimeLeft + 6000 |
|
217 totalTime = totalTime + 6000 |
202 end |
218 end |
203 end |
219 end |
204 radius = radius - 4 |
220 radius = radius - 4 |
205 currentWaypoint = currentWaypoint + 1 |
221 currentWaypoint = currentWaypoint + 1 |
206 return true |
222 return true |