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