25 [dialog02] = {missionName, loc("Getting the Device"), loc("Explore the tunnel with the other hogs and search for the device").."|"..loc("Hog Solo has to reach the last crates"), 1, 4000}, |
25 [dialog02] = {missionName, loc("Getting the Device"), 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 [dialog03] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack Captain Lime before he attacks back"), 1, 4000}, |
26 [dialog03] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack Captain Lime before he attacks back"), 1, 4000}, |
27 [dialog04] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack the assasins before they attack back"), 1, 4000}, |
27 [dialog04] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack the assasins before they attack back"), 1, 4000}, |
28 } |
28 } |
29 -- crates |
29 -- crates |
30 local crates = { |
30 local eagleCrate = {name = amDEagle, x = 1680, y = 1650} |
31 {name = amDEagle, x = 1680, y = 1650}, |
31 local girderCrate = {name = amGirder, x = 1680, y = 1160} |
32 {name = amGirder, x = 1680, y = 1160}, |
32 local ropeCrate = {name = amRope, x = 1400, y = 1870} |
33 {name = amRope, x = 1400, y = 1870}, |
|
34 } |
|
35 local weaponCrate = { x = 1360, y = 1870} |
33 local weaponCrate = { x = 1360, y = 1870} |
36 -- hogs |
34 -- hogs |
37 local hero = {} |
35 local hero = {} |
38 local green1 = {} |
36 local green1 = {} |
39 local green2 = {} |
37 local green2 = {} |
83 Map = "fruit02_map" |
81 Map = "fruit02_map" |
84 Theme = "Fruit" |
82 Theme = "Fruit" |
85 |
83 |
86 WriteLnToConsole("CHECKPOINT IS "..checkPointReached) |
84 WriteLnToConsole("CHECKPOINT IS "..checkPointReached) |
87 -- load checkpoints, problem getting the campaign variable |
85 -- load checkpoints, problem getting the campaign variable |
88 --local h = GetCampaignVar("Desert01CheckPoint") |
86 local health = 100 |
89 --WriteLnToCosnole("HERE "..GetCampaignVar("Fruit02CheckPoint")) |
|
90 if tonumber(GetCampaignVar("Fruit02CheckPoint")) then |
87 if tonumber(GetCampaignVar("Fruit02CheckPoint")) then |
91 WriteLnToConsole("**TRUE**") |
88 WriteLnToConsole("**TRUE**") |
92 checkPointReached = tonumber(GetCampaignVar("Fruit02CheckPoint")) |
89 checkPointReached = tonumber(GetCampaignVar("Fruit02CheckPoint")) |
93 if checkPointReached == 2 or checkPointReached == 3 then |
90 if checkPointReached ~= 1 then |
94 WriteLnToConsole("++++++++++++++HEEEEEEEREEEEEEEEEEEEE") |
91 WriteLnToConsole("++++++++++++++HEEEEEEEREEEEEEEEEEEEE") |
95 loadHogsPositions() |
92 loadHogsPositions() |
|
93 health = tonumber(GetCampaignVar("HeroHealth")) |
96 end |
94 end |
97 end |
95 end |
98 |
96 |
99 WriteLnToConsole("CHECKPOINT IS "..checkPointReached) |
97 WriteLnToConsole("CHECKPOINT IS "..checkPointReached) |
100 -- Hog Solo and Green Bananas |
98 -- Hog Solo and Green Bananas |
101 AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy") |
99 AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy") |
102 hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1") |
100 hero.gear = AddHog(hero.name, 0, health, "war_desertgrenadier1") |
103 AnimSetGearPosition(hero.gear, hero.x, hero.y) |
101 AnimSetGearPosition(hero.gear, hero.x, hero.y) |
104 HogTurnLeft(hero.gear, true) |
102 HogTurnLeft(hero.gear, true) |
105 green2.gear = AddHog(green2.name, 0, 100, "war_desertgrenadier1") |
103 green2.gear = AddHog(green2.name, 0, 100, "war_desertgrenadier1") |
106 AnimSetGearPosition(green2.gear, green2.x, green2.y) |
104 AnimSetGearPosition(green2.gear, green2.x, green2.y) |
107 HogTurnLeft(green2.gear, true) |
105 HogTurnLeft(green2.gear, true) |
192 AddGear(3175, 1680, gtMine, 0, 0, 0, 0) |
180 AddGear(3175, 1680, gtMine, 0, 0, 0, 0) |
193 AddGear(3115, 1680, gtMine, 0, 0, 0, 0) |
181 AddGear(3115, 1680, gtMine, 0, 0, 0, 0) |
194 AddGear(3105, 1680, gtMine, 0, 0, 0, 0) |
182 AddGear(3105, 1680, gtMine, 0, 0, 0, 0) |
195 AddGear(3095, 1680, gtMine, 0, 0, 0, 0) |
183 AddGear(3095, 1680, gtMine, 0, 0, 0, 0) |
196 AddGear(3085, 1680, gtMine, 0, 0, 0, 0) |
184 AddGear(3085, 1680, gtMine, 0, 0, 0, 0) |
197 AddGear(3075, 1680, gtMine, 0, 0, 0, 0) |
185 AddGear(3075, 1680, gtMine, 0, 0, 0, 0) |
198 |
186 |
199 if tookPartInBattle then |
|
200 AddAnim(dialog01) |
|
201 else |
|
202 AddAnim(dialog02) |
|
203 end |
|
204 WriteLnToConsole("CHECKPOINT IS "..checkPointReached) |
187 WriteLnToConsole("CHECKPOINT IS "..checkPointReached) |
205 if checkPointReached == 1 then |
188 if checkPointReached == 1 then |
206 AddAmmo(hero.gear, amFirePunch, 3) |
189 AddAmmo(hero.gear, amFirePunch, 3) |
207 AddEvent(onCheckPoint1, {hero.gear}, checkPoint1, {hero.gear}, 0) |
190 AddEvent(onCheckPoint1, {hero.gear}, checkPoint1, {hero.gear}, 0) |
208 AddEvent(onCheckPoint2, {hero.gear}, checkPoint2, {hero.gear}, 0) |
191 AddEvent(onCheckPoint2, {hero.gear}, checkPoint2, {hero.gear}, 0) |
|
192 AddEvent(onCheckPoint3, {hero.gear}, checkPoint3, {hero.gear}, 0) |
|
193 AddEvent(onCheckPoint4, {hero.gear}, checkPoint4, {hero.gear}, 0) |
|
194 if tookPartInBattle then |
|
195 AddAnim(dialog01) |
|
196 else |
|
197 AddAnim(dialog02) |
|
198 end |
209 elseif checkPointReached == 2 then |
199 elseif checkPointReached == 2 then |
|
200 AddEvent(onCheckPoint2, {hero.gear}, checkPoint2, {hero.gear}, 0) |
|
201 AddEvent(onCheckPoint3, {hero.gear}, checkPoint3, {hero.gear}, 0) |
|
202 AddEvent(onCheckPoint4, {hero.gear}, checkPoint4, {hero.gear}, 0) |
|
203 elseif checkPointReached == 3 then |
|
204 AddEvent(onCheckPoint1, {hero.gear}, checkPoint1, {hero.gear}, 0) |
|
205 AddEvent(onCheckPoint3, {hero.gear}, checkPoint3, {hero.gear}, 0) |
|
206 AddEvent(onCheckPoint4, {hero.gear}, checkPoint4, {hero.gear}, 0) |
|
207 elseif checkPointReached == 4 then |
|
208 AddEvent(onCheckPoint4, {hero.gear}, checkPoint4, {hero.gear}, 0) |
|
209 elseif checkPointReached == 5 then |
|
210 -- EMPTY |
|
211 end |
|
212 if checkPointReached ~= 1 then |
210 loadWeapons() |
213 loadWeapons() |
211 AddEvent(onCheckPoint2, {hero.gear}, checkPoint2, {hero.gear}, 0) |
214 end |
212 elseif checkPointReached == 3 then |
215 |
213 loadWeapons() |
216 -- girders |
214 AddEvent(onCheckPoint1, {hero.gear}, checkPoint1, {hero.gear}, 0) |
217 if checkPointReached > 1 then |
|
218 PlaceGirder(1580, 875, 4) |
|
219 PlaceGirder(1800, 875, 4) |
|
220 end |
|
221 |
|
222 -- place crates |
|
223 if checkPointReached < 2 then |
|
224 SpawnAmmoCrate(girderCrate.x, girderCrate.y, girderCrate.name) |
|
225 end |
|
226 if checkPointReached < 5 then |
|
227 SpawnAmmoCrate(eagleCrate.x, eagleCrate.y, eagleCrate.name) |
|
228 end |
|
229 SpawnAmmoCrate(ropeCrate.x, ropeCrate.y, ropeCrate.name) |
|
230 |
|
231 if tookPartInBattle then |
|
232 SpawnAmmoCrate(weaponCrate.x, weaponCrate.y, amWatermelon) |
|
233 else |
|
234 SpawnAmmoCrate(weaponCrate.x, weaponCrate.y, amSniperRifle) |
215 end |
235 end |
216 |
236 |
217 SendHealthStatsOff() |
237 SendHealthStatsOff() |
218 end |
238 end |
219 |
239 |
316 return redDead |
336 return redDead |
317 end |
337 end |
318 |
338 |
319 function onCheckPoint1(gear) |
339 function onCheckPoint1(gear) |
320 -- before barrel jump |
340 -- before barrel jump |
321 if GetX(hero.gear) > 2850 and GetX(hero.gear) < 2945 and GetY(hero.gear) > 808 and GetY(hero.gear) < 852 |
341 if not hero.dead and GetX(hero.gear) > 2850 and GetX(hero.gear) < 2945 |
322 and not isHeroAtWrongPlace() then |
342 and GetY(hero.gear) > 808 and GetY(hero.gear) < 852 and not isHeroAtWrongPlace() then |
323 return true |
343 return true |
324 end |
344 end |
325 return false |
345 return false |
326 end |
346 end |
327 |
347 |
328 function onCheckPoint2(gear) |
348 function onCheckPoint2(gear) |
329 -- before barrel jump |
349 -- before barrel jump |
330 if ((GetX(green2.gear) > 2850 and GetX(green2.gear) < 2945 and GetY(green2.gear) > 808 and GetY(green2.gear) < 852) |
350 if ((GetHealth(green2.gear) and GetX(green2.gear) > 2850 and GetX(green2.gear) < 2945 and GetY(green2.gear) > 808 and GetY(green2.gear) < 852) |
331 or (GetX(green3.gear) > 2850 and GetX(green3.gear) < 2945 and GetY(green3.gear) > 808 and GetY(green3.gear) < 852)) |
351 or (GetHealth(green3.gear) and GetX(green3.gear) > 2850 and GetX(green3.gear) < 2945 and GetY(green3.gear) > 808 and GetY(green3.gear) < 852)) |
332 and not isHeroAtWrongPlace() then |
352 and not isHeroAtWrongPlace() then |
|
353 return true |
|
354 end |
|
355 return false |
|
356 end |
|
357 |
|
358 function onCheckPoint3(gear) |
|
359 -- after barrel jump |
|
360 if ((GetHealth(green2.gear) and GetY(green2.gear) > 1550 and GetX(green2.gear) < 3000 and StoppedGear(green2.gear)) |
|
361 or (GetHealth(green3.gear) and GetY(green3.gear) > 1550 and GetX(green3.gear) < 3000 and StoppedGear(green2.gear))) |
|
362 and not isHeroAtWrongPlace() then |
|
363 return true |
|
364 end |
|
365 return false |
|
366 end |
|
367 |
|
368 function onCheckPoint4(gear) |
|
369 -- hero at crates |
|
370 if not hero.dead and GetX(hero.gear) > 1288 and GetX(hero.gear) < 1420 |
|
371 and GetY(hero.gear) > 1840 and not isHeroAtWrongPlace() then |
333 return true |
372 return true |
334 end |
373 end |
335 return false |
374 return false |
336 end |
375 end |
337 |
376 |
519 green2.y = tonumber(positions[4]) |
560 green2.y = tonumber(positions[4]) |
520 end |
561 end |
521 if positions[5] then |
562 if positions[5] then |
522 green3.x = tonumber(positions[5]) |
563 green3.x = tonumber(positions[5]) |
523 green3.y = tonumber(positions[6]) |
564 green3.y = tonumber(positions[6]) |
|
565 WriteLnToConsole("---------"..green3.y) |
524 end |
566 end |
525 end |
567 end |
526 |
568 |
527 function saveWeapons() |
569 function saveWeapons() |
528 -- firepunch - gilder - deagle - watermelon - sniper |
570 -- firepunch - gilder - deagle - watermelon - sniper |
529 WriteLnToConsole("SAVE WEAPONS TRIGGERED: "..GetAmmoCount(hero.gear, amFirePunch)..GetAmmoCount(hero.gear, amGilder).. |
571 WriteLnToConsole("SAVE WEAPONS TRIGGERED: "..GetAmmoCount(hero.gear, amFirePunch)..GetAmmoCount(hero.gear, amGilder).. |
530 GetAmmoCount(hero.gear, amDEagle)..GetAmmoCount(hero.gear, amWatermelon)..GetAmmoCount(hero.gear, amSniperRifle)) |
572 GetAmmoCount(hero.gear, amDEagle)..GetAmmoCount(hero.gear, amWatermelon)..GetAmmoCount(hero.gear, amSniperRifle)) |
531 SaveCampaignVar("HeroAmmo", GetAmmoCount(hero.gear, amFirePunch)..GetAmmoCount(hero.gear, amGilder).. |
573 SaveCampaignVar("HeroAmmo", GetAmmoCount(hero.gear, amFirePunch)..GetAmmoCount(hero.gear, amGirder).. |
532 GetAmmoCount(hero.gear, amDEagle)..GetAmmoCount(hero.gear, amWatermelon)..GetAmmoCount(hero.gear, amSniperRifle)) |
574 GetAmmoCount(hero.gear, amDEagle)..GetAmmoCount(hero.gear, amWatermelon)..GetAmmoCount(hero.gear, amSniperRifle)) |
533 end |
575 end |
534 |
576 |
535 function loadWeapons() |
577 function loadWeapons() |
536 local ammo = GetCampaignVar("HeroAmmo") |
578 local ammo = GetCampaignVar("HeroAmmo") |
537 WriteLnToConsole("LOAD WEAPONS "..ammo) |
579 WriteLnToConsole("GILDER "..tonumber(ammo:sub(2,2))) |
538 WriteLnToConsole("LOAD WEAPONS "..ammo:sub(1,1)) |
|
539 AddAmmo(hero.gear, amFirePunch, tonumber(ammo:sub(1,1))) |
580 AddAmmo(hero.gear, amFirePunch, tonumber(ammo:sub(1,1))) |
540 AddAmmo(hero.gear, amGilder, tonumber(ammo:sub(2,2))) |
581 AddAmmo(hero.gear, amGirder, tonumber(ammo:sub(2,2))) |
541 AddAmmo(hero.gear, amDEagle, tonumber(ammo:sub(3,3))) |
582 AddAmmo(hero.gear, amDEagle, tonumber(ammo:sub(3,3))) |
542 AddAmmo(hero.gear, amWatermelon, tonumber(ammo:sub(4,4))) |
583 AddAmmo(hero.gear, amWatermelon, tonumber(ammo:sub(4,4))) |
543 AddAmmo(hero.gear, amSniperRifle, tonumber(ammo:sub(5,5))) |
584 AddAmmo(hero.gear, amSniperRifle, tonumber(ammo:sub(5,5))) |
544 end |
585 end |
545 |
586 |