author | Periklis Ntanasis <pntanasis@gmail.com> |
Tue, 27 Aug 2013 01:25:46 +0300 | |
branch | spacecampaign |
changeset 9582 | bf314b2258b3 |
parent 9578 | 16139270448f |
child 9587 | d6ddcafb1c56 |
permissions | -rw-r--r-- |
9527 | 1 |
------------------- ABOUT ---------------------- |
2 |
-- |
|
3 |
-- In this adventure hero gets the lost part with |
|
4 |
-- the help of the green bananas hogs. |
|
5 |
||
6 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
|
7 |
HedgewarsScriptLoad("/Scripts/Animate.lua") |
|
9578
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9574
diff
changeset
|
8 |
HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua") |
9527 | 9 |
|
10 |
----------------- VARIABLES -------------------- |
|
11 |
-- globals |
|
9574
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9554
diff
changeset
|
12 |
local missionName = loc("Getting to the device") |
9527 | 13 |
local inBattle = false |
9529 | 14 |
local tookPartInBattle = false |
9536
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
15 |
local previousHog = -1 |
9548 | 16 |
local checkPointReached = 1 -- 1 is normal spawn |
9527 | 17 |
-- dialogs |
18 |
local dialog01 = {} |
|
19 |
local dialog02 = {} |
|
20 |
local dialog03 = {} |
|
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
21 |
local dialog04 = {} |
9527 | 22 |
-- mission objectives |
23 |
local goals = { |
|
9574
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9554
diff
changeset
|
24 |
[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}, |
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9554
diff
changeset
|
25 |
[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}, |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
26 |
[dialog03] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack Captain Lime before he attacks back"), 1, 4000}, |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
27 |
[dialog04] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack the assasins before they attack back"), 1, 4000}, |
9527 | 28 |
} |
9542 | 29 |
-- crates |
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
30 |
local eagleCrate = {name = amDEagle, x = 1680, y = 1650} |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
31 |
local girderCrate = {name = amGirder, x = 1680, y = 1160} |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
32 |
local ropeCrate = {name = amRope, x = 1400, y = 1870} |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
33 |
local weaponCrate = { x = 1360, y = 1870} |
9527 | 34 |
-- hogs |
35 |
local hero = {} |
|
36 |
local green1 = {} |
|
37 |
local green2 = {} |
|
38 |
local green3 = {} |
|
39 |
-- teams |
|
40 |
local teamA = {} |
|
41 |
local teamB = {} |
|
42 |
local teamC = {} |
|
43 |
-- hedgehogs values |
|
9574
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9554
diff
changeset
|
44 |
hero.name = loc("Hog Solo") |
9527 | 45 |
hero.x = 1200 |
46 |
hero.y = 820 |
|
47 |
hero.dead = false |
|
9574
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9554
diff
changeset
|
48 |
green1.name = loc("Captain Lime") |
9527 | 49 |
green1.x = 1050 |
50 |
green1.y = 820 |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
51 |
green1.dead = false |
9574
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9554
diff
changeset
|
52 |
green2.name = loc("Mister Pear") |
9527 | 53 |
green2.x = 1350 |
54 |
green2.y = 820 |
|
9574
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9554
diff
changeset
|
55 |
green3.name = loc("Lady Mango") |
9527 | 56 |
green3.x = 1450 |
57 |
green3.y = 820 |
|
58 |
local redHedgehogs = { |
|
9574
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9554
diff
changeset
|
59 |
{ name = loc("Poisonous Apple") }, |
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9554
diff
changeset
|
60 |
{ name = loc("Dark Strawberry") }, |
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9554
diff
changeset
|
61 |
{ name = loc("Watermelon Heart") }, |
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9554
diff
changeset
|
62 |
{ name = loc("Deadly Grape") } |
9527 | 63 |
} |
64 |
teamA.name = loc("Hog Solo and GB") |
|
65 |
teamA.color = tonumber("38D61C",16) -- green |
|
66 |
teamB.name = loc("Captain Lime") |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
67 |
teamB.color = tonumber("38D61D",16) -- greenish |
9527 | 68 |
teamC.name = loc("Fruit Assasins") |
69 |
teamC.color = tonumber("FF0000",16) -- red |
|
70 |
||
71 |
function onGameInit() |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
72 |
GameFlags = gfDisableWind |
9527 | 73 |
Seed = 1 |
74 |
TurnTime = 20000 |
|
75 |
CaseFreq = 0 |
|
76 |
MinesNum = 0 |
|
77 |
MinesTime = 1 |
|
78 |
Explosives = 0 |
|
79 |
Delay = 3 |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
80 |
SuddenDeathTurns = 200 |
9527 | 81 |
Map = "fruit02_map" |
82 |
Theme = "Fruit" |
|
83 |
||
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
84 |
-- load checkpoints, problem getting the campaign variable |
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
85 |
local health = 100 |
9582
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
86 |
checkPointReached = initCheckpoint("fruit02") |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
87 |
if checkPointReached ~= 1 then |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
88 |
loadHogsPositions() |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
89 |
health = tonumber(GetCampaignVar("HeroHealth")) |
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
90 |
end |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
91 |
|
9527 | 92 |
-- Hog Solo and Green Bananas |
93 |
AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy") |
|
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
94 |
hero.gear = AddHog(hero.name, 0, health, "war_desertgrenadier1") |
9527 | 95 |
AnimSetGearPosition(hero.gear, hero.x, hero.y) |
96 |
HogTurnLeft(hero.gear, true) |
|
97 |
green2.gear = AddHog(green2.name, 0, 100, "war_desertgrenadier1") |
|
98 |
AnimSetGearPosition(green2.gear, green2.x, green2.y) |
|
99 |
HogTurnLeft(green2.gear, true) |
|
100 |
green3.gear = AddHog(green3.name, 0, 100, "war_desertgrenadier1") |
|
101 |
AnimSetGearPosition(green3.gear, green3.x, green3.y) |
|
102 |
HogTurnLeft(green3.gear, true) |
|
103 |
-- Captain Lime |
|
104 |
AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy") |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
105 |
green1.human = AddHog(green1.name, 0, 100, "war_desertgrenadier1") |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
106 |
AnimSetGearPosition(green1.human, green1.x, green1.y) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
107 |
green1.bot = AddHog(green1.name, 1, 100, "war_desertgrenadier1") |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
108 |
AnimSetGearPosition(green1.bot, green1.x, green1.y) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
109 |
green1.gear = green1.human |
9527 | 110 |
-- Fruit Assasins |
111 |
AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy") |
|
112 |
for i=1,table.getn(redHedgehogs) do |
|
9540
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
113 |
redHedgehogs[i].gear = AddHog(redHedgehogs[i].name, 1, 100, "war_desertgrenadier1") |
9527 | 114 |
AnimSetGearPosition(redHedgehogs[i].gear, 2010 + 50*i, 630) |
115 |
end |
|
116 |
||
117 |
AnimInit() |
|
9529 | 118 |
AnimationSetup() |
9527 | 119 |
end |
120 |
||
121 |
function onGameStart() |
|
122 |
AnimWait(hero.gear, 3000) |
|
123 |
FollowGear(hero.gear) |
|
9542 | 124 |
|
9540
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
125 |
if GetCampaignVar("Fruit01JoinedBattle") and GetCampaignVar("Fruit01JoinedBattle") == "true" then |
9529 | 126 |
tookPartInBattle = true |
127 |
end |
|
128 |
||
9527 | 129 |
AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
130 |
AddEvent(onDeviceCrates, {hero.gear}, deviceCrates, {hero.gear}, 0) |
9527 | 131 |
|
132 |
-- Hog Solo and GB weapons |
|
133 |
AddAmmo(hero.gear, amSwitch, 100) |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
134 |
-- Captain Lime weapons |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
135 |
AddAmmo(green1.bot, amBazooka, 6) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
136 |
AddAmmo(green1.bot, amGrenade, 6) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
137 |
AddAmmo(green1.bot, amDEagle, 2) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
138 |
HideHog(green1.bot) |
9527 | 139 |
-- Assasins weapons |
140 |
AddAmmo(redHedgehogs[1].gear, amBazooka, 6) |
|
141 |
AddAmmo(redHedgehogs[1].gear, amGrenade, 6) |
|
9540
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
142 |
AddAmmo(redHedgehogs[1].bot, amDEagle, 6) |
9527 | 143 |
for i=1,table.getn(redHedgehogs) do |
144 |
HideHog(redHedgehogs[i].gear) |
|
145 |
end |
|
146 |
||
147 |
-- explosives |
|
148 |
-- I wanted to use FindPlace but doesn't accept height values... |
|
149 |
local x1 = 950 |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
150 |
local x2 = 1306 |
9527 | 151 |
local y1 = 1210 |
152 |
local y2 = 1620 |
|
153 |
while true do |
|
154 |
if y2<y1 then |
|
155 |
break |
|
156 |
end |
|
157 |
if x2<x1 then |
|
158 |
x2 = 1305 |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
159 |
y2 = y2 - 50 |
9527 | 160 |
end |
161 |
if not TestRectForObstacle(x2+25, y2+25, x2-25, y2-25, true) then |
|
162 |
AddGear(x2, y2, gtExplosives, 0, 0, 0, 0) |
|
163 |
end |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
164 |
x2 = x2 - 25 |
9527 | 165 |
end |
166 |
AddGear(3128, 1680, gtExplosives, 0, 0, 0, 0) |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
167 |
|
9527 | 168 |
--mines |
169 |
AddGear(3135, 1680, gtMine, 0, 0, 0, 0) |
|
170 |
AddGear(3145, 1680, gtMine, 0, 0, 0, 0) |
|
171 |
AddGear(3155, 1680, gtMine, 0, 0, 0, 0) |
|
172 |
AddGear(3165, 1680, gtMine, 0, 0, 0, 0) |
|
173 |
AddGear(3175, 1680, gtMine, 0, 0, 0, 0) |
|
174 |
AddGear(3115, 1680, gtMine, 0, 0, 0, 0) |
|
175 |
AddGear(3105, 1680, gtMine, 0, 0, 0, 0) |
|
176 |
AddGear(3095, 1680, gtMine, 0, 0, 0, 0) |
|
177 |
AddGear(3085, 1680, gtMine, 0, 0, 0, 0) |
|
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
178 |
AddGear(3075, 1680, gtMine, 0, 0, 0, 0) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
179 |
|
9548 | 180 |
if checkPointReached == 1 then |
181 |
AddAmmo(hero.gear, amFirePunch, 3) |
|
182 |
AddEvent(onCheckPoint1, {hero.gear}, checkPoint1, {hero.gear}, 0) |
|
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
183 |
AddEvent(onCheckPoint2, {hero.gear}, checkPoint2, {hero.gear}, 0) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
184 |
AddEvent(onCheckPoint3, {hero.gear}, checkPoint3, {hero.gear}, 0) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
185 |
AddEvent(onCheckPoint4, {hero.gear}, checkPoint4, {hero.gear}, 0) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
186 |
if tookPartInBattle then |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
187 |
AddAnim(dialog01) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
188 |
else |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
189 |
AddAnim(dialog02) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
190 |
end |
9548 | 191 |
elseif checkPointReached == 2 then |
192 |
AddEvent(onCheckPoint2, {hero.gear}, checkPoint2, {hero.gear}, 0) |
|
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
193 |
AddEvent(onCheckPoint3, {hero.gear}, checkPoint3, {hero.gear}, 0) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
194 |
AddEvent(onCheckPoint4, {hero.gear}, checkPoint4, {hero.gear}, 0) |
9548 | 195 |
elseif checkPointReached == 3 then |
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
196 |
AddEvent(onCheckPoint1, {hero.gear}, checkPoint1, {hero.gear}, 0) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
197 |
AddEvent(onCheckPoint3, {hero.gear}, checkPoint3, {hero.gear}, 0) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
198 |
AddEvent(onCheckPoint4, {hero.gear}, checkPoint4, {hero.gear}, 0) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
199 |
elseif checkPointReached == 4 then |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
200 |
AddEvent(onCheckPoint4, {hero.gear}, checkPoint4, {hero.gear}, 0) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
201 |
elseif checkPointReached == 5 then |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
202 |
-- EMPTY |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
203 |
end |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
204 |
if checkPointReached ~= 1 then |
9548 | 205 |
loadWeapons() |
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
206 |
end |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
207 |
|
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
208 |
-- girders |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
209 |
if checkPointReached > 1 then |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
210 |
PlaceGirder(1580, 875, 4) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
211 |
PlaceGirder(1800, 875, 4) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
212 |
end |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
213 |
|
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
214 |
-- place crates |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
215 |
if checkPointReached < 2 then |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
216 |
SpawnAmmoCrate(girderCrate.x, girderCrate.y, girderCrate.name) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
217 |
end |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
218 |
if checkPointReached < 5 then |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
219 |
SpawnAmmoCrate(eagleCrate.x, eagleCrate.y, eagleCrate.name) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
220 |
end |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
221 |
SpawnAmmoCrate(ropeCrate.x, ropeCrate.y, ropeCrate.name) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
222 |
|
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
223 |
if tookPartInBattle then |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
224 |
SpawnAmmoCrate(weaponCrate.x, weaponCrate.y, amWatermelon) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
225 |
else |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
226 |
SpawnAmmoCrate(weaponCrate.x, weaponCrate.y, amSniperRifle) |
9548 | 227 |
end |
9529 | 228 |
|
9527 | 229 |
SendHealthStatsOff() |
230 |
end |
|
231 |
||
232 |
function onNewTurn() |
|
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
233 |
if not inBattle and CurrentHedgehog == green1.gear then |
9527 | 234 |
TurnTimeLeft = 0 |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
235 |
elseif CurrentHedgehog == green2.gear or CurrentHedgehog == green3.gear then |
9544
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
236 |
TurnTimeLeft = 0 |
9536
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
237 |
elseif inBattle then |
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
238 |
if CurrentHedgehog == green1.gear and previousHog ~= hero.gear then |
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
239 |
TurnTimeLeft = 0 |
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
240 |
return |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
241 |
end |
9540
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
242 |
for i=1,table.getn(redHedgehogs) do |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
243 |
if CurrentHedgehog == redHedgehogs[i].gear and previousHog ~= hero.gear then |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
244 |
TurnTimeLeft = 0 |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
245 |
return |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
246 |
end |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
247 |
end |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
248 |
TurnTimeLeft = 20000 |
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
249 |
wind() |
9540
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
250 |
elseif not inBattle and CurrentHedgehog == hero.gear then |
9527 | 251 |
TurnTimeLeft = -1 |
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
252 |
wind() |
9536
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
253 |
else |
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
254 |
TurnTimeLeft = 0 |
9527 | 255 |
end |
9536
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
256 |
previousHog = CurrentHedgehog |
9527 | 257 |
end |
258 |
||
259 |
function onGameTick() |
|
260 |
AnimUnWait() |
|
261 |
if ShowAnimation() == false then |
|
262 |
return |
|
263 |
end |
|
264 |
ExecuteAfterAnimations() |
|
265 |
CheckEvents() |
|
266 |
end |
|
267 |
||
268 |
function onGearDelete(gear) |
|
269 |
if gear == hero.gear then |
|
270 |
hero.dead = true |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
271 |
elseif gear == green1.bot then |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
272 |
green1.dead = true |
9527 | 273 |
end |
274 |
end |
|
275 |
||
276 |
function onAmmoStoreInit() |
|
277 |
SetAmmo(amDEagle, 0, 0, 0, 6) |
|
278 |
SetAmmo(amGirder, 0, 0, 0, 3) |
|
279 |
SetAmmo(amRope, 0, 0, 0, 1) |
|
280 |
SetAmmo(amWatermelon, 0, 0, 0, 1) |
|
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
281 |
SetAmmo(amSniperRifle, 0, 0, 0, 1) |
9527 | 282 |
end |
283 |
||
284 |
function onPrecise() |
|
285 |
if GameTime > 3000 then |
|
286 |
SetAnimSkip(true) |
|
287 |
end |
|
288 |
end |
|
289 |
||
290 |
-------------- EVENTS ------------------ |
|
291 |
||
292 |
function onHeroDeath(gear) |
|
293 |
if hero.dead then |
|
294 |
return true |
|
295 |
end |
|
296 |
return false |
|
297 |
end |
|
298 |
||
9532 | 299 |
function onDeviceCrates(gear) |
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
300 |
if not hero.dead and GetY(hero.gear)>1850 and GetX(hero.gear)>1340 and GetX(hero.gear)<1640 then |
9532 | 301 |
return true |
302 |
end |
|
303 |
return false |
|
304 |
end |
|
305 |
||
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
306 |
function onSurface(gear) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
307 |
if not hero.dead and GetY(hero.gear)<850 and StoppedGear(hero.gear) then |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
308 |
return true |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
309 |
end |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
310 |
return false |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
311 |
end |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
312 |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
313 |
function onGaptainLimeDeath(gear) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
314 |
if green1.dead then |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
315 |
return true |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
316 |
end |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
317 |
return false |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
318 |
end |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
319 |
|
9540
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
320 |
function onRedTeamDeath(gear) |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
321 |
local redDead = true |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
322 |
for i=1,table.getn(redHedgehogs) do |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
323 |
if GetHealth(redHedgehogs[i].gear) then |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
324 |
redDead = false |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
325 |
break |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
326 |
end |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
327 |
end |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
328 |
return redDead |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
329 |
end |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
330 |
|
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
331 |
function onCheckPoint1(gear) |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
332 |
-- before barrel jump |
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
333 |
if not hero.dead and GetX(hero.gear) > 2850 and GetX(hero.gear) < 2945 |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
334 |
and GetY(hero.gear) > 808 and GetY(hero.gear) < 852 and not isHeroAtWrongPlace() then |
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
335 |
return true |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
336 |
end |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
337 |
return false |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
338 |
end |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
339 |
|
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
340 |
function onCheckPoint2(gear) |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
341 |
-- before barrel jump |
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
342 |
if ((GetHealth(green2.gear) and GetX(green2.gear) > 2850 and GetX(green2.gear) < 2945 and GetY(green2.gear) > 808 and GetY(green2.gear) < 852) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
343 |
or (GetHealth(green3.gear) and GetX(green3.gear) > 2850 and GetX(green3.gear) < 2945 and GetY(green3.gear) > 808 and GetY(green3.gear) < 852)) |
9548 | 344 |
and not isHeroAtWrongPlace() then |
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
345 |
return true |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
346 |
end |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
347 |
return false |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
348 |
end |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
349 |
|
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
350 |
function onCheckPoint3(gear) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
351 |
-- after barrel jump |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
352 |
if ((GetHealth(green2.gear) and GetY(green2.gear) > 1550 and GetX(green2.gear) < 3000 and StoppedGear(green2.gear)) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
353 |
or (GetHealth(green3.gear) and GetY(green3.gear) > 1550 and GetX(green3.gear) < 3000 and StoppedGear(green2.gear))) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
354 |
and not isHeroAtWrongPlace() then |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
355 |
return true |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
356 |
end |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
357 |
return false |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
358 |
end |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
359 |
|
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
360 |
function onCheckPoint4(gear) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
361 |
-- hero at crates |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
362 |
if not hero.dead and GetX(hero.gear) > 1288 and GetX(hero.gear) < 1420 |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
363 |
and GetY(hero.gear) > 1840 and not isHeroAtWrongPlace() then |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
364 |
return true |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
365 |
end |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
366 |
return false |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
367 |
end |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
368 |
|
9527 | 369 |
-------------- ACTIONS ------------------ |
370 |
||
371 |
function heroDeath(gear) |
|
9542 | 372 |
SendStat('siGameResult', loc("Hog Solo lost, try again!")) --1 |
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
373 |
SendStat('siCustomAchievement', loc("To win the game Hog Solo has to get the bottom crates and come back to the surface")) --11 |
9542 | 374 |
SendStat('siCustomAchievement', loc("You can use the other 2 hogs to assist you")) --11 |
375 |
if tookPartInBattle then |
|
376 |
SendStat('siCustomAchievement', loc("You'll have to eliminate the Strawberry Assasins at the end")) --11 |
|
377 |
else |
|
378 |
SendStat('siCustomAchievement', loc("You'll have to eliminate Captain Lime at the end")) --11 |
|
379 |
end |
|
380 |
SendStat('siPlayerKills','0',teamA.name) |
|
9527 | 381 |
EndGame() |
382 |
end |
|
383 |
||
9532 | 384 |
function deviceCrates(gear) |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
385 |
TurnTimeLeft = 0 |
9532 | 386 |
if not tookPartInBattle then |
387 |
AddAnim(dialog03) |
|
388 |
else |
|
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
389 |
for i=1,table.getn(redHedgehogs) do |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
390 |
RestoreHog(redHedgehogs[i].gear) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
391 |
end |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
392 |
AddAnim(dialog04) |
9532 | 393 |
end |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
394 |
AddAmmo(hero.gear, amSwitch, 0) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
395 |
AddEvent(onSurface, {hero.gear}, surface, {hero.gear}, 0) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
396 |
end |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
397 |
|
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
398 |
function surface(gear) |
9536
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
399 |
previousHog = -1 |
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
400 |
if tookPartInBattle then |
9540
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
401 |
if GetHealth(green1.gear) then |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
402 |
HideHog(green1.gear) |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
403 |
end |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
404 |
AddEvent(onRedTeamDeath, {green1.gear}, redTeamDeath, {green1.gear}, 0) |
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
405 |
else |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
406 |
DeleteGear(green1.human) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
407 |
RestoreHog(green1.bot) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
408 |
green1.gear = green1.bot |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
409 |
AddEvent(onGaptainLimeDeath, {green1.gear}, captainLimeDeath, {green1.gear}, 0) |
9536
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
410 |
end |
9540
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
411 |
if GetHealth(green2.gear) then |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
412 |
HideHog(green2.gear) |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
413 |
end |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
414 |
if GetHealth(green3.gear) then |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
415 |
HideHog(green3.gear) |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
416 |
end |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
417 |
inBattle = true |
9532 | 418 |
end |
419 |
||
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
420 |
function captainLimeDeath(gear) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
421 |
-- hero win in scenario of escape in 1st part |
9578
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9574
diff
changeset
|
422 |
saveCompletedStatus(3) |
9542 | 423 |
SendStat('siGameResult', loc("Congratulations, you won!")) --1 |
424 |
SendStat('siCustomAchievement', loc("You retrieved the lost part")) --11 |
|
425 |
SendStat('siCustomAchievement', loc("You defended yourself against Captain Lime")) --11 |
|
426 |
SendStat('siPlayerKills','1',teamA.name) |
|
427 |
SendStat('siPlayerKills','0',teamB.name) |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
428 |
EndGame() |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
429 |
end |
9540
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
430 |
|
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
431 |
function redTeamDeath(gear) |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
432 |
-- hero win in battle scenario |
9578
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9574
diff
changeset
|
433 |
saveCompletedStatus(3) |
9542 | 434 |
SendStat('siGameResult', loc("Congratulations, you won!")) --1 |
435 |
SendStat('siCustomAchievement', loc("You retrieved the lost part")) --11 |
|
436 |
SendStat('siCustomAchievement', loc("You defended yourself against Strawberry Assasins")) --11 |
|
437 |
SendStat('siPlayerKills','1',teamA.name) |
|
438 |
SendStat('siPlayerKills','0',teamC.name) |
|
9540
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
439 |
EndGame() |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
440 |
end |
92329918463f
game against red team seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9538
diff
changeset
|
441 |
|
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
442 |
function checkPoint1(gear) |
9582
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
443 |
saveCheckPointLocal(2) |
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
444 |
end |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
445 |
|
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
446 |
function checkPoint2(gear) |
9582
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
447 |
saveCheckPointLocal(3) |
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
448 |
end |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
449 |
|
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
450 |
function checkPoint3(gear) |
9582
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
451 |
saveCheckPointLocal(4) |
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
452 |
end |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
453 |
|
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
454 |
function checkPoint4(gear) |
9582
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
455 |
saveCheckPointLocal(5) |
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
456 |
end |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
457 |
|
9527 | 458 |
-------------- ANIMATIONS ------------------ |
459 |
||
460 |
function Skipanim(anim) |
|
461 |
if goals[anim] ~= nil then |
|
462 |
ShowMission(unpack(goals[anim])) |
|
463 |
end |
|
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
464 |
TurnTimeLeft = 0 |
9527 | 465 |
end |
466 |
||
467 |
function AnimationSetup() |
|
9529 | 468 |
-- DIALOG 01 - Start, Captain Lime helps Hog Solo because he took part in the battle |
9527 | 469 |
AddSkipFunction(dialog01, Skipanim, {dialog01}) |
470 |
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}}) |
|
9529 | 471 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere else in the planet of fruits Captain Lime helps Hog Solo..."), 5000}}) |
472 |
table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("You fought bravely and you helped us win this battle!"), SAY_SAY, 5000}}) |
|
9574
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9554
diff
changeset
|
473 |
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}}) |
9529 | 474 |
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}}) |
475 |
table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("Good luck!"), SAY_SAY, 2000}}) |
|
9527 | 476 |
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}}) |
477 |
table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}}) |
|
9529 | 478 |
-- DIALOG02 - Start, Hog Solo escaped from the previous battle |
479 |
AddSkipFunction(dialog02, Skipanim, {dialog02}) |
|
480 |
table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3000}}) |
|
481 |
table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Somewhere else in the planet of fruits Hog Solo gets closer to the device..."), 5000}}) |
|
482 |
table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You are the one who fled! So, you are alive..."), SAY_SAY, 4000}}) |
|
483 |
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}}) |
|
484 |
table.insert(dialog02, {func = AnimWait, args = {hero.gear, 8000}}) |
|
485 |
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}}) |
|
486 |
table.insert(dialog02, {func = AnimWait, args = {green1.gear, 12500}}) |
|
9574
da3d39667881
strings checked, all ok except ice02 that will be probably changed
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9554
diff
changeset
|
487 |
table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Many long forgotten things can be found in the same tunnels that we are about to explore!"), SAY_SAY, 7000}}) |
9529 | 488 |
table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("If you help us you can keep the device if you find it but we'll keep everything else"), SAY_SAY, 7000}}) |
489 |
table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("What do you say? Are you in?"), SAY_SAY, 3000}}) |
|
490 |
table.insert(dialog02, {func = AnimWait, args = {hero.gear, 1800}}) |
|
491 |
table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("Ok then!"), SAY_SAY, 2000}}) |
|
492 |
table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}}) |
|
9532 | 493 |
-- DIALOG03 - At crates, hero learns that Captain Lime is bad |
494 |
AddSkipFunction(dialog03, Skipanim, {dialog03}) |
|
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
495 |
table.insert(dialog03, {func = AnimWait, args = {hero.gear, 4000}}) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
496 |
table.insert(dialog03, {func = FollowGear, args = {hero.gear}}) |
9532 | 497 |
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}}) |
498 |
table.insert(dialog03, {func = AnimWait, args = {green1.gear, 4000}}) |
|
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
499 |
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}}) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
500 |
table.insert(dialog03, {func = goToThesurface, args = {hero.gear}}) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
501 |
-- DIALOG04 - At crates, hero learns about the assasins ambush |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
502 |
AddSkipFunction(dialog04, Skipanim, {dialog04}) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
503 |
table.insert(dialog04, {func = AnimWait, args = {hero.gear, 4000}}) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
504 |
table.insert(dialog04, {func = FollowGear, args = {hero.gear}}) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
505 |
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}}) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
506 |
table.insert(dialog04, {func = AnimWait, args = {redHedgehogs[1].gear, 4000}}) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
507 |
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}}) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
508 |
table.insert(dialog04, {func = goToThesurface, args = {hero.gear}}) |
9527 | 509 |
end |
510 |
||
511 |
------------- OTHER FUNCTIONS --------------- |
|
512 |
||
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
513 |
function goToThesurface() |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
514 |
TurnTimeLeft = 0 |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
515 |
end |
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
516 |
|
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
517 |
function wind() |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
518 |
if GetY(CurrentHedgehog) > 1350 then |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
519 |
SetWind(-40) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
520 |
else |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
521 |
SetWind(math.random(-100,100)) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
522 |
end |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
523 |
end |
9544
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
524 |
|
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
525 |
function saveHogsPositions() |
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
526 |
local positions; |
9544
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
527 |
positions = GetX(hero.gear)..","..GetY(hero.gear) |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
528 |
if GetHealth(green2.gear) then |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
529 |
positions = positions..","..GetX(green2.gear)..","..GetY(green2.gear) |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
530 |
end |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
531 |
if GetHealth(green3.gear) then |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
532 |
positions = positions..","..GetX(green3.gear)..","..GetY(green3.gear) |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
533 |
end |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
534 |
SaveCampaignVar("HogsPosition", positions) |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
535 |
end |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
536 |
|
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
537 |
function loadHogsPositions() |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
538 |
local positions; |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
539 |
if GetCampaignVar("HogsPosition") then |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
540 |
positions = GetCampaignVar("HogsPosition") |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
541 |
else |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
542 |
return |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
543 |
end |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
544 |
positions = split(positions,",") |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
545 |
if positions[1] then |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
546 |
hero.x = positions[1] |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
547 |
hero.y = positions[2] |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
548 |
end |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
549 |
if positions[3] then |
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
550 |
green2.x = tonumber(positions[3]) |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
551 |
green2.y = tonumber(positions[4]) |
9544
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
552 |
end |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
553 |
if positions[5] then |
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
554 |
green3.x = tonumber(positions[5]) |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
555 |
green3.y = tonumber(positions[6]) |
9544
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
556 |
end |
e247251fa751
position saving functions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9542
diff
changeset
|
557 |
end |
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
558 |
|
9548 | 559 |
function saveWeapons() |
560 |
-- firepunch - gilder - deagle - watermelon - sniper |
|
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
561 |
SaveCampaignVar("HeroAmmo", GetAmmoCount(hero.gear, amFirePunch)..GetAmmoCount(hero.gear, amGirder).. |
9548 | 562 |
GetAmmoCount(hero.gear, amDEagle)..GetAmmoCount(hero.gear, amWatermelon)..GetAmmoCount(hero.gear, amSniperRifle)) |
563 |
end |
|
564 |
||
565 |
function loadWeapons() |
|
566 |
local ammo = GetCampaignVar("HeroAmmo") |
|
9550
59061246a25c
fixed weapon type typo
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9548
diff
changeset
|
567 |
AddAmmo(hero.gear, amFirePunch, tonumber(ammo:sub(1,1))) |
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
568 |
AddAmmo(hero.gear, amGirder, tonumber(ammo:sub(2,2))) |
9548 | 569 |
AddAmmo(hero.gear, amDEagle, tonumber(ammo:sub(3,3))) |
570 |
AddAmmo(hero.gear, amWatermelon, tonumber(ammo:sub(4,4))) |
|
571 |
AddAmmo(hero.gear, amSniperRifle, tonumber(ammo:sub(5,5))) |
|
572 |
end |
|
573 |
||
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
574 |
function isHeroAtWrongPlace() |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
575 |
if GetX(hero.gear) > 1480 and GetX(hero.gear) < 1892 and GetY(hero.gear) > 1000 and GetY(hero.gear) < 1220 then |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
576 |
return true |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
577 |
end |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
578 |
return false |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
579 |
end |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
580 |
|
9548 | 581 |
-- splits number by delimiter |
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
582 |
function split(s, delimiter) |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
583 |
local res = {} |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
584 |
local first = "" |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
585 |
for i=1,s:len() do |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
586 |
if s:sub(1,1) == delimiter then |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
587 |
table.insert(res, tonumber(first)) |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
588 |
first = "" |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
589 |
else |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
590 |
first = first..s:sub(1,1) |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
591 |
end |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
592 |
s = s:sub(2) |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
593 |
end |
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
594 |
if first:len() > 0 then |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
595 |
table.insert(res, tonumber(first)) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
596 |
end |
9546
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
597 |
return res |
f7530a7e5612
added custom lua split
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9544
diff
changeset
|
598 |
end |
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
599 |
|
9582
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
600 |
function saveCheckPointLocal(cpoint) |
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
601 |
AnimCaption(hero.gear, loc("Checkpoint reached!"), 3000) |
9582
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
602 |
saveCheckpoint(cpoint) |
9552
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
603 |
SaveCampaignVar("HeroHealth", GetHealth(hero.gear)) |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
604 |
saveHogsPositions() |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
605 |
saveWeapons() |
90d69a2c1729
checkpoint system seems complete
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9550
diff
changeset
|
606 |
end |