author | Periklis Ntanasis <pntanasis@gmail.com> |
Mon, 01 Jul 2013 23:23:22 +0300 | |
branch | spacecampaign |
changeset 9308 | 4bddcc1a1450 |
parent 9306 | c9978ada9a3d |
child 10290 | 42efccba0711 |
permissions | -rw-r--r-- |
8043 | 1 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
2 |
HedgewarsScriptLoad("/Scripts/Animate.lua") |
|
7460 | 3 |
|
4 |
||
5 |
--------------------------------------------Constants------------------------------------ |
|
6 |
choiceAccepted = 1 |
|
7 |
choiceRefused = 2 |
|
8 |
choiceAttacked = 3 |
|
9 |
||
10 |
choiceEliminate = 1 |
|
11 |
choiceSpare = 2 |
|
12 |
||
13 |
leaksNum = 1 |
|
14 |
denseNum = 2 |
|
15 |
waterNum = 3 |
|
16 |
buffaloNum = 4 |
|
17 |
chiefNum = 5 |
|
18 |
girlNum = 6 |
|
19 |
wiseNum = 7 |
|
20 |
ramonNum = 8 |
|
21 |
spikyNum = 9 |
|
22 |
||
23 |
denseScene = 1 |
|
24 |
princessScene = 2 |
|
25 |
waterScene = 3 |
|
26 |
cyborgScene = 4 |
|
27 |
||
28 |
nativeNames = {loc("Leaks A Lot"), loc("Dense Cloud"), loc("Fiery Water"), |
|
29 |
loc("Raging Buffalo"), loc("Righteous Beard"), loc("Fell From Grace"), |
|
30 |
loc("Wise Oak"), loc("Ramon"), loc("Spiky Cheese") |
|
31 |
} |
|
32 |
||
33 |
nativeHats = {"Rambo", "RobinHood", "pirate_jack", "zoo_Bunny", "IndianChief", |
|
34 |
"tiara", "AkuAku", "rasta", "hair_yellow"} |
|
35 |
||
36 |
nativePos = {{1259, 120}, {2378, 796}, {424, 1299}, {3322, 260}, {1022, 1550}} |
|
37 |
nativeDir = {"Right", "Left", "Right", "Left", "Right"} |
|
38 |
||
39 |
cannibalNames = {loc("Honest Lee"), loc("Vegan Jack"), loc("Sirius Lee"), |
|
40 |
loc("Brutal Lily")} |
|
41 |
cannibalPos = {{162, 266}, {2159, 1517}, {3311, 1621}, {1180, 1560}} |
|
42 |
cannibalDir = {"Right", "Left", "Left", "Right"} |
|
43 |
cannibalsNum = 4 |
|
44 |
||
45 |
playersDir = {"Right", "Left", "Right", "Left", "Right", "Right", "Left", "Left", "Right"} |
|
46 |
playersAntiDir = {"Left", "Right", "Left", "Right", "Left", "Left", "Right", "Right", "Left"} |
|
47 |
||
48 |
cyborgNames = {loc("Smith 0.97"), loc("Smith 0.98"), loc("Smith 0.99a"), |
|
49 |
loc("Smith 0.99b"), loc("Smith 0.99f"), loc("Smith 1.0")} |
|
50 |
cyborgPos = {{2162, 20}, {2458, 564}, {542, 1133}, {3334, 1427}} |
|
51 |
cyborgDir = "Right" |
|
52 |
cyborgsNum = 6 |
|
53 |
cyborgsPos = {{1490, 330}, {1737, 1005}, {2972, 922}, {1341, 1571}, |
|
54 |
{751, 543}, {3889, 907}} |
|
55 |
cyborgsDir = {"Right", "Right", "Left", "Right", "Right", "Left"} |
|
56 |
||
57 |
leaderPos = {3474, 151} |
|
58 |
leaderDir = "Left" |
|
59 |
||
60 |
-----------------------------Variables--------------------------------- |
|
61 |
natives = {} |
|
62 |
origNatives = {} |
|
63 |
||
64 |
cyborgs = {} |
|
65 |
cyborg = nil |
|
66 |
||
67 |
cannibals = {} |
|
68 |
players = {} |
|
69 |
leader = nil |
|
70 |
||
71 |
gearDead = {} |
|
72 |
hedgeHidden = {} |
|
73 |
||
74 |
startAnim = {} |
|
75 |
finalAnim = {} |
|
76 |
-----------------------------Animations-------------------------------- |
|
77 |
function CondNeedToTurn(hog1, hog2) |
|
78 |
xl, xd = GetX(hog1), GetX(hog2) |
|
79 |
if xl > xd then |
|
80 |
AnimInsertStepNext({func = AnimTurn, args = {hog1, "Left"}}) |
|
81 |
AnimInsertStepNext({func = AnimTurn, args = {hog2, "Right"}}) |
|
82 |
elseif xl < xd then |
|
83 |
AnimInsertStepNext({func = AnimTurn, args = {hog2, "Left"}}) |
|
84 |
AnimInsertStepNext({func = AnimTurn, args = {hog1, "Right"}}) |
|
85 |
end |
|
86 |
end |
|
87 |
||
88 |
function CondNeedToTurn2(hog1, hog2) |
|
89 |
xl, xd = GetX(hog1), GetX(hog2) |
|
90 |
if xl > xd then |
|
91 |
AnimTurn(hog1, "Left") |
|
92 |
AnimTurn(hog2, "Right") |
|
93 |
elseif xl < xd then |
|
94 |
AnimTurn(hog2, "Left") |
|
95 |
AnimTurn(hog1, "Right") |
|
96 |
end |
|
97 |
end |
|
98 |
||
99 |
function EmitDenseClouds(dir) |
|
100 |
local dif |
|
101 |
if dir == "Left" then |
|
102 |
dif = 10 |
|
103 |
else |
|
104 |
dif = -10 |
|
105 |
end |
|
106 |
if dir == nil then |
|
107 |
dx, dy = GetGearVelocity(dense) |
|
108 |
if dx < 0 then |
|
109 |
dif = 10 |
|
110 |
else |
|
111 |
dif = -10 |
|
112 |
end |
|
113 |
end |
|
114 |
AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false}) |
|
115 |
AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false}) |
|
116 |
AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false}) |
|
117 |
AnimInsertStepNext({func = AnimWait, args = {dense, 800}}) |
|
118 |
AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false}) |
|
119 |
AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false}) |
|
120 |
AnimInsertStepNext({func = AnimWait, args = {dense, 800}}) |
|
121 |
AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false}) |
|
122 |
end |
|
123 |
||
124 |
function RestoreNatives(cgi) |
|
125 |
for i = 1, playersNum do |
|
126 |
RestoreHedge(players[i]) |
|
127 |
AnimOutOfNowhere(players[i], GetGearPosition(players[i])) |
|
128 |
end |
|
129 |
end |
|
130 |
||
131 |
function AnimationSetup() |
|
132 |
SetupCyborgStartAnim() |
|
133 |
SetupPeopleStartAnim() |
|
134 |
SetupEnemyStartAnim() |
|
135 |
AddSkipFunction(startAnim, SkipStartAnim, {}) |
|
136 |
end |
|
137 |
||
138 |
function SetupCyborgStartAnim() |
|
139 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 3000}}) |
|
140 |
table.insert(startAnim, {func = AnimTurn, args = {cyborg, "Left"}}) |
|
141 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 800}}) |
|
142 |
table.insert(startAnim, {func = AnimTurn, args = {cyborg, "Right"}}) |
|
143 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 800}}) |
|
144 |
table.insert(startAnim, {func = AnimTurn, args = {cyborg, "Left"}}) |
|
145 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 800}}) |
|
146 |
table.insert(startAnim, {func = AnimTeleportGear, args = {cyborg, unpack(cyborgPos[2])}}) |
|
147 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 800}}) |
|
148 |
table.insert(startAnim, {func = AnimTurn, args = {cyborg, "Right"}}) |
|
149 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 800}}) |
|
150 |
table.insert(startAnim, {func = AnimTurn, args = {cyborg, "Left"}}) |
|
151 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 800}}) |
|
152 |
table.insert(startAnim, {func = AnimTeleportGear, args = {cyborg, unpack(cyborgPos[3])}}) |
|
153 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 1800}}) |
|
154 |
table.insert(startAnim, {func = AnimTeleportGear, args = {cyborg, unpack(cyborgPos[4])}}) |
|
155 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 800}}) |
|
156 |
table.insert(startAnim, {func = AnimSay, args = {cyborg, loc("Everything looks OK..."), SAY_THINK, 2500}}) |
|
157 |
table.insert(startAnim, {func = AnimSay, args = {cyborg, loc("This will be fun!"), SAY_THINK, 2500}}) |
|
158 |
table.insert(startAnim, {func = AnimJump, args = {cyborg, "high"}}) |
|
159 |
table.insert(startAnim, {func = AnimCustomFunction, args = {cyborg, RestoreNatives, {true}}}) |
|
160 |
table.insert(startAnim, {func = AnimSay, args = {cyborg, loc("HAHA!"), SAY_SHOUT, 2000}}) |
|
161 |
table.insert(startAnim, {func = AnimSwitchHog, args = {players[1]}}) |
|
162 |
table.insert(startAnim, {func = AnimDisappear, swh = false, args = {cyborg, unpack(cyborgPos[4])}}) |
|
163 |
table.insert(startAnim, {func = HideHedge, swh = false, args = {cyborg}}) |
|
164 |
end |
|
165 |
||
166 |
function SetupPeopleStartAnim() |
|
167 |
for i = 1, playersNum do |
|
168 |
table.insert(startAnim, {func = AnimTurn, swh = false, args = {players[i], playersAntiDir[i]}}) |
|
169 |
end |
|
170 |
table.insert(startAnim, {func = AnimWait, args = {players[1], 800}}) |
|
171 |
for i = 1, playersNum do |
|
172 |
table.insert(startAnim, {func = AnimTurn, swh = false, args = {players[i], playersDir[i]}}) |
|
173 |
end |
|
174 |
table.insert(startAnim, {func = AnimWait, args = {players[1], 800}}) |
|
175 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("What is this place?"), SAY_SHOUT, 2500}}) |
|
176 |
if m5LeaksDead == 1 then |
|
177 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("And how am I alive?!"), SAY_SAY, 3000}}) |
|
178 |
end |
|
179 |
table.insert(startAnim, {func = AnimCustomFunction, args = {players[1], CondNeedToTurn, {players[1], players[2]}}}) |
|
180 |
table.insert(startAnim, {func = AnimSay, args = {players[2], loc("It must be the cyborgs again!"), SAY_SAY, 4000}}) |
|
181 |
table.insert(startAnim, {func = AnimSay, args = {players[3], loc("Looks like the whole world is falling apart!"), SAY_SAY, 6000}}) |
|
182 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("Look out! We're surrounded by cannibals!"), SAY_SHOUT, 6000}}) |
|
183 |
table.insert(startAnim, {func = AnimCustomFunction, args = {players[4], CondNeedToTurn, {players[4], cannibals[1]}}}) |
|
184 |
table.insert(startAnim, {func = AnimCustomFunction, args = {players[4], CondNeedToTurn, {players[1], cannibals[1]}}}) |
|
185 |
table.insert(startAnim, {func = AnimSay, args = {players[4], loc("Cannibals?! You're the cannibals!"), SAY_SHOUT, 4000}}) |
|
186 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("WHAT?! You're the ones attacking us!"), SAY_SHOUT, 5000}}) |
|
187 |
table.insert(startAnim, {func = AnimSay, args = {players[4], loc("You have kidnapped our whole tribe!"), SAY_SHOUT, 4000}}) |
|
188 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("You've been assaulting us, we have been just defending ourselves!"), SAY_SHOUT, 8000}}) |
|
189 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("I can't believe this!"), SAY_SHOUT, 3000}}) |
|
190 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("Have we ever attacked you first?"), SAY_SHOUT, 5000}}) |
|
191 |
table.insert(startAnim, {func = AnimSay, args = {players[4], loc("Yes!"), SAY_SHOUT, 2000}}) |
|
192 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("When?"), SAY_SHOUT, 2000}}) |
|
193 |
table.insert(startAnim, {func = AnimSay, args = {players[4], loc("Uhmm...ok no."), SAY_SHOUT, 2000}}) |
|
194 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("But you're cannibals. It's what you do."), SAY_SHOUT, 5000}}) |
|
195 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("Again with the 'cannibals' thing!"), SAY_SHOUT, 4000}}) |
|
196 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("Where do you get that?!"), SAY_SHOUT, 3000}}) |
|
197 |
table.insert(startAnim, {func = AnimSay, args = {players[4], loc("Everyone knows this."), SAY_SHOUT, 2500}}) |
|
198 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("I didn't until about a month ago."), SAY_SHOUT, 4000}}) |
|
199 |
table.insert(startAnim, {func = AnimSay, args = {players[4], loc("Hmmm...actually...I didn't either."), SAY_SHOUT, 4000}}) |
|
200 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("About a month ago, a cyborg came and told us that you're the cannibals!"), SAY_SHOUT, 8000}}) |
|
201 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("A cy-what?"), SAY_SHOUT, 2000}}) |
|
202 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("Cyborg. It's what the aliens call themselves."), SAY_SHOUT, 5000}}) |
|
203 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("They told us to wear these clothes. They said that this is the newest trend."), SAY_SHOUT, 8000}}) |
|
204 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("They've been manipulating us all this time!"), SAY_SHOUT, 5000}}) |
|
205 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("They must be trying to weaken us!"), SAY_SHOUT, 5000}}) |
|
206 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("We have to unite and defeat those cylergs!"), SAY_SHOUT, 5000}}) |
|
207 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("We can't let them take over our little island!"), SAY_SHOUT, 5000}}) |
|
208 |
end |
|
209 |
||
210 |
function RestoreCyborgs(cgi) |
|
211 |
if cyborgsRestored == true then |
|
212 |
return |
|
213 |
end |
|
214 |
for i = 1, cyborgsNum do |
|
215 |
RestoreHedge(cyborgs[i]) |
|
216 |
if cgi == true then |
|
217 |
AnimOutOfNowhere(cyborgs[i], unpack(cyborgsPos[i])) |
|
218 |
end |
|
219 |
end |
|
220 |
RestoreHedge(leader) |
|
221 |
AnimOutOfNowhere(leader, unpack(leaderPos)) |
|
222 |
cyborgsRestored = true |
|
223 |
end |
|
224 |
||
225 |
function SetupEnemyStartAnim() |
|
226 |
local gear |
|
227 |
table.insert(startAnim, {func = AnimCustomFunction, args = {cannibals[1], RestoreCyborgs, {true}}}) |
|
228 |
if m8EnemyFled == 1 then |
|
229 |
gear = leader |
|
230 |
else |
|
231 |
gear = cyborgs[2] |
|
232 |
end |
|
233 |
table.insert(startAnim, {func = AnimCustomFunction, args = {players[1], CondNeedToTurn, {players[4], gear}}}) |
|
234 |
table.insert(startAnim, {func = AnimCustomFunction, args = {players[1], CondNeedToTurn, {players[1], gear}}}) |
|
235 |
table.insert(startAnim, {func = AnimSay, args = {gear, loc("You have finally figured it out!"), SAY_SHOUT, 4500}}) |
|
7527
35d154745d7a
All missions: switched blood needers with meatbags in dialogues
belphegorr <szabibibi@gmail.com>
parents:
7512
diff
changeset
|
236 |
table.insert(startAnim, {func = AnimSay, args = {gear, loc("You meatbags are pretty slow, you know!"), SAY_SHOUT, 5500}}) |
7460 | 237 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("Why do you want to take over our island?"), SAY_SHOUT, 5500}}) |
238 |
table.insert(startAnim, {func = AnimSay, args = {gear, loc("Do you have any idea how valuable grass is?"), SAY_SHOUT, 5500}}) |
|
239 |
table.insert(startAnim, {func = AnimSay, args = {gear, loc("This island is the only place left on Earth with grass on it!"), SAY_SHOUT, 7000}}) |
|
240 |
table.insert(startAnim, {func = AnimSay, args = {gear, loc("It's worth more than wood!"), SAY_SHOUT, 4000}}) |
|
241 |
table.insert(startAnim, {func = AnimSay, args = {gear, loc("That makes it almost invaluable!"), SAY_SHOUT, 4500}}) |
|
242 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("We have nowhere else to live!"), SAY_SHOUT, 4500}}) |
|
243 |
table.insert(startAnim, {func = AnimSay, args = {gear, loc("That's not our problem!"), SAY_SHOUT, 4500}}) |
|
244 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("We'll give you a problem then!"), SAY_SHOUT, 5000}}) |
|
245 |
table.insert(startAnim, {func = AnimSwitchHog, args = {gear}}) |
|
246 |
end |
|
247 |
||
248 |
function SetupFinalAnim() |
|
249 |
finalAnim = { |
|
250 |
{func = AnimGearWait, args = {cyborg, 1000}}, |
|
7530 | 251 |
{func = AnimSay, args = {cyborg, loc("Nicely done, meatbags!"), SAY_SAY, 3000}}, |
7460 | 252 |
{func = AnimSay, args = {cyborg, loc("You have won the game by proving true cooperative skills!"), SAY_SAY, 7000}}, |
253 |
{func = AnimSay, args = {cyborg, loc("You have proven yourselves worthy!"), SAY_SAY, 4000}}, |
|
254 |
{func = AnimSay, args = {players[1], loc("Game? Was this a game to you?!"), SAY_SAY, 4000}}, |
|
255 |
{func = AnimSay, args = {cyborg, loc("Well, yes. This was a cyborg television show."), SAY_SAY, 5500}}, |
|
256 |
{func = AnimSay, args = {cyborg, loc("It is called 'Hogs of Steel'."), SAY_SAY, 4000}}, |
|
257 |
{func = AnimSay, args = {players[1], loc("Are you saying that many of us have died for your entertainment?"), SAY_SAY, 8000}}, |
|
258 |
{func = AnimSay, args = {players[1], loc("Our tribe, our beautiful island!"), SAY_SAY, 4000}}, |
|
259 |
{func = AnimSay, args = {players[1], loc("All gone...everything!"), SAY_SAY, 3000}}, |
|
260 |
{func = AnimSay, args = {cyborg, loc("But the ones alive are stronger in their heart!"), SAY_SAY, 6000}}, |
|
261 |
{func = AnimSay, args = {cyborg, loc("Just kidding, none of you have died!"), SAY_SAY, 5000}}, |
|
262 |
{func = AnimSay, args = {cyborg, loc("I mean, none of you ceased to live."), SAY_SAY, 5000}}, |
|
263 |
{func = AnimSay, args = {cyborg, loc("You'll see what I mean!"), SAY_SAY, 4000}}, |
|
264 |
{func = AnimSay, args = {cyborg, loc("They are all waiting back in the village, haha."), SAY_SAY, 7000}}, |
|
265 |
{func = AnimSay, args = {players[1], loc("You are playing with our lives here!"), SAY_SAY, 6000}}, |
|
266 |
{func = AnimSay, args = {players[1], loc("Do you think you're some kind of god?"), SAY_SAY, 6000}}, |
|
267 |
{func = AnimSay, args = {cyborg, loc("Interesting idea, haha!"), SAY_SAY, 2000}}, |
|
268 |
{func = AnimSwitchHog, args = {players[1]}}, |
|
269 |
{func = AnimWait, args = {players[1], 1}}, |
|
270 |
{func = AnimDisappear, swh = false, args = {cyborg, unpack(cyborgPos[4])}}, |
|
271 |
{func = HideHedge, swh = false, args = {cyborg}}, |
|
272 |
{func = AnimSay, args = {players[1], loc("What a douche!"), SAY_SAY, 2000}}, |
|
273 |
} |
|
274 |
end |
|
275 |
--------------------------Anim skip functions-------------------------- |
|
276 |
function SkipStartAnim() |
|
277 |
RestoreNatives() |
|
278 |
RestoreCyborgs() |
|
279 |
SetGearMessage(CurrentHedgehog, 0) |
|
280 |
AnimSwitchHog(cyborgs[1]) |
|
281 |
AnimWait(cyborg, 1) |
|
282 |
AddFunction({func = HideHedge, args = {cyborg}}) |
|
283 |
end |
|
284 |
||
285 |
function AfterStartAnim() |
|
286 |
ShowMission(loc("The Enemy Of My Enemy"), loc("The Union"), loc("Defeat the cyborgs!"), 1, 0) |
|
287 |
PutWeaponCrates() |
|
288 |
PutHealthCrates() |
|
289 |
TurnTimeLeft = 0 |
|
290 |
end |
|
291 |
||
292 |
function PutHealthCrates() |
|
293 |
for i = 1, 10 do |
|
294 |
SpawnHealthCrate(0, 0) |
|
295 |
end |
|
296 |
end |
|
297 |
||
298 |
function PutWeaponCrates() |
|
299 |
SpawnAmmoCrate(2399, 622, amNapalm, 2) |
|
300 |
SpawnAmmoCrate(2199, -18, amBee, 2) |
|
301 |
SpawnAmmoCrate(2088, 430, amBee, 2) |
|
302 |
SpawnAmmoCrate(237, 20, amMortar, 4) |
|
303 |
SpawnAmmoCrate(312, 1107, amMolotov, 3) |
|
304 |
SpawnAmmoCrate(531, 1123, amWatermelon, 2) |
|
305 |
SpawnAmmoCrate(1253, 1444, amFlamethrower, 5) |
|
306 |
SpawnAmmoCrate(994, 1364, amBaseballBat, 3) |
|
307 |
SpawnAmmoCrate(1104, 1553, amMine, 6) |
|
308 |
SpawnAmmoCrate(2277, 803, amDynamite, 2) |
|
309 |
SpawnAmmoCrate(1106, 184, amRCPlane, 3) |
|
310 |
SpawnAmmoCrate(1333, 28, amSMine, 4) |
|
311 |
SpawnAmmoCrate(90, 279, amAirAttack, 2) |
|
312 |
SpawnAmmoCrate(288, 269, amBee, 2) |
|
313 |
SpawnAmmoCrate(818, 1633, amBaseballBat, 2) |
|
314 |
end |
|
315 |
-----------------------------Events------------------------------------ |
|
316 |
function CheckNativesDead() |
|
317 |
return nativesLeft == 0 |
|
318 |
end |
|
319 |
||
320 |
function CheckCannibalsDead() |
|
321 |
return cannibalsLeft == 0 |
|
322 |
end |
|
323 |
||
324 |
function CheckPlayersDead() |
|
325 |
return playersLeft == 0 |
|
326 |
end |
|
327 |
||
328 |
function CheckCyborgsDead() |
|
329 |
return (cyborgsLeft == 0 and (leader == nil or gearDead[leader] == true)) |
|
330 |
end |
|
331 |
||
332 |
function DoNativesDead() |
|
333 |
nativesDeadFresh = true |
|
334 |
TurnTimeLeft = 0 |
|
335 |
end |
|
336 |
||
337 |
function DoCannibalsDead() |
|
338 |
cannibalsDeadFresh = true |
|
339 |
TurnTimeLeft = 0 |
|
340 |
end |
|
341 |
||
342 |
function DoPlayersDead() |
|
343 |
RemoveEventFunc(CheckNativesDead) |
|
344 |
RemoveEventFunc(CheckCannibalsDead) |
|
345 |
RemoveEventFunc(CheckCyborgsDead) |
|
346 |
playersDeadFresh = true |
|
347 |
TurnTimeLeft = 0 |
|
348 |
end |
|
349 |
||
350 |
function DoCyborgsDead() |
|
351 |
-- RemoveEventFunc(CheckNativesDead) |
|
352 |
-- RemoveEventFunc(CheckCannibalsDead) |
|
353 |
cyborgsDeadFresh= true |
|
354 |
TurnTimeLeft = 0 |
|
355 |
end |
|
356 |
||
357 |
function CheckGearsDead(gearList) |
|
358 |
for i = 1, # gearList do |
|
359 |
if gearDead[gearList[i]] ~= true then |
|
360 |
return false |
|
361 |
end |
|
362 |
end |
|
363 |
return true |
|
364 |
end |
|
365 |
||
366 |
function CheckGearDead(gear) |
|
367 |
return gearDead[gear] |
|
368 |
end |
|
369 |
||
370 |
function FailedMission() |
|
371 |
RestoreHedge(cyborg) |
|
372 |
AnimOutOfNowhere(cyborg, unpack(cyborgPos[1])) |
|
373 |
if CheckCyborgsDead() then |
|
374 |
AnimSay(cyborg, loc("Hmmm...it's a draw. How unfortunate!"), SAY_THINK, 6000) |
|
375 |
elseif leader ~= nil then |
|
376 |
CondNeedToTurn2(cyborg, leader) |
|
377 |
AddAnim({{func = AnimSay, args = {leader, loc("Yay, we won!"), SAY_SAY, 2000}}, |
|
378 |
{func = AnimSay, args = {cyborg, loc("Nice work!"), SAY_SAY, 2000}}}) |
|
379 |
else |
|
380 |
CondNeedToTurn2(cyborg, cyborgs[1]) |
|
381 |
AddAnim({{func = AnimSay, args = {cyborgs[1], loc("Yay, we won!"), SAY_SAY, 2000}}, |
|
382 |
{func = AnimSay, args = {cyborg, loc("Nice work!"), SAY_SAY, 2000}}}) |
|
383 |
end |
|
384 |
AddFunction({func = LoseMission, args = {}}) |
|
385 |
end |
|
386 |
||
387 |
function LoseMission() |
|
388 |
ParseCommand("teamgone " .. loc("Natives")) |
|
389 |
ParseCommand("teamgone " .. loc("Cannibals")) |
|
390 |
ParseCommand("teamgone " .. loc("011101001")) |
|
391 |
TurnTimeLeft = 0 |
|
392 |
end |
|
393 |
||
394 |
function WonMission() |
|
395 |
RestoreHedge(cyborg) |
|
396 |
CondNeedToTurn2(cyborg, players[1]) |
|
397 |
SetupFinalAnim() |
|
398 |
AddAnim(finalAnim) |
|
399 |
AddFunction({func = WinMission, args = {}}) |
|
400 |
end |
|
401 |
||
402 |
function WinMission() |
|
8944
ed2509832311
fix bug that locked unlocked campaign missions, see issue 452
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8043
diff
changeset
|
403 |
if progress and progress<9 then |
ed2509832311
fix bug that locked unlocked campaign missions, see issue 452
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8043
diff
changeset
|
404 |
SaveCampaignVar("Progress", "9") |
ed2509832311
fix bug that locked unlocked campaign missions, see issue 452
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8043
diff
changeset
|
405 |
end |
7460 | 406 |
ParseCommand("teamgone " .. loc("011101001")) |
407 |
TurnTimeLeft = 0 |
|
408 |
end |
|
409 |
-----------------------------Misc-------------------------------------- |
|
410 |
function HideHedge(hedge) |
|
411 |
if hedgeHidden[hedge] ~= true then |
|
412 |
HideHog(hedge) |
|
413 |
hedgeHidden[hedge] = true |
|
414 |
end |
|
415 |
end |
|
416 |
||
417 |
function RestoreHedge(hedge) |
|
418 |
if hedgeHidden[hedge] == true then |
|
419 |
RestoreHog(hedge) |
|
420 |
hedgeHidden[hedge] = false |
|
421 |
end |
|
422 |
end |
|
423 |
||
424 |
function GetVariables() |
|
8944
ed2509832311
fix bug that locked unlocked campaign missions, see issue 452
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8043
diff
changeset
|
425 |
progress = tonumber(GetCampaignVar("Progress")) |
7460 | 426 |
m5DeployedNum = tonumber(GetCampaignVar("M5DeployedNum")) |
427 |
m2Choice = tonumber(GetCampaignVar("M2Choice")) |
|
428 |
m5Choice = tonumber(GetCampaignVar("M5Choice")) |
|
429 |
m2DenseDead = tonumber(GetCampaignVar("M2DenseDead")) |
|
430 |
m4DenseDead = tonumber(GetCampaignVar("M4DenseDead")) |
|
431 |
m5DenseDead = tonumber(GetCampaignVar("M5DenseDead")) |
|
432 |
m4LeaksDead = tonumber(GetCampaignVar("M4LeaksDead")) |
|
433 |
m5LeaksDead = tonumber(GetCampaignVar("M5LeaksDead")) |
|
434 |
m4ChiefDead = tonumber(GetCampaignVar("M4ChiefDead")) |
|
435 |
m5ChiefDead = tonumber(GetCampaignVar("M5ChiefDead")) |
|
436 |
m4WaterDead = tonumber(GetCampaignVar("M4WaterDead")) |
|
437 |
m5WaterDead = tonumber(GetCampaignVar("M5WaterDead")) |
|
438 |
m4BuffaloDead = tonumber(GetCampaignVar("M4BuffaloDead")) |
|
439 |
m5BuffaloDead = tonumber(GetCampaignVar("M5BuffaloDead")) |
|
440 |
m5WiseDead = tonumber(GetCampaignVar("M5WiseDead")) |
|
441 |
m5GirlDead = tonumber(GetCampaignVar("M5GirlDead")) |
|
442 |
m8DeployedDead = tonumber(GetCampaignVar("M8DeployedDead")) |
|
443 |
m8PrincessDead = tonumber(GetCampaignVar("M8PrincessDead")) |
|
444 |
m8RamonDead = tonumber(GetCampaignVar("M8RamonDead")) |
|
445 |
m8SpikyDead = tonumber(GetCampaignVar("M8SpikyDead")) |
|
446 |
m8DeployedLeader = tonumber(GetCampaignVar("M8DeployedLeader")) |
|
447 |
m8PrincessLeader = tonumber(GetCampaignVar("M8PrincessLeader")) |
|
448 |
m8EnemyFled = tonumber(GetCampaignVar("M8EnemyFled")) |
|
449 |
m8Scene = tonumber(GetCampaignVar("M8Scene")) |
|
450 |
end |
|
451 |
||
452 |
function SetupPlace() |
|
453 |
for i = 1, playersNum do |
|
454 |
HideHedge(players[i]) |
|
455 |
end |
|
456 |
for i = 1, cyborgsNum do |
|
457 |
HideHedge(cyborgs[i]) |
|
458 |
end |
|
459 |
if leader ~= nil then |
|
460 |
HideHedge(leader) |
|
461 |
end |
|
462 |
end |
|
463 |
||
464 |
function SetupEvents() |
|
465 |
AddNewEvent(CheckPlayersDead, {}, DoPlayersDead, {}, 0) |
|
466 |
AddNewEvent(CheckNativesDead, {}, DoNativesDead, {}, 0) |
|
467 |
AddNewEvent(CheckCannibalsDead, {}, DoCannibalsDead, {}, 0) |
|
468 |
AddNewEvent(CheckCyborgsDead, {}, DoCyborgsDead, {}, 0) |
|
469 |
end |
|
470 |
||
471 |
function SetupAmmo() |
|
472 |
AddAmmo(cyborgs[1], amClusterBomb, 100) |
|
473 |
AddAmmo(cyborgs[1], amMortar, 100) |
|
474 |
AddAmmo(cyborgs[1], amDynamite, 2) |
|
475 |
AddAmmo(cyborgs[1], amAirAttack, 2) |
|
476 |
AddAmmo(cyborgs[1], amTeleport, 100) |
|
477 |
||
478 |
if leader ~= nil then |
|
479 |
AddAmmo(leader, amClusterBomb, 100) |
|
480 |
AddAmmo(leader, amMortar, 100) |
|
481 |
AddAmmo(leader, amDynamite, 100) |
|
482 |
AddAmmo(leader, amAirAttack, 3) |
|
483 |
AddAmmo(leader, amTeleport, 100) |
|
484 |
end |
|
485 |
end |
|
486 |
||
487 |
function AddHogs() |
|
488 |
AddTeam(loc("011101001"), 14483456, "ring", "UFO", "Robot", "cm_star") |
|
489 |
cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1") |
|
490 |
||
491 |
AddTeam(loc("Natives"), 29439, "Bone", "Island", "HillBilly", "cm_birdy") |
|
492 |
natives[1] = AddHog(nativeNames[leaksNum], 0, 100, nativeHats[leaksNum]) |
|
493 |
if m5DeployedNum ~= leaksNum and m8DeployedLeader == 0 then |
|
494 |
natives[2] = AddHog(nativeNames[m5DeployedNum], 0, 100, nativeHats[m5DeployedNum]) |
|
495 |
end |
|
496 |
table.insert(natives, AddHog(nativeNames[ramonNum], 0, 100, nativeHats[ramonNum])) |
|
497 |
table.insert(natives, AddHog(nativeNames[spikyNum], 0, 100, nativeHats[spikyNum])) |
|
498 |
if m8PrincessLeader == 0 then |
|
499 |
table.insert(natives, AddHog(loc("Fell From Heaven"), 0, 100, "tiara")) |
|
500 |
end |
|
501 |
nativesNum = #natives |
|
502 |
nativesLeft = nativesNum |
|
503 |
cannibalsLeft = cannibalsNum |
|
504 |
for i = 1, nativesNum do |
|
505 |
table.insert(players, natives[i]) |
|
506 |
end |
|
507 |
||
508 |
AddTeam(loc("Cannibals"), 29439, "Bone", "Island", "HillBilly", "cm_birdy") |
|
509 |
for i = 1, cannibalsNum do |
|
510 |
cannibals[i] = AddHog(cannibalNames[i], 0, 100, "Zombi") |
|
511 |
table.insert(players, cannibals[i]) |
|
512 |
end |
|
513 |
playersNum = #players |
|
514 |
playersLeft = playersNum |
|
515 |
||
516 |
AddTeam(loc("Hedge-cogs"), 14483455, "ring", "UFO", "Robot", "cm_star") |
|
517 |
for i = 1, cyborgsNum do |
|
518 |
cyborgs[i] = AddHog(cyborgNames[i], 2, 80, "cyborg2") |
|
519 |
end |
|
520 |
||
521 |
if m8EnemyFled == 1 then |
|
522 |
AddTeam(loc("Leader"), 14483455, "ring", "UFO", "Robot", "cm_star") |
|
523 |
if m8Scene == denseScene then |
|
524 |
leader = AddHog(loc("Dense Cloud"), 2, 200, nativeHats[denseNum]) |
|
525 |
elseif m8Scene == waterScene then |
|
526 |
leader = AddHog(loc("Fiery Water"), 2, 200, nativeHats[waterNum]) |
|
527 |
elseif m8Scene == princessScene then |
|
528 |
leader = AddHog(loc("Fell From Heaven"), 2, 200, "tiara") |
|
529 |
else |
|
530 |
leader = AddHog(loc("Nancy Screw"), 2, 200, "cyborg2") |
|
531 |
end |
|
532 |
end |
|
533 |
||
534 |
cyborgsLeft = cyborgsNum |
|
535 |
||
536 |
for i = 1, nativesNum do |
|
537 |
AnimSetGearPosition(natives[i], unpack(nativePos[i])) |
|
538 |
AnimTurn(natives[i], nativeDir[i]) |
|
539 |
end |
|
540 |
for i = 1, cannibalsNum do |
|
541 |
AnimSetGearPosition(cannibals[i], unpack(cannibalPos[i])) |
|
542 |
AnimTurn(cannibals[i], cannibalDir[i]) |
|
543 |
end |
|
544 |
for i = 1, cyborgsNum do |
|
545 |
AnimSetGearPosition(cyborgs[i], unpack(cyborgsPos[i])) |
|
546 |
AnimTurn(cyborgs[i], cyborgsDir[i]) |
|
547 |
end |
|
548 |
AnimSetGearPosition(cyborg, unpack(cyborgPos[1])) |
|
549 |
AnimTurn(cyborg, cyborgDir) |
|
550 |
if leader ~= nil then |
|
551 |
AnimSetGearPosition(leader, unpack(leaderPos)) |
|
552 |
AnimTurn(leader, leaderDir[i]) |
|
553 |
end |
|
554 |
end |
|
555 |
||
556 |
-----------------------------Main Functions---------------------------- |
|
557 |
||
558 |
function onGameInit() |
|
559 |
Seed = 0 |
|
560 |
GameFlags = gfSolidLand |
|
561 |
TurnTime = 60000 |
|
562 |
CaseFreq = 0 |
|
563 |
MinesNum = 0 |
|
564 |
MinesTime = 3000 |
|
565 |
Explosives = 0 |
|
566 |
Delay = 10 |
|
567 |
Map = "Islands" |
|
568 |
Theme = "EarthRise" |
|
569 |
SuddenDeathTurns = 20 |
|
570 |
||
571 |
GetVariables() |
|
572 |
AnimInit() |
|
573 |
AddHogs() |
|
574 |
end |
|
575 |
||
576 |
function onGameStart() |
|
577 |
SetupAmmo() |
|
578 |
SetupPlace() |
|
579 |
AnimationSetup() |
|
580 |
SetupEvents() |
|
581 |
AddAnim(startAnim) |
|
582 |
AddFunction({func = AfterStartAnim, args = {}}) |
|
583 |
end |
|
584 |
||
585 |
function onGameTick() |
|
586 |
AnimUnWait() |
|
587 |
if ShowAnimation() == false then |
|
588 |
return |
|
589 |
end |
|
590 |
ExecuteAfterAnimations() |
|
591 |
CheckEvents() |
|
592 |
end |
|
593 |
||
594 |
function onGearDelete(gear) |
|
595 |
gearDead[gear] = true |
|
596 |
if GetGearType(gear) == gtHedgehog then |
|
597 |
if GetHogTeamName(gear) == loc("Natives") then |
|
598 |
for i = 1, nativesLeft do |
|
599 |
if natives[i] == gear then |
|
600 |
table.remove(natives, i) |
|
601 |
table.remove(players, i) |
|
602 |
nativesLeft = nativesLeft - 1 |
|
603 |
playersLeft = playersLeft - 1 |
|
604 |
end |
|
605 |
end |
|
606 |
elseif GetHogTeamName(gear) == loc("Cannibals") then |
|
607 |
for i = 1, cannibalsLeft do |
|
608 |
if cannibals[i] == gear then |
|
609 |
table.remove(cannibals, i) |
|
610 |
table.remove(players, nativesLeft + i) |
|
611 |
cannibalsLeft = cannibalsLeft - 1 |
|
612 |
playersLeft = playersLeft - 1 |
|
613 |
end |
|
614 |
end |
|
615 |
elseif GetHogTeamName(gear) == loc("Hedge-cogs") then |
|
616 |
for i = 1, cyborgsLeft do |
|
617 |
if cyborgs[i] == gear then |
|
618 |
table.remove(cyborgs, i) |
|
619 |
end |
|
620 |
end |
|
621 |
cyborgsLeft = cyborgsLeft - 1 |
|
622 |
end |
|
623 |
end |
|
624 |
end |
|
625 |
||
626 |
function onAmmoStoreInit() |
|
627 |
SetAmmo(amSkip, 9, 0, 0, 0) |
|
628 |
SetAmmo(amSwitch, 9, 0, 0, 0) |
|
629 |
SetAmmo(amDEagle, 9, 0, 0, 0) |
|
630 |
SetAmmo(amSniperRifle, 9, 0, 0, 0) |
|
631 |
SetAmmo(amBazooka, 8, 0, 0, 0) |
|
632 |
SetAmmo(amGrenade, 7, 0, 0, 0) |
|
633 |
SetAmmo(amFirePunch, 9, 0, 0, 0) |
|
634 |
SetAmmo(amShotgun, 9, 0, 0, 0) |
|
635 |
||
636 |
SetAmmo(amParachute, 9, 0, 0, 0) |
|
637 |
SetAmmo(amRope, 9, 0, 0, 0) |
|
638 |
SetAmmo(amPickHammer, 9, 0, 0, 0) |
|
639 |
SetAmmo(amBlowTorch, 9, 0, 0, 0) |
|
640 |
end |
|
641 |
||
642 |
function onNewTurn() |
|
643 |
if AnimInProgress() then |
|
644 |
TurnTimeLeft = -1 |
|
645 |
return |
|
646 |
end |
|
647 |
if playersDeadFresh then |
|
648 |
playersDeadFresh = false |
|
649 |
FailedMission() |
|
650 |
elseif cyborgsDeadFresh then |
|
651 |
cyborgsDeadFresh = false |
|
652 |
WonMission() |
|
653 |
elseif nativesDeadFresh and GetHogTeamName(CurrentHedgehog) == loc("Cannibals") then |
|
654 |
AnimSay(CurrentHedgehog, loc("Your deaths will be avenged, cannibals!"), SAY_SHOUT, 0) |
|
655 |
nativesDeadFresh = false |
|
656 |
elseif cannibalsDeadFresh and GetHogTeamName(CurrentHedgehog) == loc("Natives") then |
|
657 |
AnimSay(CurrentHedgehog, loc("Your deaths will be avenged, cannibals!"), SAY_SHOUT, 0) |
|
658 |
cannibalsDeadFresh = false |
|
659 |
end |
|
660 |
end |
|
661 |
||
662 |
function onPrecise() |
|
663 |
if GameTime > 3000 and AnimInProgress() then |
|
664 |
SetAnimSkip(true) |
|
665 |
end |
|
666 |
end |