# HG changeset patch # User Periklis Ntanasis # Date 1377190627 -10800 # Node ID 241ffe433c3de4377206437c384a9f2dc2470681 # Parent 5872edd6864e655bef77634eacd2f9158aa4a499 win event diff -r 5872edd6864e -r 241ffe433c3d share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death01.lua --- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death01.lua Thu Aug 22 03:21:30 2013 +0300 +++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death01.lua Thu Aug 22 19:57:07 2013 +0300 @@ -123,6 +123,9 @@ AnimWait(hero.gear, 3000) FollowGear(hero.gear) + AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) + AddEvent(onEnemiesDeath, {hero.gear}, enemiesDeath, {hero.gear}, 0) + -- add crates SpawnAmmoCrate(portalCrate.x, portalCrate.y, amPortalGun) SpawnAmmoCrate(cakeCrate.x, cakeCrate.y, amCake) @@ -201,6 +204,21 @@ return false end +function onEnemiesDeath(gear) + local allDead = true + if professor.dead then + for i=1,table.getn(thugs) do + if GetHealth(thugs[i]) then + allDead = false + break + end + end + else + allDead = false + end + return allDead +end + -------------- ACTIONS ------------------ function heroDeath(gear) @@ -211,6 +229,16 @@ EndGame() end +function enemiesDeath(gear) + SendStat('siGameResult', loc("Congratulations, you won!")) --1 + SendStat('siCustomAchievement', loc("You have successfuly eliminated Professor Hogevil")) --11 + SendStat('siCustomAchievement', loc("You have rescued H and Dr. Cornelius")) --11 + SendStat('siCustomAchievement', loc("You have acquired the device")) --11 + SendStat('siPlayerKills','1',teamA.name) + SendStat('siPlayerKills','0',teamC.name) + EndGame() +end + -------------- ANIMATIONS ------------------ function Skipanim(anim) @@ -221,4 +249,5 @@ function AnimationSetup() -- TODO ADD DIALOGS + end