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