19 -- globals |
19 -- globals |
20 local campaignName = loc("A Space Adventure") |
20 local campaignName = loc("A Space Adventure") |
21 local missionName = loc("Desert planet, lost in sand!") |
21 local missionName = loc("Desert planet, lost in sand!") |
22 local heroIsInBattle = false |
22 local heroIsInBattle = false |
23 local ongoingBattle = 0 |
23 local ongoingBattle = 0 |
|
24 local cratesFound = 0 |
24 local checkPointReached = 1 -- 1 is normal spawn |
25 local checkPointReached = 1 -- 1 is normal spawn |
25 -- dialogs |
26 -- dialogs |
26 local dialog01 = {} |
27 local dialog01 = {} |
27 -- mission objectives |
28 -- mission objectives |
28 local goals = { |
29 local goals = { |
29 [dialog01] = {missionName, loc("Getting ready"), loc("The part is hidden in one of the crates! Go and get it!"), 1, 4500}, |
30 [dialog01] = {missionName, loc("Getting ready"), loc("The part is hidden in one of the crates! Go and get it!"), 1, 4500}, |
30 } |
31 } |
31 -- crates |
32 -- crates |
32 local btorch1Y = 60 |
33 local btorch1Y = 60 |
33 local btorch1X = 2700 |
34 local btorch1X = 2700 |
34 local btorch2Y = 1800 |
35 local btorch2Y = 1900 |
35 local btorch2X = 1010 |
36 local btorch2X = 2150 |
36 local btorch3Y = 980 |
37 local btorch3Y = 980 |
37 local btorch3X = 3260 |
38 local btorch3X = 3260 |
38 local rope1Y = 970 |
39 local rope1Y = 970 |
39 local rope1X = 3200 |
40 local rope1X = 3200 |
40 local rope2Y = 1900 |
41 local rope2Y = 1900 |
41 local rope2X = 680 |
42 local rope2X = 680 |
42 local rope3Y = 1850 |
43 local rope3Y = 1850 |
43 local rope3X = 2460 |
44 local rope3X = 2460 |
44 local portalY = 480 |
45 local portalY = 480 |
45 local portalX = 1465 |
46 local portalX = 1465 |
46 local constructY = 1630 |
47 local girderY = 1630 |
47 local constructX = 3350 |
48 local girderX = 3350 |
48 -- hogs |
49 -- hogs |
49 local hero = {} |
50 local hero = {} |
50 local ally = {} |
51 local ally = {} |
51 local smuggler1 = {} |
52 local smuggler1 = {} |
52 local smuggler2 = {} |
53 local smuggler2 = {} |
144 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
145 AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
145 AddEvent(onHeroAtFirstBattle, {hero.gear}, heroAtFirstBattle, {hero.gear}, 1) |
146 AddEvent(onHeroAtFirstBattle, {hero.gear}, heroAtFirstBattle, {hero.gear}, 1) |
146 AddEvent(onHeroFleeFirstBattle, {hero.gear}, heroFleeFirstBattle, {hero.gear}, 1) |
147 AddEvent(onHeroFleeFirstBattle, {hero.gear}, heroFleeFirstBattle, {hero.gear}, 1) |
147 AddEvent(onHeroAtCheckpoint4, {hero.gear}, heroAtCheckpoint4, {hero.gear}, 0) |
148 AddEvent(onHeroAtCheckpoint4, {hero.gear}, heroAtCheckpoint4, {hero.gear}, 0) |
148 AddEvent(onHeroAtThirdBattle, {hero.gear}, heroAtThirdBattle, {hero.gear}, 0) |
149 AddEvent(onHeroAtThirdBattle, {hero.gear}, heroAtThirdBattle, {hero.gear}, 0) |
|
150 AddEvent(onCheckForWin1, {hero.gear}, checkForWin1, {hero.gear}, 0) |
|
151 AddEvent(onCheckForWin2, {hero.gear}, checkForWin2, {hero.gear}, 0) |
149 |
152 |
150 -- smugglers ammo |
153 -- smugglers ammo |
151 AddAmmo(smuggler1.gear, amBazooka, 2) |
154 AddAmmo(smuggler1.gear, amBazooka, 2) |
152 AddAmmo(smuggler1.gear, amGrenade, 2) |
155 AddAmmo(smuggler1.gear, amGrenade, 2) |
153 AddAmmo(smuggler1.gear, amDEagle, 2) |
156 AddAmmo(smuggler1.gear, amDEagle, 2) |
|
157 AddAmmo(smuggler3.gear, amRope, 2) |
154 |
158 |
155 -- spawn crates |
159 -- spawn crates |
156 SpawnAmmoCrate(btorch1X, btorch1Y, amBlowTorch) |
160 SpawnAmmoCrate(btorch1X, btorch1Y, amBlowTorch) |
157 SpawnAmmoCrate(btorch2X, btorch2Y, amBlowTorch) |
161 SpawnAmmoCrate(btorch2X, btorch2Y, amBlowTorch) |
158 SpawnAmmoCrate(btorch3X, btorch3Y, amBlowTorch) |
162 SpawnAmmoCrate(btorch3X, btorch3Y, amBlowTorch) |
159 SpawnAmmoCrate(rope1X, rope1Y, amRope) |
163 SpawnAmmoCrate(rope1X, rope1Y, amRope) |
160 SpawnAmmoCrate(rope2X, rope2Y, amRope) |
164 SpawnAmmoCrate(rope2X, rope2Y, amRope) |
161 SpawnAmmoCrate(rope3X, rope3Y, amRope) |
165 SpawnAmmoCrate(rope3X, rope3Y, amRope) |
162 SpawnAmmoCrate(portalX, portalY, amPortalGun) |
166 SpawnAmmoCrate(portalX, portalY, amPortalGun) |
163 SpawnAmmoCrate(constructX, constructY, amConstruction) |
167 SpawnAmmoCrate(girderX, girderY, amGirder) |
164 |
168 |
165 SpawnHealthCrate(3300, 970) |
169 SpawnHealthCrate(3300, 970) |
166 SpawnHealthCrate(680, 460) |
170 SpawnHealthCrate(680, 460) |
167 |
171 |
168 -- adding mines - BOOM! |
172 -- adding mines - BOOM! |
181 x = 1890 |
185 x = 1890 |
182 while x < 2988 do |
186 while x < 2988 do |
183 AddGear(x, 760, gtMine, 0, 0, 0, 0) |
187 AddGear(x, 760, gtMine, 0, 0, 0, 0) |
184 x = x + math.random(8,20) |
188 x = x + math.random(8,20) |
185 end |
189 end |
186 x = 2480 |
190 x = 2500 |
187 while x < 3300 do |
191 while x < 3300 do |
188 AddGear(x, 1450, gtMine, 0, 0, 0, 0) |
192 AddGear(x, 1450, gtMine, 0, 0, 0, 0) |
189 x = x + math.random(8,20) |
193 x = x + math.random(8,20) |
190 end |
194 end |
191 x = 1570 |
195 x = 1570 |
192 while x < 2900 do |
196 while x < 2900 do |
193 AddGear(x, 470, gtMine, 0, 0, 0, 0) |
197 AddGear(x, 470, gtMine, 0, 0, 0, 0) |
194 x = x + math.random(8,20) |
198 x = x + math.random(8,20) |
195 end |
199 end |
196 |
200 |
|
201 AddAmmo(hero.gear, amTeleport, 4) |
197 if checkPointReached == 1 then |
202 if checkPointReached == 1 then |
198 AddEvent(onHeroAtCheckpoint2, {hero.gear}, heroAtCheckpoint2, {hero.gear}, 0) |
203 AddEvent(onHeroAtCheckpoint2, {hero.gear}, heroAtCheckpoint2, {hero.gear}, 0) |
199 AddEvent(onHeroAtCheckpoint3, {hero.gear}, heroAtCheckpoint3, {hero.gear}, 0) |
204 AddEvent(onHeroAtCheckpoint3, {hero.gear}, heroAtCheckpoint3, {hero.gear}, 0) |
200 -- hero ammo |
205 -- hero ammo |
201 AddAmmo(hero.gear, amRope, 2) |
206 AddAmmo(hero.gear, amRope, 2) |
249 |
254 |
250 function onAmmoStoreInit() |
255 function onAmmoStoreInit() |
251 SetAmmo(amBlowTorch, 0, 0, 0, 1) |
256 SetAmmo(amBlowTorch, 0, 0, 0, 1) |
252 SetAmmo(amRope, 0, 0, 0, 1) |
257 SetAmmo(amRope, 0, 0, 0, 1) |
253 SetAmmo(amPortalGun, 0, 0, 0, 1) |
258 SetAmmo(amPortalGun, 0, 0, 0, 1) |
254 SetAmmo(amConstruction, 0, 0, 0, 1) |
259 SetAmmo(amGirder, 0, 0, 0, 3) |
255 end |
260 end |
256 |
261 |
257 function onGearDelete(gear) |
262 function onGearDelete(gear) |
258 if gear == hero.gear then |
263 if gear == hero.gear then |
259 hero.dead = true |
264 hero.dead = true |
446 if tonumber(ammo:sub(7,7)) > 0 then |
475 if tonumber(ammo:sub(7,7)) > 0 then |
447 AddAmmo(hero.gear, amConstruction, tonumber(ammo:sub(7,7))) |
476 AddAmmo(hero.gear, amConstruction, tonumber(ammo:sub(7,7))) |
448 end |
477 end |
449 AddAmmo(hero.gear, amPortalGun, tonumber(ammo:sub(8,8))) |
478 AddAmmo(hero.gear, amPortalGun, tonumber(ammo:sub(8,8))) |
450 end |
479 end |
|
480 |
|
481 function checkForWin() |
|
482 if cratesFound == 0 then |
|
483 -- have to look more |
|
484 AnimSay(hero.gear, loc("Haven't found it yet..."), SAY_THINK, 5000) |
|
485 cratesFound = cratesFound + 1 |
|
486 elseif cratesFound == 1 then |
|
487 -- end game |
|
488 AnimSay(hero.gear, loc("Hoo Ray!!!"), SAY_SHOUT, 5000) |
|
489 -- do stats etc |
|
490 EndGame() |
|
491 end |
|
492 end |