7460
|
1 |
loadfile(GetDataPath() .. "Scripts/Locale.lua")()
|
|
2 |
loadfile(GetDataPath() .. "Scripts/Animate.lua")()
|
|
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}})
|
|
236 |
table.insert(startAnim, {func = AnimSay, args = {gear, loc("You blood needers are pretty slow, you know!"), SAY_SHOUT, 5500}})
|
|
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}},
|
|
251 |
{func = AnimSay, args = {cyborg, loc("Nicely done, blood needer!"), SAY_SAY, 3000}},
|
|
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()
|
|
403 |
SaveCampaignVar("Progress", "9")
|
|
404 |
ParseCommand("teamgone " .. loc("011101001"))
|
|
405 |
TurnTimeLeft = 0
|
|
406 |
end
|
|
407 |
-----------------------------Misc--------------------------------------
|
|
408 |
function HideHedge(hedge)
|
|
409 |
if hedgeHidden[hedge] ~= true then
|
|
410 |
HideHog(hedge)
|
|
411 |
hedgeHidden[hedge] = true
|
|
412 |
end
|
|
413 |
end
|
|
414 |
|
|
415 |
function RestoreHedge(hedge)
|
|
416 |
if hedgeHidden[hedge] == true then
|
|
417 |
RestoreHog(hedge)
|
|
418 |
hedgeHidden[hedge] = false
|
|
419 |
end
|
|
420 |
end
|
|
421 |
|
|
422 |
function GetVariables()
|
|
423 |
m5DeployedNum = tonumber(GetCampaignVar("M5DeployedNum"))
|
|
424 |
m2Choice = tonumber(GetCampaignVar("M2Choice"))
|
|
425 |
m5Choice = tonumber(GetCampaignVar("M5Choice"))
|
|
426 |
m2DenseDead = tonumber(GetCampaignVar("M2DenseDead"))
|
|
427 |
m4DenseDead = tonumber(GetCampaignVar("M4DenseDead"))
|
|
428 |
m5DenseDead = tonumber(GetCampaignVar("M5DenseDead"))
|
|
429 |
m4LeaksDead = tonumber(GetCampaignVar("M4LeaksDead"))
|
|
430 |
m5LeaksDead = tonumber(GetCampaignVar("M5LeaksDead"))
|
|
431 |
m4ChiefDead = tonumber(GetCampaignVar("M4ChiefDead"))
|
|
432 |
m5ChiefDead = tonumber(GetCampaignVar("M5ChiefDead"))
|
|
433 |
m4WaterDead = tonumber(GetCampaignVar("M4WaterDead"))
|
|
434 |
m5WaterDead = tonumber(GetCampaignVar("M5WaterDead"))
|
|
435 |
m4BuffaloDead = tonumber(GetCampaignVar("M4BuffaloDead"))
|
|
436 |
m5BuffaloDead = tonumber(GetCampaignVar("M5BuffaloDead"))
|
|
437 |
m5WiseDead = tonumber(GetCampaignVar("M5WiseDead"))
|
|
438 |
m5GirlDead = tonumber(GetCampaignVar("M5GirlDead"))
|
|
439 |
m8DeployedDead = tonumber(GetCampaignVar("M8DeployedDead"))
|
|
440 |
m8PrincessDead = tonumber(GetCampaignVar("M8PrincessDead"))
|
|
441 |
m8RamonDead = tonumber(GetCampaignVar("M8RamonDead"))
|
|
442 |
m8SpikyDead = tonumber(GetCampaignVar("M8SpikyDead"))
|
|
443 |
m8DeployedLeader = tonumber(GetCampaignVar("M8DeployedLeader"))
|
|
444 |
m8PrincessLeader = tonumber(GetCampaignVar("M8PrincessLeader"))
|
|
445 |
m8EnemyFled = tonumber(GetCampaignVar("M8EnemyFled"))
|
|
446 |
m8Scene = tonumber(GetCampaignVar("M8Scene"))
|
|
447 |
end
|
|
448 |
|
|
449 |
function SetupPlace()
|
|
450 |
for i = 1, playersNum do
|
|
451 |
HideHedge(players[i])
|
|
452 |
end
|
|
453 |
for i = 1, cyborgsNum do
|
|
454 |
HideHedge(cyborgs[i])
|
|
455 |
end
|
|
456 |
if leader ~= nil then
|
|
457 |
HideHedge(leader)
|
|
458 |
end
|
|
459 |
end
|
|
460 |
|
|
461 |
function SetupEvents()
|
|
462 |
AddNewEvent(CheckPlayersDead, {}, DoPlayersDead, {}, 0)
|
|
463 |
AddNewEvent(CheckNativesDead, {}, DoNativesDead, {}, 0)
|
|
464 |
AddNewEvent(CheckCannibalsDead, {}, DoCannibalsDead, {}, 0)
|
|
465 |
AddNewEvent(CheckCyborgsDead, {}, DoCyborgsDead, {}, 0)
|
|
466 |
end
|
|
467 |
|
|
468 |
function SetupAmmo()
|
|
469 |
AddAmmo(cyborgs[1], amClusterBomb, 100)
|
|
470 |
AddAmmo(cyborgs[1], amMortar, 100)
|
|
471 |
AddAmmo(cyborgs[1], amDynamite, 2)
|
|
472 |
AddAmmo(cyborgs[1], amAirAttack, 2)
|
|
473 |
AddAmmo(cyborgs[1], amTeleport, 100)
|
|
474 |
|
|
475 |
if leader ~= nil then
|
|
476 |
AddAmmo(leader, amClusterBomb, 100)
|
|
477 |
AddAmmo(leader, amMortar, 100)
|
|
478 |
AddAmmo(leader, amDynamite, 100)
|
|
479 |
AddAmmo(leader, amAirAttack, 3)
|
|
480 |
AddAmmo(leader, amTeleport, 100)
|
|
481 |
end
|
|
482 |
end
|
|
483 |
|
|
484 |
function AddHogs()
|
|
485 |
AddTeam(loc("011101001"), 14483456, "ring", "UFO", "Robot", "cm_star")
|
|
486 |
cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")
|
|
487 |
|
|
488 |
AddTeam(loc("Natives"), 29439, "Bone", "Island", "HillBilly", "cm_birdy")
|
|
489 |
natives[1] = AddHog(nativeNames[leaksNum], 0, 100, nativeHats[leaksNum])
|
|
490 |
if m5DeployedNum ~= leaksNum and m8DeployedLeader == 0 then
|
|
491 |
natives[2] = AddHog(nativeNames[m5DeployedNum], 0, 100, nativeHats[m5DeployedNum])
|
|
492 |
end
|
|
493 |
table.insert(natives, AddHog(nativeNames[ramonNum], 0, 100, nativeHats[ramonNum]))
|
|
494 |
table.insert(natives, AddHog(nativeNames[spikyNum], 0, 100, nativeHats[spikyNum]))
|
|
495 |
if m8PrincessLeader == 0 then
|
|
496 |
table.insert(natives, AddHog(loc("Fell From Heaven"), 0, 100, "tiara"))
|
|
497 |
end
|
|
498 |
nativesNum = #natives
|
|
499 |
nativesLeft = nativesNum
|
|
500 |
cannibalsLeft = cannibalsNum
|
|
501 |
for i = 1, nativesNum do
|
|
502 |
table.insert(players, natives[i])
|
|
503 |
end
|
|
504 |
|
|
505 |
AddTeam(loc("Cannibals"), 29439, "Bone", "Island", "HillBilly", "cm_birdy")
|
|
506 |
for i = 1, cannibalsNum do
|
|
507 |
cannibals[i] = AddHog(cannibalNames[i], 0, 100, "Zombi")
|
|
508 |
table.insert(players, cannibals[i])
|
|
509 |
end
|
|
510 |
playersNum = #players
|
|
511 |
playersLeft = playersNum
|
|
512 |
|
|
513 |
AddTeam(loc("Hedge-cogs"), 14483455, "ring", "UFO", "Robot", "cm_star")
|
|
514 |
for i = 1, cyborgsNum do
|
|
515 |
cyborgs[i] = AddHog(cyborgNames[i], 2, 80, "cyborg2")
|
|
516 |
end
|
|
517 |
|
|
518 |
if m8EnemyFled == 1 then
|
|
519 |
AddTeam(loc("Leader"), 14483455, "ring", "UFO", "Robot", "cm_star")
|
|
520 |
if m8Scene == denseScene then
|
|
521 |
leader = AddHog(loc("Dense Cloud"), 2, 200, nativeHats[denseNum])
|
|
522 |
elseif m8Scene == waterScene then
|
|
523 |
leader = AddHog(loc("Fiery Water"), 2, 200, nativeHats[waterNum])
|
|
524 |
elseif m8Scene == princessScene then
|
|
525 |
leader = AddHog(loc("Fell From Heaven"), 2, 200, "tiara")
|
|
526 |
else
|
|
527 |
leader = AddHog(loc("Nancy Screw"), 2, 200, "cyborg2")
|
|
528 |
end
|
|
529 |
end
|
|
530 |
|
|
531 |
cyborgsLeft = cyborgsNum
|
|
532 |
|
|
533 |
for i = 1, nativesNum do
|
|
534 |
AnimSetGearPosition(natives[i], unpack(nativePos[i]))
|
|
535 |
AnimTurn(natives[i], nativeDir[i])
|
|
536 |
end
|
|
537 |
for i = 1, cannibalsNum do
|
|
538 |
AnimSetGearPosition(cannibals[i], unpack(cannibalPos[i]))
|
|
539 |
AnimTurn(cannibals[i], cannibalDir[i])
|
|
540 |
end
|
|
541 |
for i = 1, cyborgsNum do
|
|
542 |
AnimSetGearPosition(cyborgs[i], unpack(cyborgsPos[i]))
|
|
543 |
AnimTurn(cyborgs[i], cyborgsDir[i])
|
|
544 |
end
|
|
545 |
AnimSetGearPosition(cyborg, unpack(cyborgPos[1]))
|
|
546 |
AnimTurn(cyborg, cyborgDir)
|
|
547 |
if leader ~= nil then
|
|
548 |
AnimSetGearPosition(leader, unpack(leaderPos))
|
|
549 |
AnimTurn(leader, leaderDir[i])
|
|
550 |
end
|
|
551 |
end
|
|
552 |
|
|
553 |
-----------------------------Main Functions----------------------------
|
|
554 |
|
|
555 |
function onGameInit()
|
|
556 |
Seed = 0
|
|
557 |
GameFlags = gfSolidLand
|
|
558 |
TurnTime = 60000
|
|
559 |
CaseFreq = 0
|
|
560 |
MinesNum = 0
|
|
561 |
MinesTime = 3000
|
|
562 |
Explosives = 0
|
|
563 |
Delay = 10
|
|
564 |
Map = "Islands"
|
|
565 |
Theme = "EarthRise"
|
|
566 |
SuddenDeathTurns = 20
|
|
567 |
|
|
568 |
GetVariables()
|
|
569 |
AnimInit()
|
|
570 |
AddHogs()
|
|
571 |
end
|
|
572 |
|
|
573 |
function onGameStart()
|
|
574 |
SetupAmmo()
|
|
575 |
SetupPlace()
|
|
576 |
AnimationSetup()
|
|
577 |
SetupEvents()
|
|
578 |
AddAnim(startAnim)
|
|
579 |
AddFunction({func = AfterStartAnim, args = {}})
|
|
580 |
end
|
|
581 |
|
|
582 |
function onGameTick()
|
|
583 |
AnimUnWait()
|
|
584 |
if ShowAnimation() == false then
|
|
585 |
return
|
|
586 |
end
|
|
587 |
ExecuteAfterAnimations()
|
|
588 |
CheckEvents()
|
|
589 |
end
|
|
590 |
|
|
591 |
function onGearDelete(gear)
|
|
592 |
gearDead[gear] = true
|
|
593 |
if GetGearType(gear) == gtHedgehog then
|
|
594 |
if GetHogTeamName(gear) == loc("Natives") then
|
|
595 |
for i = 1, nativesLeft do
|
|
596 |
if natives[i] == gear then
|
|
597 |
table.remove(natives, i)
|
|
598 |
table.remove(players, i)
|
|
599 |
nativesLeft = nativesLeft - 1
|
|
600 |
playersLeft = playersLeft - 1
|
|
601 |
end
|
|
602 |
end
|
|
603 |
elseif GetHogTeamName(gear) == loc("Cannibals") then
|
|
604 |
for i = 1, cannibalsLeft do
|
|
605 |
if cannibals[i] == gear then
|
|
606 |
table.remove(cannibals, i)
|
|
607 |
table.remove(players, nativesLeft + i)
|
|
608 |
cannibalsLeft = cannibalsLeft - 1
|
|
609 |
playersLeft = playersLeft - 1
|
|
610 |
end
|
|
611 |
end
|
|
612 |
elseif GetHogTeamName(gear) == loc("Hedge-cogs") then
|
|
613 |
for i = 1, cyborgsLeft do
|
|
614 |
if cyborgs[i] == gear then
|
|
615 |
table.remove(cyborgs, i)
|
|
616 |
end
|
|
617 |
end
|
|
618 |
cyborgsLeft = cyborgsLeft - 1
|
|
619 |
end
|
|
620 |
end
|
|
621 |
end
|
|
622 |
|
|
623 |
function onAmmoStoreInit()
|
|
624 |
SetAmmo(amSkip, 9, 0, 0, 0)
|
|
625 |
SetAmmo(amSwitch, 9, 0, 0, 0)
|
|
626 |
SetAmmo(amDEagle, 9, 0, 0, 0)
|
|
627 |
SetAmmo(amSniperRifle, 9, 0, 0, 0)
|
|
628 |
SetAmmo(amBazooka, 8, 0, 0, 0)
|
|
629 |
SetAmmo(amGrenade, 7, 0, 0, 0)
|
|
630 |
SetAmmo(amFirePunch, 9, 0, 0, 0)
|
|
631 |
SetAmmo(amShotgun, 9, 0, 0, 0)
|
|
632 |
|
|
633 |
SetAmmo(amParachute, 9, 0, 0, 0)
|
|
634 |
SetAmmo(amRope, 9, 0, 0, 0)
|
|
635 |
SetAmmo(amPickHammer, 9, 0, 0, 0)
|
|
636 |
SetAmmo(amBlowTorch, 9, 0, 0, 0)
|
|
637 |
end
|
|
638 |
|
|
639 |
function onNewTurn()
|
|
640 |
if AnimInProgress() then
|
|
641 |
TurnTimeLeft = -1
|
|
642 |
return
|
|
643 |
end
|
|
644 |
if playersDeadFresh then
|
|
645 |
playersDeadFresh = false
|
|
646 |
FailedMission()
|
|
647 |
elseif cyborgsDeadFresh then
|
|
648 |
cyborgsDeadFresh = false
|
|
649 |
WonMission()
|
|
650 |
elseif nativesDeadFresh and GetHogTeamName(CurrentHedgehog) == loc("Cannibals") then
|
|
651 |
AnimSay(CurrentHedgehog, loc("Your deaths will be avenged, cannibals!"), SAY_SHOUT, 0)
|
|
652 |
nativesDeadFresh = false
|
|
653 |
elseif cannibalsDeadFresh and GetHogTeamName(CurrentHedgehog) == loc("Natives") then
|
|
654 |
AnimSay(CurrentHedgehog, loc("Your deaths will be avenged, cannibals!"), SAY_SHOUT, 0)
|
|
655 |
cannibalsDeadFresh = false
|
|
656 |
end
|
|
657 |
end
|
|
658 |
|
|
659 |
function onPrecise()
|
|
660 |
if GameTime > 3000 and AnimInProgress() then
|
|
661 |
SetAnimSkip(true)
|
|
662 |
end
|
|
663 |
end
|