121 |
121 |
122 function onGameStart() |
122 function onGameStart() |
123 AnimWait(hero.gear, 3000) |
123 AnimWait(hero.gear, 3000) |
124 FollowGear(hero.gear) |
124 FollowGear(hero.gear) |
125 |
125 |
|
126 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
|
127 AddEvent(onEnemiesDeath, {hero.gear}, enemiesDeath, {hero.gear}, 0) |
|
128 |
126 -- add crates |
129 -- add crates |
127 SpawnAmmoCrate(portalCrate.x, portalCrate.y, amPortalGun) |
130 SpawnAmmoCrate(portalCrate.x, portalCrate.y, amPortalGun) |
128 SpawnAmmoCrate(cakeCrate.x, cakeCrate.y, amCake) |
131 SpawnAmmoCrate(cakeCrate.x, cakeCrate.y, amCake) |
129 -- add explosives |
132 -- add explosives |
130 AddGear(1900, 850, gtExplosives, 0, 0, 0, 0) |
133 AddGear(1900, 850, gtExplosives, 0, 0, 0, 0) |
199 return true |
202 return true |
200 end |
203 end |
201 return false |
204 return false |
202 end |
205 end |
203 |
206 |
|
207 function onEnemiesDeath(gear) |
|
208 local allDead = true |
|
209 if professor.dead then |
|
210 for i=1,table.getn(thugs) do |
|
211 if GetHealth(thugs[i]) then |
|
212 allDead = false |
|
213 break |
|
214 end |
|
215 end |
|
216 else |
|
217 allDead = false |
|
218 end |
|
219 return allDead |
|
220 end |
|
221 |
204 -------------- ACTIONS ------------------ |
222 -------------- ACTIONS ------------------ |
205 |
223 |
206 function heroDeath(gear) |
224 function heroDeath(gear) |
207 SendStat('siGameResult', loc("Hog Solo lost, try again!")) --1 |
225 SendStat('siGameResult', loc("Hog Solo lost, try again!")) --1 |
208 SendStat('siCustomAchievement', loc("To win the game you have to eliminate your enemies")) --11 |
226 SendStat('siCustomAchievement', loc("To win the game you have to eliminate your enemies")) --11 |
209 SendStat('siPlayerKills','1',teamC.name) |
227 SendStat('siPlayerKills','1',teamC.name) |
210 SendStat('siPlayerKills','0',teamA.name) |
228 SendStat('siPlayerKills','0',teamA.name) |
211 EndGame() |
229 EndGame() |
212 end |
230 end |
213 |
231 |
|
232 function enemiesDeath(gear) |
|
233 SendStat('siGameResult', loc("Congratulations, you won!")) --1 |
|
234 SendStat('siCustomAchievement', loc("You have successfuly eliminated Professor Hogevil")) --11 |
|
235 SendStat('siCustomAchievement', loc("You have rescued H and Dr. Cornelius")) --11 |
|
236 SendStat('siCustomAchievement', loc("You have acquired the device")) --11 |
|
237 SendStat('siPlayerKills','1',teamA.name) |
|
238 SendStat('siPlayerKills','0',teamC.name) |
|
239 EndGame() |
|
240 end |
|
241 |
214 -------------- ANIMATIONS ------------------ |
242 -------------- ANIMATIONS ------------------ |
215 |
243 |
216 function Skipanim(anim) |
244 function Skipanim(anim) |
217 if goals[anim] ~= nil then |
245 if goals[anim] ~= nil then |
218 ShowMission(unpack(goals[anim])) |
246 ShowMission(unpack(goals[anim])) |
219 end |
247 end |
220 end |
248 end |
221 |
249 |
222 function AnimationSetup() |
250 function AnimationSetup() |
223 -- TODO ADD DIALOGS |
251 -- TODO ADD DIALOGS |
224 end |
252 |
|
253 end |