author | alfadur |
Mon, 12 Feb 2024 21:01:21 +0300 | |
changeset 16016 | b26c3497ea85 |
parent 15188 | 9d4a6ab60dec |
permissions | -rw-r--r-- |
12794
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
1 |
--[[ |
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
2 |
A Classic Fairytale: The enemy of my enemy |
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
3 |
|
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
4 |
= SUMMARY = |
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
5 |
Simple deathmatch on the Islands map. |
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
6 |
|
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
7 |
= GOAL = |
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
8 |
Wipe out the Hedge-cogs and Leader teams |
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
9 |
|
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
10 |
= FLOW CHART = |
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
11 |
- Cut scene: startAnim |
15093
4c40266fae97
ACF9: Correct the contents of the code comments
Wuzzy <Wuzzy2@mail.ru>
parents:
15050
diff
changeset
|
12 |
- Player starts with 3-5 natives and 4 cannibals |
4c40266fae97
ACF9: Correct the contents of the code comments
Wuzzy <Wuzzy2@mail.ru>
parents:
15050
diff
changeset
|
13 |
- Mission adds 1 native if m5DeployedNum ~= leaksNum and m8DeployedLeader == 0 |
4c40266fae97
ACF9: Correct the contents of the code comments
Wuzzy <Wuzzy2@mail.ru>
parents:
15050
diff
changeset
|
14 |
- Mission adds 1 native (princess) if m8PrincessLeader == 0 |
13144
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
15 |
- Enemy starts with 5 cyborgs |
12794
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
16 |
- TBS |
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
17 |
- Goal completed |
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
18 |
- Cut scene: finalAnim |
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
19 |
> Victory |
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
20 |
|
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
21 |
]] |
bca911f8e804
Add comments for all A Classic Fairytale missions to summarize the story in a flow chart-like fashion
Wuzzy <Wuzzy2@mail.ru>
parents:
12364
diff
changeset
|
22 |
|
8043 | 23 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
24 |
HedgewarsScriptLoad("/Scripts/Animate.lua") |
|
14897
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
25 |
HedgewarsScriptLoad("/Scripts/Utils.lua") |
7460 | 26 |
|
27 |
||
28 |
--------------------------------------------Constants------------------------------------ |
|
29 |
choiceAccepted = 1 |
|
30 |
choiceRefused = 2 |
|
31 |
choiceAttacked = 3 |
|
32 |
||
33 |
choiceEliminate = 1 |
|
34 |
choiceSpare = 2 |
|
35 |
||
36 |
leaksNum = 1 |
|
37 |
denseNum = 2 |
|
38 |
waterNum = 3 |
|
39 |
buffaloNum = 4 |
|
40 |
chiefNum = 5 |
|
41 |
girlNum = 6 |
|
42 |
wiseNum = 7 |
|
43 |
ramonNum = 8 |
|
44 |
spikyNum = 9 |
|
45 |
||
46 |
denseScene = 1 |
|
47 |
princessScene = 2 |
|
48 |
waterScene = 3 |
|
49 |
cyborgScene = 4 |
|
50 |
||
51 |
nativeNames = {loc("Leaks A Lot"), loc("Dense Cloud"), loc("Fiery Water"), |
|
52 |
loc("Raging Buffalo"), loc("Righteous Beard"), loc("Fell From Grace"), |
|
53 |
loc("Wise Oak"), loc("Ramon"), loc("Spiky Cheese") |
|
54 |
} |
|
55 |
||
56 |
nativeHats = {"Rambo", "RobinHood", "pirate_jack", "zoo_Bunny", "IndianChief", |
|
57 |
"tiara", "AkuAku", "rasta", "hair_yellow"} |
|
58 |
||
59 |
nativePos = {{1259, 120}, {2378, 796}, {424, 1299}, {3322, 260}, {1022, 1550}} |
|
60 |
nativeDir = {"Right", "Left", "Right", "Left", "Right"} |
|
61 |
||
62 |
cannibalNames = {loc("Honest Lee"), loc("Vegan Jack"), loc("Sirius Lee"), |
|
63 |
loc("Brutal Lily")} |
|
64 |
cannibalPos = {{162, 266}, {2159, 1517}, {3311, 1621}, {1180, 1560}} |
|
65 |
cannibalDir = {"Right", "Left", "Left", "Right"} |
|
66 |
cannibalsNum = 4 |
|
67 |
||
68 |
playersDir = {"Right", "Left", "Right", "Left", "Right", "Right", "Left", "Left", "Right"} |
|
69 |
playersAntiDir = {"Left", "Right", "Left", "Right", "Left", "Left", "Right", "Right", "Left"} |
|
70 |
||
71 |
cyborgNames = {loc("Smith 0.97"), loc("Smith 0.98"), loc("Smith 0.99a"), |
|
72 |
loc("Smith 0.99b"), loc("Smith 0.99f"), loc("Smith 1.0")} |
|
73 |
cyborgPos = {{2162, 20}, {2458, 564}, {542, 1133}, {3334, 1427}} |
|
74 |
cyborgDir = "Right" |
|
75 |
cyborgsNum = 6 |
|
76 |
cyborgsPos = {{1490, 330}, {1737, 1005}, {2972, 922}, {1341, 1571}, |
|
77 |
{751, 543}, {3889, 907}} |
|
78 |
cyborgsDir = {"Right", "Right", "Left", "Right", "Right", "Left"} |
|
79 |
||
80 |
leaderPos = {3474, 151} |
|
81 |
leaderDir = "Left" |
|
82 |
||
14506
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
83 |
cyborgTeamName = nil |
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
84 |
nativesTeamName = nil |
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
85 |
cannibalsTeamName = nil |
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
86 |
hedgecogsTeamName = nil |
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
87 |
leaderTeamName = nil |
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
88 |
|
7460 | 89 |
-----------------------------Variables--------------------------------- |
90 |
natives = {} |
|
91 |
origNatives = {} |
|
92 |
||
93 |
cyborgs = {} |
|
94 |
cyborg = nil |
|
95 |
||
96 |
cannibals = {} |
|
97 |
players = {} |
|
98 |
leader = nil |
|
99 |
||
100 |
gearDead = {} |
|
101 |
hedgeHidden = {} |
|
14897
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
102 |
trackedMines = {} |
7460 | 103 |
|
104 |
startAnim = {} |
|
105 |
finalAnim = {} |
|
106 |
-----------------------------Animations-------------------------------- |
|
107 |
function CondNeedToTurn(hog1, hog2) |
|
15050
09c63d4bcf53
ACF: Add some checks before calling StoppedGear
Wuzzy <Wuzzy2@mail.ru>
parents:
15040
diff
changeset
|
108 |
if (not GetHealth(hog1)) or (not GetHealth(hog2)) then |
09c63d4bcf53
ACF: Add some checks before calling StoppedGear
Wuzzy <Wuzzy2@mail.ru>
parents:
15040
diff
changeset
|
109 |
return |
09c63d4bcf53
ACF: Add some checks before calling StoppedGear
Wuzzy <Wuzzy2@mail.ru>
parents:
15040
diff
changeset
|
110 |
end |
09c63d4bcf53
ACF: Add some checks before calling StoppedGear
Wuzzy <Wuzzy2@mail.ru>
parents:
15040
diff
changeset
|
111 |
local xl, xd = GetX(hog1), GetX(hog2) |
7460 | 112 |
if xl > xd then |
113 |
AnimInsertStepNext({func = AnimTurn, args = {hog1, "Left"}}) |
|
114 |
AnimInsertStepNext({func = AnimTurn, args = {hog2, "Right"}}) |
|
115 |
elseif xl < xd then |
|
116 |
AnimInsertStepNext({func = AnimTurn, args = {hog2, "Left"}}) |
|
117 |
AnimInsertStepNext({func = AnimTurn, args = {hog1, "Right"}}) |
|
118 |
end |
|
119 |
end |
|
120 |
||
121 |
function CondNeedToTurn2(hog1, hog2) |
|
15050
09c63d4bcf53
ACF: Add some checks before calling StoppedGear
Wuzzy <Wuzzy2@mail.ru>
parents:
15040
diff
changeset
|
122 |
if (not GetHealth(hog1)) or (not GetHealth(hog2)) then |
09c63d4bcf53
ACF: Add some checks before calling StoppedGear
Wuzzy <Wuzzy2@mail.ru>
parents:
15040
diff
changeset
|
123 |
return |
09c63d4bcf53
ACF: Add some checks before calling StoppedGear
Wuzzy <Wuzzy2@mail.ru>
parents:
15040
diff
changeset
|
124 |
end |
09c63d4bcf53
ACF: Add some checks before calling StoppedGear
Wuzzy <Wuzzy2@mail.ru>
parents:
15040
diff
changeset
|
125 |
local xl, xd = GetX(hog1), GetX(hog2) |
7460 | 126 |
if xl > xd then |
127 |
AnimTurn(hog1, "Left") |
|
128 |
AnimTurn(hog2, "Right") |
|
129 |
elseif xl < xd then |
|
130 |
AnimTurn(hog2, "Left") |
|
131 |
AnimTurn(hog1, "Right") |
|
132 |
end |
|
133 |
end |
|
134 |
||
135 |
function EmitDenseClouds(dir) |
|
136 |
local dif |
|
137 |
if dir == "Left" then |
|
138 |
dif = 10 |
|
139 |
else |
|
140 |
dif = -10 |
|
141 |
end |
|
142 |
if dir == nil then |
|
143 |
dx, dy = GetGearVelocity(dense) |
|
144 |
if dx < 0 then |
|
145 |
dif = 10 |
|
146 |
else |
|
147 |
dif = -10 |
|
148 |
end |
|
149 |
end |
|
150 |
AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false}) |
|
151 |
AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false}) |
|
152 |
AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false}) |
|
153 |
AnimInsertStepNext({func = AnimWait, args = {dense, 800}}) |
|
154 |
AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false}) |
|
155 |
AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false}) |
|
156 |
AnimInsertStepNext({func = AnimWait, args = {dense, 800}}) |
|
157 |
AnimInsertStepNext({func = AnimVisualGear, args = {dense, GetX(dense) + dif, GetY(dense) + dif, vgtSteam, 0, true}, swh = false}) |
|
158 |
end |
|
159 |
||
160 |
function RestoreNatives(cgi) |
|
161 |
for i = 1, playersNum do |
|
162 |
RestoreHedge(players[i]) |
|
163 |
AnimOutOfNowhere(players[i], GetGearPosition(players[i])) |
|
164 |
end |
|
165 |
end |
|
166 |
||
167 |
function AnimationSetup() |
|
168 |
SetupCyborgStartAnim() |
|
169 |
SetupPeopleStartAnim() |
|
170 |
SetupEnemyStartAnim() |
|
171 |
AddSkipFunction(startAnim, SkipStartAnim, {}) |
|
172 |
end |
|
173 |
||
174 |
function SetupCyborgStartAnim() |
|
175 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 3000}}) |
|
176 |
table.insert(startAnim, {func = AnimTurn, args = {cyborg, "Left"}}) |
|
177 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 800}}) |
|
178 |
table.insert(startAnim, {func = AnimTurn, args = {cyborg, "Right"}}) |
|
179 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 800}}) |
|
180 |
table.insert(startAnim, {func = AnimTurn, args = {cyborg, "Left"}}) |
|
181 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 800}}) |
|
182 |
table.insert(startAnim, {func = AnimTeleportGear, args = {cyborg, unpack(cyborgPos[2])}}) |
|
183 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 800}}) |
|
184 |
table.insert(startAnim, {func = AnimTurn, args = {cyborg, "Right"}}) |
|
185 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 800}}) |
|
186 |
table.insert(startAnim, {func = AnimTurn, args = {cyborg, "Left"}}) |
|
187 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 800}}) |
|
188 |
table.insert(startAnim, {func = AnimTeleportGear, args = {cyborg, unpack(cyborgPos[3])}}) |
|
189 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 1800}}) |
|
190 |
table.insert(startAnim, {func = AnimTeleportGear, args = {cyborg, unpack(cyborgPos[4])}}) |
|
191 |
table.insert(startAnim, {func = AnimWait, args = {cyborg, 800}}) |
|
192 |
table.insert(startAnim, {func = AnimSay, args = {cyborg, loc("Everything looks OK..."), SAY_THINK, 2500}}) |
|
193 |
table.insert(startAnim, {func = AnimSay, args = {cyborg, loc("This will be fun!"), SAY_THINK, 2500}}) |
|
194 |
table.insert(startAnim, {func = AnimJump, args = {cyborg, "high"}}) |
|
195 |
table.insert(startAnim, {func = AnimCustomFunction, args = {cyborg, RestoreNatives, {true}}}) |
|
196 |
table.insert(startAnim, {func = AnimSay, args = {cyborg, loc("HAHA!"), SAY_SHOUT, 2000}}) |
|
197 |
table.insert(startAnim, {func = AnimSwitchHog, args = {players[1]}}) |
|
198 |
table.insert(startAnim, {func = AnimDisappear, swh = false, args = {cyborg, unpack(cyborgPos[4])}}) |
|
199 |
table.insert(startAnim, {func = HideHedge, swh = false, args = {cyborg}}) |
|
200 |
end |
|
201 |
||
202 |
function SetupPeopleStartAnim() |
|
203 |
for i = 1, playersNum do |
|
204 |
table.insert(startAnim, {func = AnimTurn, swh = false, args = {players[i], playersAntiDir[i]}}) |
|
205 |
end |
|
206 |
table.insert(startAnim, {func = AnimWait, args = {players[1], 800}}) |
|
207 |
for i = 1, playersNum do |
|
208 |
table.insert(startAnim, {func = AnimTurn, swh = false, args = {players[i], playersDir[i]}}) |
|
209 |
end |
|
210 |
table.insert(startAnim, {func = AnimWait, args = {players[1], 800}}) |
|
211 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("What is this place?"), SAY_SHOUT, 2500}}) |
|
212 |
if m5LeaksDead == 1 then |
|
213 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("And how am I alive?!"), SAY_SAY, 3000}}) |
|
214 |
end |
|
13144
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
215 |
local playerTalker |
15093
4c40266fae97
ACF9: Correct the contents of the code comments
Wuzzy <Wuzzy2@mail.ru>
parents:
15050
diff
changeset
|
216 |
-- Number of natives varies in this mission. One of them takes part in the dialog |
13144
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
217 |
if nativesNum >= 4 then |
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
218 |
playerTalker = players[4] |
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
219 |
else |
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
220 |
playerTalker = players[3] |
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
221 |
end |
7460 | 222 |
table.insert(startAnim, {func = AnimCustomFunction, args = {players[1], CondNeedToTurn, {players[1], players[2]}}}) |
223 |
table.insert(startAnim, {func = AnimSay, args = {players[2], loc("It must be the cyborgs again!"), SAY_SAY, 4000}}) |
|
224 |
table.insert(startAnim, {func = AnimSay, args = {players[3], loc("Looks like the whole world is falling apart!"), SAY_SAY, 6000}}) |
|
225 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("Look out! We're surrounded by cannibals!"), SAY_SHOUT, 6000}}) |
|
13144
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
226 |
table.insert(startAnim, {func = AnimCustomFunction, args = {playerTalker, CondNeedToTurn, {playerTalker, cannibals[1]}}}) |
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
227 |
table.insert(startAnim, {func = AnimCustomFunction, args = {playerTalker, CondNeedToTurn, {players[1], cannibals[1]}}}) |
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
228 |
table.insert(startAnim, {func = AnimSay, args = {playerTalker, loc("Cannibals?! You're the cannibals!"), SAY_SHOUT, 4000}}) |
7460 | 229 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("WHAT?! You're the ones attacking us!"), SAY_SHOUT, 5000}}) |
13144
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
230 |
table.insert(startAnim, {func = AnimSay, args = {playerTalker, loc("You have kidnapped our whole tribe!"), SAY_SHOUT, 4000}}) |
7460 | 231 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("You've been assaulting us, we have been just defending ourselves!"), SAY_SHOUT, 8000}}) |
232 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("I can't believe this!"), SAY_SHOUT, 3000}}) |
|
233 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("Have we ever attacked you first?"), SAY_SHOUT, 5000}}) |
|
13144
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
234 |
table.insert(startAnim, {func = AnimSay, args = {playerTalker, loc("Yes!"), SAY_SHOUT, 2000}}) |
7460 | 235 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("When?"), SAY_SHOUT, 2000}}) |
13144
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
236 |
table.insert(startAnim, {func = AnimSay, args = {playerTalker, loc("Uhmm...ok no."), SAY_SHOUT, 2000}}) |
7460 | 237 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("But you're cannibals. It's what you do."), SAY_SHOUT, 5000}}) |
238 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("Again with the 'cannibals' thing!"), SAY_SHOUT, 4000}}) |
|
239 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("Where do you get that?!"), SAY_SHOUT, 3000}}) |
|
13144
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
240 |
table.insert(startAnim, {func = AnimSay, args = {playerTalker, loc("Everyone knows this."), SAY_SHOUT, 2500}}) |
7460 | 241 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("I didn't until about a month ago."), SAY_SHOUT, 4000}}) |
13144
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
242 |
table.insert(startAnim, {func = AnimSay, args = {playerTalker, loc("Hmmm...actually...I didn't either."), SAY_SHOUT, 4000}}) |
7460 | 243 |
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}}) |
244 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("A cy-what?"), SAY_SHOUT, 2000}}) |
|
245 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("Cyborg. It's what the aliens call themselves."), SAY_SHOUT, 5000}}) |
|
246 |
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}}) |
|
247 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("They've been manipulating us all this time!"), SAY_SHOUT, 5000}}) |
|
248 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("They must be trying to weaken us!"), SAY_SHOUT, 5000}}) |
|
249 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("We have to unite and defeat those cylergs!"), SAY_SHOUT, 5000}}) |
|
250 |
table.insert(startAnim, {func = AnimSay, args = {cannibals[1], loc("We can't let them take over our little island!"), SAY_SHOUT, 5000}}) |
|
251 |
end |
|
252 |
||
253 |
function RestoreCyborgs(cgi) |
|
254 |
if cyborgsRestored == true then |
|
255 |
return |
|
256 |
end |
|
257 |
for i = 1, cyborgsNum do |
|
258 |
RestoreHedge(cyborgs[i]) |
|
259 |
if cgi == true then |
|
260 |
AnimOutOfNowhere(cyborgs[i], unpack(cyborgsPos[i])) |
|
261 |
end |
|
262 |
end |
|
263 |
RestoreHedge(leader) |
|
264 |
AnimOutOfNowhere(leader, unpack(leaderPos)) |
|
265 |
cyborgsRestored = true |
|
266 |
end |
|
267 |
||
268 |
function SetupEnemyStartAnim() |
|
269 |
local gear |
|
270 |
table.insert(startAnim, {func = AnimCustomFunction, args = {cannibals[1], RestoreCyborgs, {true}}}) |
|
271 |
if m8EnemyFled == 1 then |
|
272 |
gear = leader |
|
273 |
else |
|
274 |
gear = cyborgs[2] |
|
275 |
end |
|
13144
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
276 |
local turnPlayer |
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
277 |
if nativesNum >= 4 then |
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
278 |
turnPlayer = players[4] |
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
279 |
else |
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
280 |
turnPlayer = players[3] |
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
281 |
end |
9a0b1288315e
ACF9: Fix cannibal talking to himself in cut scene if playing with 3 natives instead of 4
Wuzzy <Wuzzy2@mail.ru>
parents:
13139
diff
changeset
|
282 |
table.insert(startAnim, {func = AnimCustomFunction, args = {players[1], CondNeedToTurn, {turnPlayer, gear}}}) |
7460 | 283 |
table.insert(startAnim, {func = AnimCustomFunction, args = {players[1], CondNeedToTurn, {players[1], gear}}}) |
284 |
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
|
285 |
table.insert(startAnim, {func = AnimSay, args = {gear, loc("You meatbags are pretty slow, you know!"), SAY_SHOUT, 5500}}) |
7460 | 286 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("Why do you want to take over our island?"), SAY_SHOUT, 5500}}) |
287 |
table.insert(startAnim, {func = AnimSay, args = {gear, loc("Do you have any idea how valuable grass is?"), SAY_SHOUT, 5500}}) |
|
288 |
table.insert(startAnim, {func = AnimSay, args = {gear, loc("This island is the only place left on Earth with grass on it!"), SAY_SHOUT, 7000}}) |
|
289 |
table.insert(startAnim, {func = AnimSay, args = {gear, loc("It's worth more than wood!"), SAY_SHOUT, 4000}}) |
|
290 |
table.insert(startAnim, {func = AnimSay, args = {gear, loc("That makes it almost invaluable!"), SAY_SHOUT, 4500}}) |
|
291 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("We have nowhere else to live!"), SAY_SHOUT, 4500}}) |
|
292 |
table.insert(startAnim, {func = AnimSay, args = {gear, loc("That's not our problem!"), SAY_SHOUT, 4500}}) |
|
293 |
table.insert(startAnim, {func = AnimSay, args = {players[1], loc("We'll give you a problem then!"), SAY_SHOUT, 5000}}) |
|
294 |
table.insert(startAnim, {func = AnimSwitchHog, args = {gear}}) |
|
295 |
end |
|
296 |
||
297 |
function SetupFinalAnim() |
|
298 |
finalAnim = { |
|
299 |
{func = AnimGearWait, args = {cyborg, 1000}}, |
|
7530 | 300 |
{func = AnimSay, args = {cyborg, loc("Nicely done, meatbags!"), SAY_SAY, 3000}}, |
7460 | 301 |
{func = AnimSay, args = {cyborg, loc("You have won the game by proving true cooperative skills!"), SAY_SAY, 7000}}, |
302 |
{func = AnimSay, args = {cyborg, loc("You have proven yourselves worthy!"), SAY_SAY, 4000}}, |
|
303 |
{func = AnimSay, args = {players[1], loc("Game? Was this a game to you?!"), SAY_SAY, 4000}}, |
|
304 |
{func = AnimSay, args = {cyborg, loc("Well, yes. This was a cyborg television show."), SAY_SAY, 5500}}, |
|
305 |
{func = AnimSay, args = {cyborg, loc("It is called 'Hogs of Steel'."), SAY_SAY, 4000}}, |
|
306 |
{func = AnimSay, args = {players[1], loc("Are you saying that many of us have died for your entertainment?"), SAY_SAY, 8000}}, |
|
307 |
{func = AnimSay, args = {players[1], loc("Our tribe, our beautiful island!"), SAY_SAY, 4000}}, |
|
308 |
{func = AnimSay, args = {players[1], loc("All gone...everything!"), SAY_SAY, 3000}}, |
|
309 |
{func = AnimSay, args = {cyborg, loc("But the ones alive are stronger in their heart!"), SAY_SAY, 6000}}, |
|
310 |
{func = AnimSay, args = {cyborg, loc("Just kidding, none of you have died!"), SAY_SAY, 5000}}, |
|
311 |
{func = AnimSay, args = {cyborg, loc("I mean, none of you ceased to live."), SAY_SAY, 5000}}, |
|
312 |
{func = AnimSay, args = {cyborg, loc("You'll see what I mean!"), SAY_SAY, 4000}}, |
|
313 |
{func = AnimSay, args = {cyborg, loc("They are all waiting back in the village, haha."), SAY_SAY, 7000}}, |
|
314 |
{func = AnimSay, args = {players[1], loc("You are playing with our lives here!"), SAY_SAY, 6000}}, |
|
315 |
{func = AnimSay, args = {players[1], loc("Do you think you're some kind of god?"), SAY_SAY, 6000}}, |
|
316 |
{func = AnimSay, args = {cyborg, loc("Interesting idea, haha!"), SAY_SAY, 2000}}, |
|
317 |
{func = AnimSwitchHog, args = {players[1]}}, |
|
318 |
{func = AnimWait, args = {players[1], 1}}, |
|
319 |
{func = AnimDisappear, swh = false, args = {cyborg, unpack(cyborgPos[4])}}, |
|
320 |
{func = HideHedge, swh = false, args = {cyborg}}, |
|
321 |
{func = AnimSay, args = {players[1], loc("What a douche!"), SAY_SAY, 2000}}, |
|
322 |
} |
|
323 |
end |
|
324 |
--------------------------Anim skip functions-------------------------- |
|
325 |
function SkipStartAnim() |
|
326 |
RestoreNatives() |
|
327 |
RestoreCyborgs() |
|
328 |
SetGearMessage(CurrentHedgehog, 0) |
|
329 |
AnimSwitchHog(cyborgs[1]) |
|
330 |
AnimWait(cyborg, 1) |
|
331 |
AddFunction({func = HideHedge, args = {cyborg}}) |
|
332 |
end |
|
333 |
||
334 |
function AfterStartAnim() |
|
335 |
ShowMission(loc("The Enemy Of My Enemy"), loc("The Union"), loc("Defeat the cyborgs!"), 1, 0) |
|
336 |
PutWeaponCrates() |
|
337 |
PutHealthCrates() |
|
12364
5857936921ec
Get rid of some incorrect timeout messages in ACF, by using EndTurn(true)
Wuzzy <almikes@aol.com>
parents:
12263
diff
changeset
|
338 |
EndTurn(true) |
7460 | 339 |
end |
340 |
||
341 |
function PutHealthCrates() |
|
342 |
for i = 1, 10 do |
|
343 |
SpawnHealthCrate(0, 0) |
|
344 |
end |
|
345 |
end |
|
346 |
||
347 |
function PutWeaponCrates() |
|
12933
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12794
diff
changeset
|
348 |
SpawnSupplyCrate(2399, 622, amNapalm, 2) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12794
diff
changeset
|
349 |
SpawnSupplyCrate(2199, -18, amBee, 2) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12794
diff
changeset
|
350 |
SpawnSupplyCrate(2088, 430, amBee, 2) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12794
diff
changeset
|
351 |
SpawnSupplyCrate(237, 20, amMortar, 4) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12794
diff
changeset
|
352 |
SpawnSupplyCrate(312, 1107, amMolotov, 3) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12794
diff
changeset
|
353 |
SpawnSupplyCrate(531, 1123, amWatermelon, 2) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12794
diff
changeset
|
354 |
SpawnSupplyCrate(1253, 1444, amFlamethrower, 5) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12794
diff
changeset
|
355 |
SpawnSupplyCrate(994, 1364, amBaseballBat, 3) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12794
diff
changeset
|
356 |
SpawnSupplyCrate(1104, 1553, amMine, 6) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12794
diff
changeset
|
357 |
SpawnSupplyCrate(2277, 803, amDynamite, 2) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12794
diff
changeset
|
358 |
SpawnSupplyCrate(1106, 184, amRCPlane, 3) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12794
diff
changeset
|
359 |
SpawnSupplyCrate(1333, 28, amSMine, 4) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12794
diff
changeset
|
360 |
SpawnSupplyCrate(90, 279, amAirAttack, 2) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12794
diff
changeset
|
361 |
SpawnSupplyCrate(288, 269, amBee, 2) |
e65aa3c3d4e6
Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents:
12794
diff
changeset
|
362 |
SpawnSupplyCrate(818, 1633, amBaseballBat, 2) |
7460 | 363 |
end |
364 |
-----------------------------Events------------------------------------ |
|
365 |
function CheckNativesDead() |
|
366 |
return nativesLeft == 0 |
|
367 |
end |
|
368 |
||
369 |
function CheckCannibalsDead() |
|
370 |
return cannibalsLeft == 0 |
|
371 |
end |
|
372 |
||
373 |
function CheckPlayersDead() |
|
374 |
return playersLeft == 0 |
|
375 |
end |
|
376 |
||
377 |
function CheckCyborgsDead() |
|
378 |
return (cyborgsLeft == 0 and (leader == nil or gearDead[leader] == true)) |
|
379 |
end |
|
380 |
||
381 |
function DoNativesDead() |
|
382 |
nativesDeadFresh = true |
|
12364
5857936921ec
Get rid of some incorrect timeout messages in ACF, by using EndTurn(true)
Wuzzy <almikes@aol.com>
parents:
12263
diff
changeset
|
383 |
EndTurn(true) |
7460 | 384 |
end |
385 |
||
386 |
function DoCannibalsDead() |
|
387 |
cannibalsDeadFresh = true |
|
12364
5857936921ec
Get rid of some incorrect timeout messages in ACF, by using EndTurn(true)
Wuzzy <almikes@aol.com>
parents:
12263
diff
changeset
|
388 |
EndTurn(true) |
7460 | 389 |
end |
390 |
||
391 |
function DoPlayersDead() |
|
392 |
RemoveEventFunc(CheckNativesDead) |
|
393 |
RemoveEventFunc(CheckCannibalsDead) |
|
394 |
RemoveEventFunc(CheckCyborgsDead) |
|
395 |
playersDeadFresh = true |
|
12364
5857936921ec
Get rid of some incorrect timeout messages in ACF, by using EndTurn(true)
Wuzzy <almikes@aol.com>
parents:
12263
diff
changeset
|
396 |
EndTurn(true) |
7460 | 397 |
end |
398 |
||
399 |
function DoCyborgsDead() |
|
400 |
-- RemoveEventFunc(CheckNativesDead) |
|
401 |
-- RemoveEventFunc(CheckCannibalsDead) |
|
402 |
cyborgsDeadFresh= true |
|
12364
5857936921ec
Get rid of some incorrect timeout messages in ACF, by using EndTurn(true)
Wuzzy <almikes@aol.com>
parents:
12263
diff
changeset
|
403 |
EndTurn(true) |
7460 | 404 |
end |
405 |
||
406 |
function CheckGearsDead(gearList) |
|
407 |
for i = 1, # gearList do |
|
408 |
if gearDead[gearList[i]] ~= true then |
|
409 |
return false |
|
410 |
end |
|
411 |
end |
|
412 |
return true |
|
413 |
end |
|
414 |
||
415 |
function CheckGearDead(gear) |
|
416 |
return gearDead[gear] |
|
417 |
end |
|
418 |
||
419 |
function FailedMission() |
|
420 |
RestoreHedge(cyborg) |
|
421 |
AnimOutOfNowhere(cyborg, unpack(cyborgPos[1])) |
|
14897
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
422 |
ClearMinesAroundCyborg() |
7460 | 423 |
if CheckCyborgsDead() then |
424 |
AnimSay(cyborg, loc("Hmmm...it's a draw. How unfortunate!"), SAY_THINK, 6000) |
|
425 |
elseif leader ~= nil then |
|
426 |
CondNeedToTurn2(cyborg, leader) |
|
427 |
AddAnim({{func = AnimSay, args = {leader, loc("Yay, we won!"), SAY_SAY, 2000}}, |
|
428 |
{func = AnimSay, args = {cyborg, loc("Nice work!"), SAY_SAY, 2000}}}) |
|
429 |
else |
|
430 |
CondNeedToTurn2(cyborg, cyborgs[1]) |
|
431 |
AddAnim({{func = AnimSay, args = {cyborgs[1], loc("Yay, we won!"), SAY_SAY, 2000}}, |
|
432 |
{func = AnimSay, args = {cyborg, loc("Nice work!"), SAY_SAY, 2000}}}) |
|
433 |
end |
|
434 |
AddFunction({func = LoseMission, args = {}}) |
|
435 |
end |
|
436 |
||
437 |
function LoseMission() |
|
14506
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
438 |
DismissTeam(nativesTeamName) |
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
439 |
DismissTeam(cannibalsTeamName) |
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
440 |
DismissTeam(cyborgTeamName) |
12364
5857936921ec
Get rid of some incorrect timeout messages in ACF, by using EndTurn(true)
Wuzzy <almikes@aol.com>
parents:
12263
diff
changeset
|
441 |
EndTurn(true) |
7460 | 442 |
end |
443 |
||
444 |
function WonMission() |
|
445 |
RestoreHedge(cyborg) |
|
446 |
CondNeedToTurn2(cyborg, players[1]) |
|
447 |
SetupFinalAnim() |
|
14897
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
448 |
ClearMinesAroundCyborg() |
7460 | 449 |
AddAnim(finalAnim) |
450 |
AddFunction({func = WinMission, args = {}}) |
|
451 |
end |
|
452 |
||
453 |
function WinMission() |
|
8944
ed2509832311
fix bug that locked unlocked campaign missions, see issue 452
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8043
diff
changeset
|
454 |
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
|
455 |
SaveCampaignVar("Progress", "9") |
ed2509832311
fix bug that locked unlocked campaign missions, see issue 452
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8043
diff
changeset
|
456 |
end |
14506
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
457 |
DismissTeam(cyborgTeamName) |
12364
5857936921ec
Get rid of some incorrect timeout messages in ACF, by using EndTurn(true)
Wuzzy <almikes@aol.com>
parents:
12263
diff
changeset
|
458 |
EndTurn(true) |
7460 | 459 |
end |
460 |
-----------------------------Misc-------------------------------------- |
|
461 |
function HideHedge(hedge) |
|
462 |
if hedgeHidden[hedge] ~= true then |
|
463 |
HideHog(hedge) |
|
464 |
hedgeHidden[hedge] = true |
|
465 |
end |
|
466 |
end |
|
467 |
||
468 |
function RestoreHedge(hedge) |
|
469 |
if hedgeHidden[hedge] == true then |
|
470 |
RestoreHog(hedge) |
|
471 |
hedgeHidden[hedge] = false |
|
472 |
end |
|
473 |
end |
|
474 |
||
14897
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
475 |
function ClearMinesAroundCyborg() |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
476 |
if GetHealth(cyborg) then |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
477 |
local vaporized = 0 |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
478 |
for mine, _ in pairs(trackedMines) do |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
479 |
if GetHealth(mine) and GetHealth(cyborg) and gearIsInBox(mine, GetX(cyborg) - 50, GetY(cyborg) - 50, 100, 100) == true then |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
480 |
AddVisualGear(GetX(mine), GetY(mine), vgtSmoke, 0, false) |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
481 |
DeleteGear(mine) |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
482 |
vaporized = vaporized + 1 |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
483 |
end |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
484 |
end |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
485 |
if vaporized > 0 then |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
486 |
PlaySound(sndVaporize) |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
487 |
end |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
488 |
end |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
489 |
end |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
490 |
|
7460 | 491 |
function GetVariables() |
8944
ed2509832311
fix bug that locked unlocked campaign missions, see issue 452
Periklis Ntanasis <pntanasis@gmail.com>
parents:
8043
diff
changeset
|
492 |
progress = tonumber(GetCampaignVar("Progress")) |
13145
5083fb0a2992
A Classic Fairytale: Harden all missions against missing campaign variables in team file and assume default values
Wuzzy <Wuzzy2@mail.ru>
parents:
13144
diff
changeset
|
493 |
m5DeployedNum = tonumber(GetCampaignVar("M5DeployedNum")) or leaksNum |
5083fb0a2992
A Classic Fairytale: Harden all missions against missing campaign variables in team file and assume default values
Wuzzy <Wuzzy2@mail.ru>
parents:
13144
diff
changeset
|
494 |
m2Choice = tonumber(GetCampaignVar("M2Choice")) or choiceRefused |
5083fb0a2992
A Classic Fairytale: Harden all missions against missing campaign variables in team file and assume default values
Wuzzy <Wuzzy2@mail.ru>
parents:
13144
diff
changeset
|
495 |
m5Choice = tonumber(GetCampaignVar("M5Choice")) or choiceEliminate |
14682
0bba06a05d52
ACF: Dump unused campaign vars, use fallback values
Wuzzy <Wuzzy2@mail.ru>
parents:
14508
diff
changeset
|
496 |
m5LeaksDead = tonumber(GetCampaignVar("M5LeaksDead")) or 0 |
13145
5083fb0a2992
A Classic Fairytale: Harden all missions against missing campaign variables in team file and assume default values
Wuzzy <Wuzzy2@mail.ru>
parents:
13144
diff
changeset
|
497 |
m8DeployedLeader = tonumber(GetCampaignVar("M8DeployedLeader")) or 0 |
5083fb0a2992
A Classic Fairytale: Harden all missions against missing campaign variables in team file and assume default values
Wuzzy <Wuzzy2@mail.ru>
parents:
13144
diff
changeset
|
498 |
m8PrincessLeader = tonumber(GetCampaignVar("M8PrincessLeader")) or 1 |
14682
0bba06a05d52
ACF: Dump unused campaign vars, use fallback values
Wuzzy <Wuzzy2@mail.ru>
parents:
14508
diff
changeset
|
499 |
m8EnemyFled = tonumber(GetCampaignVar("M8EnemyFled")) or 0 |
13145
5083fb0a2992
A Classic Fairytale: Harden all missions against missing campaign variables in team file and assume default values
Wuzzy <Wuzzy2@mail.ru>
parents:
13144
diff
changeset
|
500 |
m8Scene = tonumber(GetCampaignVar("M8Scene")) or princessScene |
7460 | 501 |
end |
502 |
||
503 |
function SetupPlace() |
|
504 |
for i = 1, playersNum do |
|
505 |
HideHedge(players[i]) |
|
506 |
end |
|
507 |
for i = 1, cyborgsNum do |
|
508 |
HideHedge(cyborgs[i]) |
|
509 |
end |
|
510 |
if leader ~= nil then |
|
511 |
HideHedge(leader) |
|
512 |
end |
|
513 |
end |
|
514 |
||
515 |
function SetupEvents() |
|
516 |
AddNewEvent(CheckPlayersDead, {}, DoPlayersDead, {}, 0) |
|
517 |
AddNewEvent(CheckNativesDead, {}, DoNativesDead, {}, 0) |
|
518 |
AddNewEvent(CheckCannibalsDead, {}, DoCannibalsDead, {}, 0) |
|
519 |
AddNewEvent(CheckCyborgsDead, {}, DoCyborgsDead, {}, 0) |
|
520 |
end |
|
521 |
||
522 |
function SetupAmmo() |
|
523 |
AddAmmo(cyborgs[1], amClusterBomb, 100) |
|
524 |
AddAmmo(cyborgs[1], amMortar, 100) |
|
525 |
AddAmmo(cyborgs[1], amDynamite, 2) |
|
526 |
AddAmmo(cyborgs[1], amAirAttack, 2) |
|
527 |
AddAmmo(cyborgs[1], amTeleport, 100) |
|
528 |
||
529 |
if leader ~= nil then |
|
530 |
AddAmmo(leader, amClusterBomb, 100) |
|
531 |
AddAmmo(leader, amMortar, 100) |
|
532 |
AddAmmo(leader, amDynamite, 100) |
|
533 |
AddAmmo(leader, amAirAttack, 3) |
|
534 |
AddAmmo(leader, amTeleport, 100) |
|
535 |
end |
|
536 |
end |
|
537 |
||
538 |
function AddHogs() |
|
14953
ff4003a90ff8
Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents:
14919
diff
changeset
|
539 |
cyborgTeamName = AddTeam(loc("011101001"), -1, "ring", "UFO", "Robot_qau", "cm_binary") |
7460 | 540 |
cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1") |
541 |
||
14507
f8c2b995c009
Use player team name in ACF campaign
Wuzzy <Wuzzy2@mail.ru>
parents:
14506
diff
changeset
|
542 |
nativesTeamName = AddMissionTeam(-2) |
15093
4c40266fae97
ACF9: Correct the contents of the code comments
Wuzzy <Wuzzy2@mail.ru>
parents:
15050
diff
changeset
|
543 |
-- There are 3-5 natives in this mission |
7460 | 544 |
natives[1] = AddHog(nativeNames[leaksNum], 0, 100, nativeHats[leaksNum]) |
545 |
if m5DeployedNum ~= leaksNum and m8DeployedLeader == 0 then |
|
546 |
natives[2] = AddHog(nativeNames[m5DeployedNum], 0, 100, nativeHats[m5DeployedNum]) |
|
547 |
end |
|
548 |
table.insert(natives, AddHog(nativeNames[ramonNum], 0, 100, nativeHats[ramonNum])) |
|
549 |
table.insert(natives, AddHog(nativeNames[spikyNum], 0, 100, nativeHats[spikyNum])) |
|
550 |
if m8PrincessLeader == 0 then |
|
551 |
table.insert(natives, AddHog(loc("Fell From Heaven"), 0, 100, "tiara")) |
|
552 |
end |
|
553 |
nativesNum = #natives |
|
554 |
nativesLeft = nativesNum |
|
555 |
cannibalsLeft = cannibalsNum |
|
556 |
for i = 1, nativesNum do |
|
557 |
table.insert(players, natives[i]) |
|
558 |
end |
|
559 |
||
14953
ff4003a90ff8
Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents:
14919
diff
changeset
|
560 |
cannibalsTeamName = AddTeam(loc("Cannibals"), -2, "skull", "Island", "Pirate_qau", "cm_vampire") |
7460 | 561 |
for i = 1, cannibalsNum do |
562 |
cannibals[i] = AddHog(cannibalNames[i], 0, 100, "Zombi") |
|
563 |
table.insert(players, cannibals[i]) |
|
564 |
end |
|
565 |
playersNum = #players |
|
566 |
playersLeft = playersNum |
|
567 |
||
14953
ff4003a90ff8
Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents:
14919
diff
changeset
|
568 |
hedgecogsTeamName = AddTeam(loc("Hedge-cogs"), -9, "ring", "UFO", "Robot_qau", "cm_cyborg") |
7460 | 569 |
for i = 1, cyborgsNum do |
570 |
cyborgs[i] = AddHog(cyborgNames[i], 2, 80, "cyborg2") |
|
571 |
end |
|
572 |
||
573 |
if m8EnemyFled == 1 then |
|
14953
ff4003a90ff8
Enable automatic voicepack language selection for all missions
Wuzzy <Wuzzy2@mail.ru>
parents:
14919
diff
changeset
|
574 |
leaderTeamName = AddTeam(loc("Leader"), -9, "ring", "UFO", "Robot_qau", "cm_cyborg") |
7460 | 575 |
if m8Scene == denseScene then |
576 |
leader = AddHog(loc("Dense Cloud"), 2, 200, nativeHats[denseNum]) |
|
577 |
elseif m8Scene == waterScene then |
|
578 |
leader = AddHog(loc("Fiery Water"), 2, 200, nativeHats[waterNum]) |
|
579 |
elseif m8Scene == princessScene then |
|
580 |
leader = AddHog(loc("Fell From Heaven"), 2, 200, "tiara") |
|
581 |
else |
|
582 |
leader = AddHog(loc("Nancy Screw"), 2, 200, "cyborg2") |
|
583 |
end |
|
584 |
end |
|
585 |
||
586 |
cyborgsLeft = cyborgsNum |
|
587 |
||
588 |
for i = 1, nativesNum do |
|
589 |
AnimSetGearPosition(natives[i], unpack(nativePos[i])) |
|
590 |
AnimTurn(natives[i], nativeDir[i]) |
|
591 |
end |
|
592 |
for i = 1, cannibalsNum do |
|
593 |
AnimSetGearPosition(cannibals[i], unpack(cannibalPos[i])) |
|
594 |
AnimTurn(cannibals[i], cannibalDir[i]) |
|
595 |
end |
|
596 |
for i = 1, cyborgsNum do |
|
597 |
AnimSetGearPosition(cyborgs[i], unpack(cyborgsPos[i])) |
|
598 |
AnimTurn(cyborgs[i], cyborgsDir[i]) |
|
599 |
end |
|
600 |
AnimSetGearPosition(cyborg, unpack(cyborgPos[1])) |
|
601 |
AnimTurn(cyborg, cyborgDir) |
|
602 |
if leader ~= nil then |
|
603 |
AnimSetGearPosition(leader, unpack(leaderPos)) |
|
604 |
AnimTurn(leader, leaderDir[i]) |
|
605 |
end |
|
606 |
end |
|
607 |
||
608 |
-----------------------------Main Functions---------------------------- |
|
609 |
||
610 |
function onGameInit() |
|
611 |
Seed = 0 |
|
612 |
GameFlags = gfSolidLand |
|
613 |
TurnTime = 60000 |
|
614 |
CaseFreq = 0 |
|
615 |
MinesNum = 0 |
|
616 |
MinesTime = 3000 |
|
617 |
Explosives = 0 |
|
618 |
Map = "Islands" |
|
619 |
Theme = "EarthRise" |
|
15040
51fbc0034c6f
Disable Sudden Death for all A Classic Fairytale missions
Wuzzy <Wuzzy2@mail.ru>
parents:
15023
diff
changeset
|
620 |
WaterRise = 0 |
51fbc0034c6f
Disable Sudden Death for all A Classic Fairytale missions
Wuzzy <Wuzzy2@mail.ru>
parents:
15023
diff
changeset
|
621 |
HealthDecrease = 0 |
7460 | 622 |
|
623 |
GetVariables() |
|
624 |
AnimInit() |
|
625 |
AddHogs() |
|
626 |
end |
|
627 |
||
628 |
function onGameStart() |
|
629 |
SetupAmmo() |
|
630 |
SetupPlace() |
|
631 |
AnimationSetup() |
|
632 |
SetupEvents() |
|
633 |
AddAnim(startAnim) |
|
634 |
AddFunction({func = AfterStartAnim, args = {}}) |
|
635 |
end |
|
636 |
||
637 |
function onGameTick() |
|
638 |
AnimUnWait() |
|
639 |
if ShowAnimation() == false then |
|
640 |
return |
|
641 |
end |
|
642 |
ExecuteAfterAnimations() |
|
643 |
CheckEvents() |
|
644 |
end |
|
645 |
||
14897
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
646 |
function onGearAdd(gear) |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
647 |
local gt = GetGearType(gear) |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
648 |
if gt == gtMine or gt == gtSMine or gt == gtAirMine then |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
649 |
trackedMines[gear] = true |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
650 |
end |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
651 |
end |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
652 |
|
7460 | 653 |
function onGearDelete(gear) |
14897
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
654 |
local gt = GetGearType(gear) |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
655 |
if gt == gtMine or gt == gtSMine or gt == gtAirMine then |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
656 |
trackedMines[gear] = nil |
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
657 |
end |
7460 | 658 |
gearDead[gear] = true |
14897
543729d313f5
ACF5, ACF9: Clear mines around cyborg when it appears
Wuzzy <Wuzzy2@mail.ru>
parents:
14682
diff
changeset
|
659 |
if gt == gtHedgehog then |
14506
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
660 |
if GetHogTeamName(gear) == nativesTeamName then |
7460 | 661 |
for i = 1, nativesLeft do |
662 |
if natives[i] == gear then |
|
663 |
table.remove(natives, i) |
|
664 |
table.remove(players, i) |
|
665 |
nativesLeft = nativesLeft - 1 |
|
666 |
playersLeft = playersLeft - 1 |
|
667 |
end |
|
668 |
end |
|
14506
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
669 |
elseif GetHogTeamName(gear) == cannibalsTeamName then |
7460 | 670 |
for i = 1, cannibalsLeft do |
671 |
if cannibals[i] == gear then |
|
672 |
table.remove(cannibals, i) |
|
673 |
table.remove(players, nativesLeft + i) |
|
674 |
cannibalsLeft = cannibalsLeft - 1 |
|
675 |
playersLeft = playersLeft - 1 |
|
676 |
end |
|
677 |
end |
|
14506
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
678 |
elseif GetHogTeamName(gear) == hedgecogsTeamName then |
7460 | 679 |
for i = 1, cyborgsLeft do |
680 |
if cyborgs[i] == gear then |
|
681 |
table.remove(cyborgs, i) |
|
682 |
end |
|
683 |
end |
|
684 |
cyborgsLeft = cyborgsLeft - 1 |
|
685 |
end |
|
686 |
end |
|
687 |
end |
|
688 |
||
689 |
function onAmmoStoreInit() |
|
690 |
SetAmmo(amSkip, 9, 0, 0, 0) |
|
691 |
SetAmmo(amSwitch, 9, 0, 0, 0) |
|
692 |
SetAmmo(amDEagle, 9, 0, 0, 0) |
|
693 |
SetAmmo(amSniperRifle, 9, 0, 0, 0) |
|
694 |
SetAmmo(amBazooka, 8, 0, 0, 0) |
|
695 |
SetAmmo(amGrenade, 7, 0, 0, 0) |
|
696 |
SetAmmo(amFirePunch, 9, 0, 0, 0) |
|
697 |
SetAmmo(amShotgun, 9, 0, 0, 0) |
|
698 |
||
699 |
SetAmmo(amParachute, 9, 0, 0, 0) |
|
700 |
SetAmmo(amRope, 9, 0, 0, 0) |
|
701 |
SetAmmo(amPickHammer, 9, 0, 0, 0) |
|
702 |
SetAmmo(amBlowTorch, 9, 0, 0, 0) |
|
703 |
end |
|
704 |
||
705 |
function onNewTurn() |
|
706 |
if AnimInProgress() then |
|
13752
110d6c1e817f
Lua: Rename globals: NoPointX→NO_CURSOR, cMaxTurnTime→MAX_TURN_TIME, cMaxHogHealth→MAX_HOG_HEALTH
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
707 |
SetTurnTimeLeft(MAX_TURN_TIME) |
7460 | 708 |
return |
709 |
end |
|
710 |
if playersDeadFresh then |
|
711 |
playersDeadFresh = false |
|
712 |
FailedMission() |
|
713 |
elseif cyborgsDeadFresh then |
|
714 |
cyborgsDeadFresh = false |
|
715 |
WonMission() |
|
14506
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
716 |
elseif nativesDeadFresh and GetHogTeamName(CurrentHedgehog) == cannibalsTeamName then |
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
717 |
AnimSay(CurrentHedgehog, string.format(loc("Your deaths will be avenged, %s!"), nativesTeamName), SAY_SHOUT, 0) |
7460 | 718 |
nativesDeadFresh = false |
14506
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
719 |
elseif cannibalsDeadFresh and GetHogTeamName(CurrentHedgehog) == nativesTeamName then |
f37910a73c19
Refactor ACF missions, store team names in variables
Wuzzy <Wuzzy2@mail.ru>
parents:
14422
diff
changeset
|
720 |
AnimSay(CurrentHedgehog, string.format(loc("Your deaths will be avenged, %s!"), cannibalsTeamName), SAY_SHOUT, 0) |
7460 | 721 |
cannibalsDeadFresh = false |
722 |
end |
|
723 |
end |
|
724 |
||
15023
3ed1cbd31754
Backed out changeset 4596357d002d (onPreciseLocal causes desyncs)
Wuzzy <Wuzzy2@mail.ru>
parents:
14953
diff
changeset
|
725 |
function onPrecise() |
7460 | 726 |
if GameTime > 3000 and AnimInProgress() then |
727 |
SetAnimSkip(true) |
|
728 |
end |
|
729 |
end |
|
15188
9d4a6ab60dec
ACF: Show "Mission succeeded/failed" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15093
diff
changeset
|
730 |
|
9d4a6ab60dec
ACF: Show "Mission succeeded/failed" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15093
diff
changeset
|
731 |
function onGameResult(winner) |
9d4a6ab60dec
ACF: Show "Mission succeeded/failed" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15093
diff
changeset
|
732 |
if winner == GetTeamClan(nativesTeamName) then |
9d4a6ab60dec
ACF: Show "Mission succeeded/failed" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15093
diff
changeset
|
733 |
SendStat(siGameResult, loc("Mission succeeded!")) |
9d4a6ab60dec
ACF: Show "Mission succeeded/failed" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15093
diff
changeset
|
734 |
else |
9d4a6ab60dec
ACF: Show "Mission succeeded/failed" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15093
diff
changeset
|
735 |
SendStat(siGameResult, loc("Mission failed!")) |
9d4a6ab60dec
ACF: Show "Mission succeeded/failed" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15093
diff
changeset
|
736 |
end |
9d4a6ab60dec
ACF: Show "Mission succeeded/failed" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15093
diff
changeset
|
737 |
end |
9d4a6ab60dec
ACF: Show "Mission succeeded/failed" in stats screen
Wuzzy <Wuzzy2@mail.ru>
parents:
15093
diff
changeset
|
738 |