20 local dialog02 = {} |
20 local dialog02 = {} |
21 local dialog03 = {} |
21 local dialog03 = {} |
22 local dialog04 = {} |
22 local dialog04 = {} |
23 -- mission objectives |
23 -- mission objectives |
24 local goals = { |
24 local goals = { |
25 [dialog01] = {missionName, loc("Exploring the tunnel"), loc("With the help of the other hogs search for the device").."|"..loc("Hog Solo has to reach the last crates"), 1, 4000}, |
25 [dialog01] = {missionName, loc("Exploring the tunnel"), loc("Search for the device with the help of the other hedgehogs ").."|"..loc("Hog Solo has to reach the last crates"), 1, 4000}, |
26 [dialog02] = {missionName, loc("Exploring the tunnel"), loc("Explore the tunnel with the other hogs and search for the device").."|"..loc("Hog Solo has to reach the last crates"), 1, 4000}, |
26 [dialog02] = {missionName, loc("Exploring the tunnel"), loc("Explore the tunnel with the other hedgehogs and search for the device").."|"..loc("Hog Solo has to reach the last crates"), 1, 4000}, |
27 [dialog03] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack Captain Lime before he attacks back"), 1, 4000}, |
27 [dialog03] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack Captain Lime before he attacks back"), 1, 4000}, |
28 [dialog04] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack the assasins before they attack back"), 1, 4000}, |
28 [dialog04] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack the assassins before they attack back"), 1, 4000}, |
29 } |
29 } |
30 -- crates |
30 -- crates |
31 local eagleCrate = {name = amDEagle, x = 1680, y = 1650} |
31 local eagleCrate = {name = amDEagle, x = 1680, y = 1650} |
32 local girderCrate = {name = amGirder, x = 1680, y = 1160} |
32 local girderCrate = {name = amGirder, x = 1680, y = 1160} |
33 local ropeCrate = {name = amRope, x = 1400, y = 1870} |
33 local ropeCrate = {name = amRope, x = 1400, y = 1870} |
79 Explosives = 0 |
79 Explosives = 0 |
80 Delay = 3 |
80 Delay = 3 |
81 SuddenDeathTurns = 200 |
81 SuddenDeathTurns = 200 |
82 Map = "fruit02_map" |
82 Map = "fruit02_map" |
83 Theme = "Fruit" |
83 Theme = "Fruit" |
84 |
84 |
85 -- load checkpoints, problem getting the campaign variable |
85 -- load checkpoints, problem getting the campaign variable |
86 local health = 100 |
86 local health = 100 |
87 checkPointReached = initCheckpoint("fruit02") |
87 checkPointReached = initCheckpoint("fruit02") |
88 if checkPointReached ~= 1 then |
88 if checkPointReached ~= 1 then |
89 loadHogsPositions() |
89 loadHogsPositions() |
90 health = tonumber(GetCampaignVar("HeroHealth")) |
90 health = tonumber(GetCampaignVar("HeroHealth")) |
91 end |
91 end |
92 |
92 |
93 -- Hog Solo and Green Bananas |
93 -- Hog Solo and Green Bananas |
94 AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy") |
94 AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy") |
95 hero.gear = AddHog(hero.name, 0, health, "war_desertgrenadier1") |
95 hero.gear = AddHog(hero.name, 0, health, "war_desertgrenadier1") |
96 AnimSetGearPosition(hero.gear, hero.x, hero.y) |
96 AnimSetGearPosition(hero.gear, hero.x, hero.y) |
97 HogTurnLeft(hero.gear, true) |
97 HogTurnLeft(hero.gear, true) |
98 green2.gear = AddHog(green2.name, 0, 100, "war_britmedic") |
98 green2.gear = AddHog(green2.name, 0, 100, "war_britmedic") |
99 AnimSetGearPosition(green2.gear, green2.x, green2.y) |
99 AnimSetGearPosition(green2.gear, green2.x, green2.y) |
100 HogTurnLeft(green2.gear, true) |
100 HogTurnLeft(green2.gear, true) |
101 green3.gear = AddHog(green3.name, 0, 100, "hair_red") |
101 green3.gear = AddHog(green3.name, 0, 100, "hair_red") |
102 AnimSetGearPosition(green3.gear, green3.x, green3.y) |
102 AnimSetGearPosition(green3.gear, green3.x, green3.y) |
115 redHedgehogs[i].gear = AddHog(redHedgehogs[i].name, 1, 100, assasinsHats[math.random(1,3)]) |
115 redHedgehogs[i].gear = AddHog(redHedgehogs[i].name, 1, 100, assasinsHats[math.random(1,3)]) |
116 AnimSetGearPosition(redHedgehogs[i].gear, 2010 + 50*i, 630) |
116 AnimSetGearPosition(redHedgehogs[i].gear, 2010 + 50*i, 630) |
117 end |
117 end |
118 |
118 |
119 AnimInit() |
119 AnimInit() |
120 AnimationSetup() |
120 AnimationSetup() |
121 end |
121 end |
122 |
122 |
123 function onGameStart() |
123 function onGameStart() |
124 AnimWait(hero.gear, 3000) |
124 AnimWait(hero.gear, 3000) |
125 FollowGear(hero.gear) |
125 FollowGear(hero.gear) |
126 |
126 |
127 if GetCampaignVar("Fruit01JoinedBattle") and GetCampaignVar("Fruit01JoinedBattle") == "true" then |
127 if GetCampaignVar("Fruit01JoinedBattle") and GetCampaignVar("Fruit01JoinedBattle") == "true" then |
128 tookPartInBattle = true |
128 tookPartInBattle = true |
129 end |
129 end |
130 |
130 |
131 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
131 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
132 AddEvent(onDeviceCrates, {hero.gear}, deviceCrates, {hero.gear}, 0) |
132 AddEvent(onDeviceCrates, {hero.gear}, deviceCrates, {hero.gear}, 0) |
133 |
133 |
134 -- Hog Solo and GB weapons |
134 -- Hog Solo and GB weapons |
135 AddAmmo(hero.gear, amSwitch, 100) |
135 AddAmmo(hero.gear, amSwitch, 100) |
136 -- Captain Lime weapons |
136 -- Captain Lime weapons |
137 AddAmmo(green1.bot, amBazooka, 6) |
137 AddAmmo(green1.bot, amBazooka, 6) |
138 AddAmmo(green1.bot, amGrenade, 6) |
138 AddAmmo(green1.bot, amGrenade, 6) |
164 AddGear(x2, y2, gtExplosives, 0, 0, 0, 0) |
164 AddGear(x2, y2, gtExplosives, 0, 0, 0, 0) |
165 end |
165 end |
166 x2 = x2 - 25 |
166 x2 = x2 - 25 |
167 end |
167 end |
168 AddGear(3128, 1680, gtExplosives, 0, 0, 0, 0) |
168 AddGear(3128, 1680, gtExplosives, 0, 0, 0, 0) |
169 |
169 |
170 --mines |
170 --mines |
171 AddGear(3135, 1680, gtMine, 0, 0, 0, 0) |
171 AddGear(3135, 1680, gtMine, 0, 0, 0, 0) |
172 AddGear(3145, 1680, gtMine, 0, 0, 0, 0) |
172 AddGear(3145, 1680, gtMine, 0, 0, 0, 0) |
173 AddGear(3155, 1680, gtMine, 0, 0, 0, 0) |
173 AddGear(3155, 1680, gtMine, 0, 0, 0, 0) |
174 AddGear(3165, 1680, gtMine, 0, 0, 0, 0) |
174 AddGear(3165, 1680, gtMine, 0, 0, 0, 0) |
175 AddGear(3175, 1680, gtMine, 0, 0, 0, 0) |
175 AddGear(3175, 1680, gtMine, 0, 0, 0, 0) |
176 AddGear(3115, 1680, gtMine, 0, 0, 0, 0) |
176 AddGear(3115, 1680, gtMine, 0, 0, 0, 0) |
177 AddGear(3105, 1680, gtMine, 0, 0, 0, 0) |
177 AddGear(3105, 1680, gtMine, 0, 0, 0, 0) |
178 AddGear(3095, 1680, gtMine, 0, 0, 0, 0) |
178 AddGear(3095, 1680, gtMine, 0, 0, 0, 0) |
179 AddGear(3085, 1680, gtMine, 0, 0, 0, 0) |
179 AddGear(3085, 1680, gtMine, 0, 0, 0, 0) |
180 AddGear(3075, 1680, gtMine, 0, 0, 0, 0) |
180 AddGear(3075, 1680, gtMine, 0, 0, 0, 0) |
181 |
181 |
182 if checkPointReached == 1 then |
182 if checkPointReached == 1 then |
183 AddAmmo(hero.gear, amFirePunch, 3) |
183 AddAmmo(hero.gear, amFirePunch, 3) |
184 AddEvent(onCheckPoint1, {hero.gear}, checkPoint1, {hero.gear}, 0) |
184 AddEvent(onCheckPoint1, {hero.gear}, checkPoint1, {hero.gear}, 0) |
185 AddEvent(onCheckPoint2, {hero.gear}, checkPoint2, {hero.gear}, 0) |
185 AddEvent(onCheckPoint2, {hero.gear}, checkPoint2, {hero.gear}, 0) |
197 elseif checkPointReached == 3 then |
197 elseif checkPointReached == 3 then |
198 AddEvent(onCheckPoint1, {hero.gear}, checkPoint1, {hero.gear}, 0) |
198 AddEvent(onCheckPoint1, {hero.gear}, checkPoint1, {hero.gear}, 0) |
199 AddEvent(onCheckPoint3, {hero.gear}, checkPoint3, {hero.gear}, 0) |
199 AddEvent(onCheckPoint3, {hero.gear}, checkPoint3, {hero.gear}, 0) |
200 AddEvent(onCheckPoint4, {hero.gear}, checkPoint4, {hero.gear}, 0) |
200 AddEvent(onCheckPoint4, {hero.gear}, checkPoint4, {hero.gear}, 0) |
201 elseif checkPointReached == 4 then |
201 elseif checkPointReached == 4 then |
202 AddEvent(onCheckPoint4, {hero.gear}, checkPoint4, {hero.gear}, 0) |
202 AddEvent(onCheckPoint4, {hero.gear}, checkPoint4, {hero.gear}, 0) |
203 elseif checkPointReached == 5 then |
203 elseif checkPointReached == 5 then |
204 -- EMPTY |
204 -- EMPTY |
205 end |
205 end |
206 if checkPointReached ~= 1 then |
206 if checkPointReached ~= 1 then |
207 loadWeapons() |
207 loadWeapons() |
208 end |
208 end |
209 |
209 |
210 -- girders |
210 -- girders |
211 if checkPointReached > 1 then |
211 if checkPointReached > 1 then |
212 PlaceGirder(1580, 875, 4) |
212 PlaceGirder(1580, 875, 4) |
213 PlaceGirder(1800, 875, 4) |
213 PlaceGirder(1800, 875, 4) |
214 end |
214 end |
215 |
215 |
216 -- place crates |
216 -- place crates |
217 if checkPointReached < 2 then |
217 if checkPointReached < 2 then |
218 SpawnAmmoCrate(girderCrate.x, girderCrate.y, girderCrate.name) |
218 SpawnAmmoCrate(girderCrate.x, girderCrate.y, girderCrate.name) |
219 end |
219 end |
220 if checkPointReached < 5 then |
220 if checkPointReached < 5 then |
373 return false |
373 return false |
374 end |
374 end |
375 |
375 |
376 function onCheckPoint3(gear) |
376 function onCheckPoint3(gear) |
377 -- after barrel jump |
377 -- after barrel jump |
378 if ((GetHealth(green2.gear) and GetY(green2.gear) > 1550 and GetX(green2.gear) < 3000 and StoppedGear(green2.gear)) |
378 if ((GetHealth(green2.gear) and GetY(green2.gear) > 1550 and GetX(green2.gear) < 3000 and StoppedGear(green2.gear)) |
379 or (GetHealth(green3.gear) and GetY(green3.gear) > 1550 and GetX(green3.gear) < 3000 and StoppedGear(green2.gear))) |
379 or (GetHealth(green3.gear) and GetY(green3.gear) > 1550 and GetX(green3.gear) < 3000 and StoppedGear(green2.gear))) |
380 and not isHeroAtWrongPlace() then |
380 and not isHeroAtWrongPlace() then |
381 return true |
381 return true |
382 end |
382 end |
383 return false |
383 return false |
384 end |
384 end |
385 |
385 |
386 function onCheckPoint4(gear) |
386 function onCheckPoint4(gear) |
387 -- hero at crates |
387 -- hero at crates |
388 if not hero.dead and GetX(hero.gear) > 1288 and GetX(hero.gear) < 1420 |
388 if not hero.dead and GetX(hero.gear) > 1288 and GetX(hero.gear) < 1420 |
389 and GetY(hero.gear) > 1840 and not isHeroAtWrongPlace() then |
389 and GetY(hero.gear) > 1840 and not isHeroAtWrongPlace() then |
390 return true |
390 return true |
391 end |
391 end |
392 return false |
392 return false |
393 end |
393 end |
394 |
394 |
395 -------------- ACTIONS ------------------ |
395 -------------- ACTIONS ------------------ |
396 |
396 |
397 function heroDeath(gear) |
397 function heroDeath(gear) |
398 SendStat(siGameResult, loc("Hog Solo lost, try again!")) |
398 SendStat(siGameResult, loc("Hog Solo lost, try again!")) |
399 SendStat(siCustomAchievement, loc("To win the game Hog Solo has to get the bottom crates and come back to the surface")) |
399 SendStat(siCustomAchievement, loc("To win the game, Hog Solo has to get the bottom crates and come back to the surface")) |
400 SendStat(siCustomAchievement, loc("You can use the other 2 hogs to assist you")) |
400 SendStat(siCustomAchievement, loc("You can use the other 2 hogs to assist you")) |
401 SendStat(siCustomAchievement, loc("Do not destroy the crates")) |
401 SendStat(siCustomAchievement, loc("Do not destroy the crates")) |
402 if tookPartInBattle then |
402 if tookPartInBattle then |
403 SendStat(siCustomAchievement, loc("You'll have to eliminate the Strawberry Assasins at the end")) |
403 SendStat(siCustomAchievement, loc("You'll have to eliminate the Strawberry Assassins at the end")) |
404 else |
404 else |
405 SendStat(siCustomAchievement, loc("You'll have to eliminate Captain Lime at the end")) |
405 SendStat(siCustomAchievement, loc("You'll have to eliminate Captain Lime at the end")) |
406 SendStat(siCustomAchievement, loc("Don't eliminate Captain Lime before collecting the last crate!")) |
406 SendStat(siCustomAchievement, loc("Don't eliminate Captain Lime before collecting the last crate!")) |
407 end |
407 end |
408 SendStat(siPlayerKills,'0',teamA.name) |
408 SendStat(siPlayerKills,'0',teamA.name) |
409 EndGame() |
409 EndGame() |
410 end |
410 end |
411 |
411 |
496 |
496 |
497 function AnimationSetup() |
497 function AnimationSetup() |
498 -- DIALOG 01 - Start, Captain Lime helps Hog Solo because he took part in the battle |
498 -- DIALOG 01 - Start, Captain Lime helps Hog Solo because he took part in the battle |
499 AddSkipFunction(dialog01, Skipanim, {dialog01}) |
499 AddSkipFunction(dialog01, Skipanim, {dialog01}) |
500 table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}}) |
500 table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}}) |
501 table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere else in the planet of fruits Captain Lime helps Hog Solo..."), 5000}}) |
501 table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere else on the planet of fruits Captain Lime helps Hog Solo..."), 5000}}) |
502 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("You fought bravely and you helped us win this battle!"), SAY_SAY, 5000}}) |
502 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("You fought bravely and you helped us win this battle!"), SAY_SAY, 5000}}) |
503 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("So, as promised I have brought you where I think that the device you are looking for is hidden."), SAY_SAY, 7000}}) |
503 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("So, as promised I have brought you where I think that the device you are looking for is hidden."), SAY_SAY, 7000}}) |
504 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("I know that your resources are low due to the battle but I'll send with you two of my best hogs to assist you."), SAY_SAY, 7000}}) |
504 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("I know that your resources are low due to the battle but I'll send two of my best hogs to assist you."), SAY_SAY, 7000}}) |
505 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("Good luck!"), SAY_SAY, 2000}}) |
505 table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("Good luck!"), SAY_SAY, 2000}}) |
506 table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}}) |
506 table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}}) |
507 table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}}) |
507 table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}}) |
508 -- DIALOG02 - Start, Hog Solo escaped from the previous battle |
508 -- DIALOG02 - Start, Hog Solo escaped from the previous battle |
509 AddSkipFunction(dialog02, Skipanim, {dialog02}) |
509 AddSkipFunction(dialog02, Skipanim, {dialog02}) |
510 table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3000}}) |
510 table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3000}}) |
511 table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Somewhere else in the planet of fruits Hog Solo gets closer to the device..."), 5000}}) |
511 table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Somewhere else on the planet of fruits Hog Solo gets closer to the device..."), 5000}}) |
512 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You are the one who fled! So, you are alive..."), SAY_SAY, 4000}}) |
512 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You are the one who fled! So, you are alive..."), SAY_SAY, 4000}}) |
513 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I'm still low on hogs. If you are not afraid I could use a set of extra hands"), SAY_SAY, 4000}}) |
513 table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I'm still low on hogs. If you are not afraid I could use a set of extra hands"), SAY_SAY, 4000}}) |
514 table.insert(dialog02, {func = AnimWait, args = {hero.gear, 8000}}) |
514 table.insert(dialog02, {func = AnimWait, args = {hero.gear, 8000}}) |
515 table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I am sorry but I was looking for a device that may be hidden somewhere around here"), SAY_SAY, 4500}}) |
515 table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I am sorry but I was looking for a device that may be hidden somewhere around here"), SAY_SAY, 4500}}) |
516 table.insert(dialog02, {func = AnimWait, args = {green1.gear, 12500}}) |
516 table.insert(dialog02, {func = AnimWait, args = {green1.gear, 12500}}) |
522 table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}}) |
522 table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}}) |
523 -- DIALOG03 - At crates, hero learns that Captain Lime is bad |
523 -- DIALOG03 - At crates, hero learns that Captain Lime is bad |
524 AddSkipFunction(dialog03, Skipanim, {dialog03}) |
524 AddSkipFunction(dialog03, Skipanim, {dialog03}) |
525 table.insert(dialog03, {func = AnimWait, args = {hero.gear, 4000}}) |
525 table.insert(dialog03, {func = AnimWait, args = {hero.gear, 4000}}) |
526 table.insert(dialog03, {func = FollowGear, args = {hero.gear}}) |
526 table.insert(dialog03, {func = FollowGear, args = {hero.gear}}) |
527 table.insert(dialog03, {func = AnimSay, args = {hero.gear, loc("Hoo Ray! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}}) |
527 table.insert(dialog03, {func = AnimSay, args = {hero.gear, loc("Hoorah! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}}) |
528 table.insert(dialog03, {func = AnimWait, args = {green1.gear, 4000}}) |
528 table.insert(dialog03, {func = AnimWait, args = {green1.gear, 4000}}) |
529 table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("This Hog Solo is so naive! I am gonna shoot him when he returns and keep his device for me!"), SAY_THINK, 4000}}) |
529 table.insert(dialog03, {func = AnimSay, args = {green1.gear, loc("This Hog Solo is so naive! When he returns I'll shoot him and keep that device for myself!"), SAY_THINK, 4000}}) |
530 table.insert(dialog03, {func = goToThesurface, args = {hero.gear}}) |
530 table.insert(dialog03, {func = goToThesurface, args = {hero.gear}}) |
531 -- DIALOG04 - At crates, hero learns about the assasins ambush |
531 -- DIALOG04 - At crates, hero learns about the assasins ambush |
532 AddSkipFunction(dialog04, Skipanim, {dialog04}) |
532 AddSkipFunction(dialog04, Skipanim, {dialog04}) |
533 table.insert(dialog04, {func = AnimWait, args = {hero.gear, 4000}}) |
533 table.insert(dialog04, {func = AnimWait, args = {hero.gear, 4000}}) |
534 table.insert(dialog04, {func = FollowGear, args = {hero.gear}}) |
534 table.insert(dialog04, {func = FollowGear, args = {hero.gear}}) |
535 table.insert(dialog04, {func = AnimSay, args = {hero.gear, loc("Hoo Ray! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}}) |
535 table.insert(dialog04, {func = AnimSay, args = {hero.gear, loc("Hoorah! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}}) |
536 table.insert(dialog04, {func = AnimWait, args = {redHedgehogs[1].gear, 4000}}) |
536 table.insert(dialog04, {func = AnimWait, args = {redHedgehogs[1].gear, 4000}}) |
537 table.insert(dialog04, {func = AnimSay, args = {redHedgehogs[1].gear, loc("We have spotted the enemy! We'll attack when the enemies start gathering!"), SAY_THINK, 4000}}) |
537 table.insert(dialog04, {func = AnimSay, args = {redHedgehogs[1].gear, loc("We have spotted the enemy! We'll attack when the enemies start gathering!"), SAY_THINK, 4000}}) |
538 table.insert(dialog04, {func = goToThesurface, args = {hero.gear}}) |
538 table.insert(dialog04, {func = goToThesurface, args = {hero.gear}}) |
539 end |
539 end |
540 |
540 |