author | Periklis Ntanasis <pntanasis@gmail.com> |
Sat, 17 Aug 2013 01:51:20 +0300 | |
branch | spacecampaign |
changeset 9538 | 51596e01c5df |
parent 9536 | 7456b28a3421 |
child 9540 | 92329918463f |
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 firstRoundAfterBattle = false |
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
16 |
local previousHog = -1 |
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 |
} |
29 |
-- crates types=[0:ammo,1:utility,2:health] |
|
30 |
local crates = { |
|
31 |
{type = 0, name = amDEagle, x = 1680, y = 1650}, |
|
32 |
{type = 0, name = amGirder, x = 1680, y = 1160}, |
|
33 |
{type = 0, name = amRope, x = 1400, y = 1870}, |
|
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 |
local teamD = {} |
|
46 |
-- hedgehogs values |
|
47 |
hero.name = "Hog Solo" |
|
48 |
hero.x = 1200 |
|
49 |
hero.y = 820 |
|
50 |
hero.dead = false |
|
51 |
green1.name = "Captain Lime" |
|
52 |
green1.x = 1050 |
|
53 |
green1.y = 820 |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
54 |
green1.dead = false |
9527 | 55 |
green2.name = "Mister Pear" |
56 |
green2.x = 1350 |
|
57 |
green2.y = 820 |
|
58 |
green3.name = "Lady Mango" |
|
59 |
green3.x = 1450 |
|
60 |
green3.y = 820 |
|
61 |
local redHedgehogs = { |
|
62 |
{ name = "Poisonous Apple" }, |
|
63 |
{ name = "Dark Strawberry" }, |
|
64 |
{ name = "Watermelon Heart" }, |
|
65 |
{ name = "Deadly Grape" } |
|
66 |
} |
|
67 |
teamA.name = loc("Hog Solo and GB") |
|
68 |
teamA.color = tonumber("38D61C",16) -- green |
|
69 |
teamB.name = loc("Captain Lime") |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
70 |
teamB.color = tonumber("38D61D",16) -- greenish |
9527 | 71 |
teamC.name = loc("Fruit Assasins") |
72 |
teamC.color = tonumber("FF0000",16) -- red |
|
73 |
||
74 |
function onGameInit() |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
75 |
GameFlags = gfDisableWind |
9527 | 76 |
Seed = 1 |
77 |
TurnTime = 20000 |
|
78 |
CaseFreq = 0 |
|
79 |
MinesNum = 0 |
|
80 |
MinesTime = 1 |
|
81 |
Explosives = 0 |
|
82 |
Delay = 3 |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
83 |
SuddenDeathTurns = 200 |
9527 | 84 |
Map = "fruit02_map" |
85 |
Theme = "Fruit" |
|
86 |
||
87 |
-- Hog Solo and Green Bananas |
|
88 |
AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy") |
|
89 |
hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1") |
|
90 |
AnimSetGearPosition(hero.gear, hero.x, hero.y) |
|
91 |
HogTurnLeft(hero.gear, true) |
|
92 |
green2.gear = AddHog(green2.name, 0, 100, "war_desertgrenadier1") |
|
93 |
AnimSetGearPosition(green2.gear, green2.x, green2.y) |
|
94 |
HogTurnLeft(green2.gear, true) |
|
95 |
green3.gear = AddHog(green3.name, 0, 100, "war_desertgrenadier1") |
|
96 |
AnimSetGearPosition(green3.gear, green3.x, green3.y) |
|
97 |
HogTurnLeft(green3.gear, true) |
|
98 |
-- Captain Lime |
|
99 |
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
|
100 |
green1.human = AddHog(green1.name, 0, 100, "war_desertgrenadier1") |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
101 |
AnimSetGearPosition(green1.human, green1.x, green1.y) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
102 |
green1.bot = AddHog(green1.name, 1, 100, "war_desertgrenadier1") |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
103 |
AnimSetGearPosition(green1.bot, green1.x, green1.y) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
104 |
green1.gear = green1.human |
9527 | 105 |
-- Fruit Assasins |
106 |
AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy") |
|
107 |
for i=1,table.getn(redHedgehogs) do |
|
108 |
redHedgehogs[i].gear = AddHog(redHedgehogs[i].name, 0, 100, "war_desertgrenadier1") |
|
109 |
AnimSetGearPosition(redHedgehogs[i].gear, 2010 + 50*i, 630) |
|
110 |
end |
|
111 |
||
112 |
AnimInit() |
|
9529 | 113 |
AnimationSetup() |
9527 | 114 |
end |
115 |
||
116 |
function onGameStart() |
|
117 |
AnimWait(hero.gear, 3000) |
|
118 |
FollowGear(hero.gear) |
|
119 |
||
9529 | 120 |
if GetCampaignVar(Fruit01JoinedBattle) and GetCampaignVar(Fruit01JoinedBattle) == "true" then |
121 |
tookPartInBattle = true |
|
122 |
end |
|
123 |
||
9527 | 124 |
AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
125 |
AddEvent(onDeviceCrates, {hero.gear}, deviceCrates, {hero.gear}, 0) |
9527 | 126 |
|
127 |
-- Hog Solo and GB weapons |
|
128 |
AddAmmo(hero.gear, amFirePunch, 3) |
|
129 |
AddAmmo(hero.gear, amSwitch, 100) |
|
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
130 |
AddAmmo(hero.gear, amTeleport, 100) |
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
131 |
-- Captain Lime weapons |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
132 |
AddAmmo(green1.bot, amBazooka, 6) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
133 |
AddAmmo(green1.bot, amGrenade, 6) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
134 |
AddAmmo(green1.bot, amDEagle, 2) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
135 |
HideHog(green1.bot) |
9527 | 136 |
-- Assasins weapons |
137 |
AddAmmo(redHedgehogs[1].gear, amBazooka, 6) |
|
138 |
AddAmmo(redHedgehogs[1].gear, amGrenade, 6) |
|
139 |
for i=1,table.getn(redHedgehogs) do |
|
140 |
HideHog(redHedgehogs[i].gear) |
|
141 |
end |
|
142 |
||
143 |
-- place crates |
|
144 |
for i=1,table.getn(crates) do |
|
145 |
SpawnAmmoCrate(crates[i].x, crates[i].y, crates[i].name) |
|
146 |
end |
|
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
147 |
if tookPartInBattle then |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
148 |
SpawnAmmoCrate(weaponCrate.x, weaponCrate.y, amWatermelon) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
149 |
else |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
150 |
SpawnAmmoCrate(weaponCrate.x, weaponCrate.y, amSniperRifle) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
151 |
end |
9527 | 152 |
|
153 |
-- explosives |
|
154 |
-- I wanted to use FindPlace but doesn't accept height values... |
|
155 |
local x1 = 950 |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
156 |
local x2 = 1306 |
9527 | 157 |
local y1 = 1210 |
158 |
local y2 = 1620 |
|
159 |
while true do |
|
160 |
if y2<y1 then |
|
161 |
break |
|
162 |
end |
|
163 |
if x2<x1 then |
|
164 |
x2 = 1305 |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
165 |
y2 = y2 - 50 |
9527 | 166 |
end |
167 |
if not TestRectForObstacle(x2+25, y2+25, x2-25, y2-25, true) then |
|
168 |
AddGear(x2, y2, gtExplosives, 0, 0, 0, 0) |
|
169 |
end |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
170 |
x2 = x2 - 25 |
9527 | 171 |
end |
172 |
AddGear(3128, 1680, gtExplosives, 0, 0, 0, 0) |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
173 |
|
9527 | 174 |
--mines |
175 |
AddGear(3135, 1680, gtMine, 0, 0, 0, 0) |
|
176 |
AddGear(3145, 1680, gtMine, 0, 0, 0, 0) |
|
177 |
AddGear(3155, 1680, gtMine, 0, 0, 0, 0) |
|
178 |
AddGear(3165, 1680, gtMine, 0, 0, 0, 0) |
|
179 |
AddGear(3175, 1680, gtMine, 0, 0, 0, 0) |
|
180 |
AddGear(3115, 1680, gtMine, 0, 0, 0, 0) |
|
181 |
AddGear(3105, 1680, gtMine, 0, 0, 0, 0) |
|
182 |
AddGear(3095, 1680, gtMine, 0, 0, 0, 0) |
|
183 |
AddGear(3085, 1680, gtMine, 0, 0, 0, 0) |
|
184 |
AddGear(3075, 1680, gtMine, 0, 0, 0, 0) |
|
185 |
||
9529 | 186 |
if tookPartInBattle then |
187 |
AddAnim(dialog01) |
|
188 |
else |
|
189 |
AddAnim(dialog02) |
|
190 |
end |
|
191 |
||
9527 | 192 |
SendHealthStatsOff() |
193 |
end |
|
194 |
||
195 |
function onNewTurn() |
|
9536
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
196 |
WriteLnToConsole("TURNS "..TotalRounds.." and hog: "..CurrentHedgehog.." PREVIOUS: "..previousHog) |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
197 |
if not inBattle and CurrentHedgehog == green1.gear then |
9536
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
198 |
WriteLnToConsole("1") |
9527 | 199 |
TurnTimeLeft = 0 |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
200 |
elseif CurrentHedgehog == green2.gear or CurrentHedgehog == green3.gear then |
9536
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
201 |
WriteLnToConsole("2") |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
202 |
TurnTimeLeft = 0 |
9536
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
203 |
elseif inBattle then |
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
204 |
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
|
205 |
WriteLnToConsole("IIIIIIIIFFFFFFFFFF") |
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
206 |
TurnTimeLeft = 0 |
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
207 |
return |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
208 |
end |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
209 |
WriteLnToConsole("IN BATTLE") |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
210 |
TurnTimeLeft = 20000 |
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
211 |
wind() |
9527 | 212 |
elseif not inBattle then |
9536
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
213 |
WriteLnToConsole("4") |
9527 | 214 |
TurnTimeLeft = -1 |
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
215 |
wind() |
9536
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
216 |
else |
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
217 |
WriteLnToConsole("6") |
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
218 |
TurnTimeLeft = 0 |
9527 | 219 |
end |
9536
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
220 |
previousHog = CurrentHedgehog |
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
221 |
WriteLnToConsole("5") |
9527 | 222 |
end |
223 |
||
224 |
function onGameTick() |
|
225 |
AnimUnWait() |
|
226 |
if ShowAnimation() == false then |
|
227 |
return |
|
228 |
end |
|
229 |
ExecuteAfterAnimations() |
|
230 |
CheckEvents() |
|
231 |
end |
|
232 |
||
233 |
function onGearDelete(gear) |
|
234 |
if gear == hero.gear then |
|
235 |
hero.dead = true |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
236 |
elseif gear == green1.bot then |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
237 |
green1.dead = true |
9527 | 238 |
end |
239 |
end |
|
240 |
||
241 |
function onAmmoStoreInit() |
|
242 |
SetAmmo(amDEagle, 0, 0, 0, 6) |
|
243 |
SetAmmo(amGirder, 0, 0, 0, 3) |
|
244 |
SetAmmo(amRope, 0, 0, 0, 1) |
|
245 |
SetAmmo(amWatermelon, 0, 0, 0, 1) |
|
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
246 |
SetAmmo(amSniperRifle, 0, 0, 0, 1) |
9527 | 247 |
end |
248 |
||
249 |
function onPrecise() |
|
250 |
if GameTime > 3000 then |
|
251 |
SetAnimSkip(true) |
|
252 |
end |
|
253 |
end |
|
254 |
||
255 |
-------------- EVENTS ------------------ |
|
256 |
||
257 |
function onHeroDeath(gear) |
|
258 |
if hero.dead then |
|
259 |
return true |
|
260 |
end |
|
261 |
return false |
|
262 |
end |
|
263 |
||
9532 | 264 |
function onDeviceCrates(gear) |
265 |
if not hero.dead and GetY(hero.gear)>1850 and GetX(hero.gear)>1340 then |
|
266 |
return true |
|
267 |
end |
|
268 |
return false |
|
269 |
end |
|
270 |
||
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
271 |
function onSurface(gear) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
272 |
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
|
273 |
return true |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
274 |
end |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
275 |
return false |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
276 |
end |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
277 |
|
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
278 |
function onGaptainLimeDeath(gear) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
279 |
if green1.dead then |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
280 |
return true |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
281 |
end |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
282 |
return false |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
283 |
end |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
284 |
|
9527 | 285 |
-------------- ACTIONS ------------------ |
286 |
||
287 |
function heroDeath(gear) |
|
288 |
EndGame() |
|
289 |
end |
|
290 |
||
9532 | 291 |
function deviceCrates(gear) |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
292 |
TurnTimeLeft = 0 |
9532 | 293 |
if not tookPartInBattle then |
294 |
AddAnim(dialog03) |
|
295 |
else |
|
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
296 |
for i=1,table.getn(redHedgehogs) do |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
297 |
RestoreHog(redHedgehogs[i].gear) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
298 |
end |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
299 |
AddAnim(dialog04) |
9532 | 300 |
end |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
301 |
AddAmmo(hero.gear, amSwitch, 0) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
302 |
AddEvent(onSurface, {hero.gear}, surface, {hero.gear}, 0) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
303 |
end |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
304 |
|
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
305 |
function surface(gear) |
9536
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
306 |
WriteLnToConsole("surface first round") |
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
307 |
previousHog = -1 |
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
308 |
if tookPartInBattle then |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
309 |
|
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
310 |
else |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
311 |
if GetHealth(green2.gear) then |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
312 |
HideHog(green2.gear) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
313 |
end |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
314 |
if GetHealth(green3.gear) then |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
315 |
HideHog(green3.gear) |
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 |
DeleteGear(green1.human) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
318 |
RestoreHog(green1.bot) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
319 |
green1.gear = green1.bot |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
320 |
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
|
321 |
end |
7456b28a3421
this seems to work fine for the escape scenario
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9534
diff
changeset
|
322 |
WriteLnToConsole("surface in battle") |
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
323 |
inBattle = true |
9532 | 324 |
end |
325 |
||
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
326 |
function captainLimeDeath(gear) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
327 |
-- hero win in scenario of escape in 1st part |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
328 |
EndGame() |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
329 |
end |
9527 | 330 |
-------------- ANIMATIONS ------------------ |
331 |
||
332 |
function Skipanim(anim) |
|
333 |
if goals[anim] ~= nil then |
|
334 |
ShowMission(unpack(goals[anim])) |
|
335 |
end |
|
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
336 |
TurnTimeLeft = 0 |
9527 | 337 |
end |
338 |
||
339 |
function AnimationSetup() |
|
9529 | 340 |
-- DIALOG 01 - Start, Captain Lime helps Hog Solo because he took part in the battle |
9527 | 341 |
AddSkipFunction(dialog01, Skipanim, {dialog01}) |
342 |
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}}) |
|
9529 | 343 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere else in the planet of fruits Captain Lime helps Hog Solo..."), 5000}}) |
344 |
table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("You fought bravely and you helped us win this battle!"), SAY_SAY, 5000}}) |
|
345 |
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}}) |
|
346 |
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}}) |
|
347 |
table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("Good luck!"), SAY_SAY, 2000}}) |
|
9527 | 348 |
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}}) |
349 |
table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}}) |
|
9529 | 350 |
-- DIALOG02 - Start, Hog Solo escaped from the previous battle |
351 |
AddSkipFunction(dialog02, Skipanim, {dialog02}) |
|
352 |
table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3000}}) |
|
353 |
table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Somewhere else in the planet of fruits Hog Solo gets closer to the device..."), 5000}}) |
|
354 |
table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You are the one who fled! So, you are alive..."), SAY_SAY, 4000}}) |
|
355 |
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}}) |
|
356 |
table.insert(dialog02, {func = AnimWait, args = {hero.gear, 8000}}) |
|
357 |
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}}) |
|
358 |
table.insert(dialog02, {func = AnimWait, args = {green1.gear, 12500}}) |
|
359 |
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}}) |
|
360 |
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}}) |
|
361 |
table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("What do you say? Are you in?"), SAY_SAY, 3000}}) |
|
362 |
table.insert(dialog02, {func = AnimWait, args = {hero.gear, 1800}}) |
|
363 |
table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("Ok then!"), SAY_SAY, 2000}}) |
|
364 |
table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}}) |
|
9532 | 365 |
-- DIALOG03 - At crates, hero learns that Captain Lime is bad |
366 |
AddSkipFunction(dialog03, Skipanim, {dialog03}) |
|
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
367 |
table.insert(dialog03, {func = AnimWait, args = {hero.gear, 4000}}) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
368 |
table.insert(dialog03, {func = FollowGear, args = {hero.gear}}) |
9532 | 369 |
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}}) |
370 |
table.insert(dialog03, {func = AnimWait, args = {green1.gear, 4000}}) |
|
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
371 |
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
|
372 |
table.insert(dialog03, {func = goToThesurface, args = {hero.gear}}) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
373 |
-- DIALOG04 - At crates, hero learns about the assasins ambush |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
374 |
AddSkipFunction(dialog04, Skipanim, {dialog04}) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
375 |
table.insert(dialog04, {func = AnimWait, args = {hero.gear, 4000}}) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
376 |
table.insert(dialog04, {func = FollowGear, args = {hero.gear}}) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
377 |
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
|
378 |
table.insert(dialog04, {func = AnimWait, args = {redHedgehogs[1].gear, 4000}}) |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
379 |
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
|
380 |
table.insert(dialog04, {func = goToThesurface, args = {hero.gear}}) |
9527 | 381 |
end |
382 |
||
383 |
------------- OTHER FUNCTIONS --------------- |
|
384 |
||
9534
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
385 |
function goToThesurface() |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
386 |
TurnTimeLeft = 0 |
662edfec06be
many dialogs and events
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9532
diff
changeset
|
387 |
end |
9538
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
388 |
|
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
389 |
function wind() |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
390 |
if GetY(CurrentHedgehog) > 1350 then |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
391 |
WriteLnToConsole("INTO WIND -40") |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
392 |
SetWind(-40) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
393 |
else |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
394 |
SetWind(math.random(-100,100)) |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
395 |
end |
51596e01c5df
scenario of escape seems ok
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9536
diff
changeset
|
396 |
end |