9527
|
1 |
------------------- ABOUT ----------------------
|
|
2 |
--
|
|
3 |
-- In this adventure hero gets the lost part with
|
|
4 |
-- the help of the green bananas hogs.
|
|
5 |
|
|
6 |
HedgewarsScriptLoad("/Scripts/Locale.lua")
|
|
7 |
HedgewarsScriptLoad("/Scripts/Animate.lua")
|
|
8 |
|
|
9 |
----------------- VARIABLES --------------------
|
|
10 |
-- globals
|
|
11 |
local campaignName = loc("A Space Adventure")
|
9529
|
12 |
local missionName = loc("Fruit planet, Searching the Device!")
|
9527
|
13 |
local inBattle = false
|
9529
|
14 |
local tookPartInBattle = false
|
9527
|
15 |
-- dialogs
|
|
16 |
local dialog01 = {}
|
|
17 |
local dialog02 = {}
|
|
18 |
local dialog03 = {}
|
|
19 |
-- mission objectives
|
|
20 |
local goals = {
|
9529
|
21 |
[dialog01] = {missionName, loc("Getting the Device"), loc("With the help of the other hogs search for the device").."|"..loc("Hog Solo has to reach the last crates"), 1, 4000},
|
9527
|
22 |
[dialog02] = {missionName, loc("Battle Starts Now!"), loc("You have choose to fight! Lead the Green Bananas to battle and try not to let them be killed"), 1, 4000},
|
|
23 |
[dialog03] = {missionName, loc("Ready for Battle?"), loc("You have choose to flee... Unfortunately the only place where you can launch your saucer is in the most left side of the map"), 1, 4000},
|
|
24 |
}
|
|
25 |
-- crates types=[0:ammo,1:utility,2:health]
|
|
26 |
local crates = {
|
|
27 |
{type = 0, name = amDEagle, x = 1680, y = 1650},
|
|
28 |
{type = 0, name = amGirder, x = 1680, y = 1160},
|
|
29 |
{type = 0, name = amWatermelon, x = 1360, y = 1870},
|
|
30 |
{type = 0, name = amRope, x = 1400, y = 1870},
|
|
31 |
}
|
|
32 |
-- hogs
|
|
33 |
local hero = {}
|
|
34 |
local green1 = {}
|
|
35 |
local green2 = {}
|
|
36 |
local green3 = {}
|
|
37 |
-- teams
|
|
38 |
local teamA = {}
|
|
39 |
local teamB = {}
|
|
40 |
local teamC = {}
|
|
41 |
local teamD = {}
|
|
42 |
-- hedgehogs values
|
|
43 |
hero.name = "Hog Solo"
|
|
44 |
hero.x = 1200
|
|
45 |
hero.y = 820
|
|
46 |
hero.dead = false
|
|
47 |
green1.name = "Captain Lime"
|
|
48 |
green1.x = 1050
|
|
49 |
green1.y = 820
|
|
50 |
green2.name = "Mister Pear"
|
|
51 |
green2.x = 1350
|
|
52 |
green2.y = 820
|
|
53 |
green3.name = "Lady Mango"
|
|
54 |
green3.x = 1450
|
|
55 |
green3.y = 820
|
|
56 |
local redHedgehogs = {
|
|
57 |
{ name = "Poisonous Apple" },
|
|
58 |
{ name = "Dark Strawberry" },
|
|
59 |
{ name = "Watermelon Heart" },
|
|
60 |
{ name = "Deadly Grape" }
|
|
61 |
}
|
|
62 |
teamA.name = loc("Hog Solo and GB")
|
|
63 |
teamA.color = tonumber("38D61C",16) -- green
|
|
64 |
teamB.name = loc("Captain Lime")
|
|
65 |
teamB.color = tonumber("38D61C",16) -- green
|
|
66 |
teamC.name = loc("Fruit Assasins")
|
|
67 |
teamC.color = tonumber("FF0000",16) -- red
|
|
68 |
|
|
69 |
function onGameInit()
|
|
70 |
Seed = 1
|
|
71 |
TurnTime = 20000
|
|
72 |
CaseFreq = 0
|
|
73 |
MinesNum = 0
|
|
74 |
MinesTime = 1
|
|
75 |
Explosives = 0
|
|
76 |
Delay = 3
|
|
77 |
SuddenDeathTurns = 100
|
|
78 |
HealthCaseAmount = 50
|
|
79 |
Map = "fruit02_map"
|
|
80 |
Theme = "Fruit"
|
|
81 |
|
|
82 |
-- Hog Solo and Green Bananas
|
|
83 |
AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy")
|
|
84 |
hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1")
|
|
85 |
AnimSetGearPosition(hero.gear, hero.x, hero.y)
|
|
86 |
HogTurnLeft(hero.gear, true)
|
|
87 |
green2.gear = AddHog(green2.name, 0, 100, "war_desertgrenadier1")
|
|
88 |
AnimSetGearPosition(green2.gear, green2.x, green2.y)
|
|
89 |
HogTurnLeft(green2.gear, true)
|
|
90 |
green3.gear = AddHog(green3.name, 0, 100, "war_desertgrenadier1")
|
|
91 |
AnimSetGearPosition(green3.gear, green3.x, green3.y)
|
|
92 |
HogTurnLeft(green3.gear, true)
|
|
93 |
-- Captain Lime
|
|
94 |
AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy")
|
|
95 |
green1.gear = AddHog(green1.name, 0, 100, "war_desertgrenadier1")
|
|
96 |
AnimSetGearPosition(green1.gear, green1.x, green1.y)
|
|
97 |
-- Fruit Assasins
|
|
98 |
AddTeam(teamC.name, teamC.color, "Bone", "Island", "HillBilly", "cm_birdy")
|
|
99 |
for i=1,table.getn(redHedgehogs) do
|
|
100 |
redHedgehogs[i].gear = AddHog(redHedgehogs[i].name, 0, 100, "war_desertgrenadier1")
|
|
101 |
AnimSetGearPosition(redHedgehogs[i].gear, 2010 + 50*i, 630)
|
|
102 |
end
|
|
103 |
|
|
104 |
AnimInit()
|
9529
|
105 |
AnimationSetup()
|
9527
|
106 |
end
|
|
107 |
|
|
108 |
function onGameStart()
|
|
109 |
AnimWait(hero.gear, 3000)
|
|
110 |
FollowGear(hero.gear)
|
|
111 |
|
9529
|
112 |
if GetCampaignVar(Fruit01JoinedBattle) and GetCampaignVar(Fruit01JoinedBattle) == "true" then
|
|
113 |
tookPartInBattle = true
|
|
114 |
end
|
|
115 |
|
9527
|
116 |
AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
|
|
117 |
|
|
118 |
-- Hog Solo and GB weapons
|
|
119 |
AddAmmo(hero.gear, amFirePunch, 3)
|
|
120 |
AddAmmo(hero.gear, amSwitch, 100)
|
|
121 |
-- Assasins weapons
|
|
122 |
AddAmmo(redHedgehogs[1].gear, amBazooka, 6)
|
|
123 |
AddAmmo(redHedgehogs[1].gear, amGrenade, 6)
|
|
124 |
for i=1,table.getn(redHedgehogs) do
|
|
125 |
HideHog(redHedgehogs[i].gear)
|
|
126 |
end
|
|
127 |
|
|
128 |
-- place crates
|
|
129 |
for i=1,table.getn(crates) do
|
|
130 |
SpawnAmmoCrate(crates[i].x, crates[i].y, crates[i].name)
|
|
131 |
end
|
|
132 |
|
|
133 |
-- explosives
|
|
134 |
-- I wanted to use FindPlace but doesn't accept height values...
|
|
135 |
local x1 = 950
|
|
136 |
local x2 = 1305
|
|
137 |
local y1 = 1210
|
|
138 |
local y2 = 1620
|
|
139 |
while true do
|
|
140 |
if y2<y1 then
|
|
141 |
break
|
|
142 |
end
|
|
143 |
if x2<x1 then
|
|
144 |
x2 = 1305
|
|
145 |
y2 = y2 -60
|
|
146 |
end
|
|
147 |
if not TestRectForObstacle(x2+25, y2+25, x2-25, y2-25, true) then
|
|
148 |
AddGear(x2, y2, gtExplosives, 0, 0, 0, 0)
|
|
149 |
end
|
|
150 |
x2 = x2 - 30
|
|
151 |
end
|
|
152 |
AddGear(3128, 1680, gtExplosives, 0, 0, 0, 0)
|
|
153 |
--mines
|
|
154 |
AddGear(3135, 1680, gtMine, 0, 0, 0, 0)
|
|
155 |
AddGear(3145, 1680, gtMine, 0, 0, 0, 0)
|
|
156 |
AddGear(3155, 1680, gtMine, 0, 0, 0, 0)
|
|
157 |
AddGear(3165, 1680, gtMine, 0, 0, 0, 0)
|
|
158 |
AddGear(3175, 1680, gtMine, 0, 0, 0, 0)
|
|
159 |
AddGear(3115, 1680, gtMine, 0, 0, 0, 0)
|
|
160 |
AddGear(3105, 1680, gtMine, 0, 0, 0, 0)
|
|
161 |
AddGear(3095, 1680, gtMine, 0, 0, 0, 0)
|
|
162 |
AddGear(3085, 1680, gtMine, 0, 0, 0, 0)
|
|
163 |
AddGear(3075, 1680, gtMine, 0, 0, 0, 0)
|
|
164 |
|
9529
|
165 |
if tookPartInBattle then
|
|
166 |
AddAnim(dialog01)
|
|
167 |
else
|
|
168 |
AddAnim(dialog02)
|
|
169 |
end
|
|
170 |
|
9527
|
171 |
SendHealthStatsOff()
|
|
172 |
end
|
|
173 |
|
|
174 |
function onNewTurn()
|
|
175 |
if CurrentHedgehog == green1.gear then
|
|
176 |
TurnTimeLeft = 0
|
|
177 |
elseif not inBattle then
|
|
178 |
TurnTimeLeft = -1
|
|
179 |
end
|
|
180 |
end
|
|
181 |
|
|
182 |
function onGameTick()
|
|
183 |
AnimUnWait()
|
|
184 |
if ShowAnimation() == false then
|
|
185 |
return
|
|
186 |
end
|
|
187 |
ExecuteAfterAnimations()
|
|
188 |
CheckEvents()
|
|
189 |
end
|
|
190 |
|
|
191 |
function onGearDelete(gear)
|
|
192 |
if gear == hero.gear then
|
|
193 |
hero.dead = true
|
|
194 |
end
|
|
195 |
end
|
|
196 |
|
|
197 |
function onAmmoStoreInit()
|
|
198 |
SetAmmo(amDEagle, 0, 0, 0, 6)
|
|
199 |
SetAmmo(amGirder, 0, 0, 0, 3)
|
|
200 |
SetAmmo(amRope, 0, 0, 0, 1)
|
|
201 |
SetAmmo(amWatermelon, 0, 0, 0, 1)
|
|
202 |
end
|
|
203 |
|
|
204 |
function onPrecise()
|
|
205 |
if GameTime > 3000 then
|
|
206 |
SetAnimSkip(true)
|
|
207 |
end
|
|
208 |
end
|
|
209 |
|
|
210 |
-------------- EVENTS ------------------
|
|
211 |
|
|
212 |
function onHeroDeath(gear)
|
|
213 |
if hero.dead then
|
|
214 |
return true
|
|
215 |
end
|
|
216 |
return false
|
|
217 |
end
|
|
218 |
|
|
219 |
-------------- ACTIONS ------------------
|
|
220 |
|
|
221 |
function heroDeath(gear)
|
|
222 |
EndGame()
|
|
223 |
end
|
|
224 |
|
|
225 |
-------------- ANIMATIONS ------------------
|
|
226 |
|
|
227 |
function Skipanim(anim)
|
|
228 |
if goals[anim] ~= nil then
|
|
229 |
ShowMission(unpack(goals[anim]))
|
|
230 |
end
|
|
231 |
end
|
|
232 |
|
|
233 |
function AnimationSetup()
|
9529
|
234 |
-- DIALOG 01 - Start, Captain Lime helps Hog Solo because he took part in the battle
|
9527
|
235 |
AddSkipFunction(dialog01, Skipanim, {dialog01})
|
|
236 |
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
|
9529
|
237 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere else in the planet of fruits Captain Lime helps Hog Solo..."), 5000}})
|
|
238 |
table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("You fought bravely and you helped us win this battle!"), SAY_SAY, 5000}})
|
|
239 |
table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("So, as promised I have brought you where I think that the device you are looking is hidden."), SAY_SAY, 7000}})
|
|
240 |
table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("I know that your resources are low due to the battle but I'll send with you two of my best hogs to assist you."), SAY_SAY, 7000}})
|
|
241 |
table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("Good luck!"), SAY_SAY, 2000}})
|
9527
|
242 |
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
|
|
243 |
table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}})
|
9529
|
244 |
-- DIALOG02 - Start, Hog Solo escaped from the previous battle
|
|
245 |
AddSkipFunction(dialog02, Skipanim, {dialog02})
|
|
246 |
table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3000}})
|
|
247 |
table.insert(dialog02, {func = AnimCaption, args = {hero.gear, loc("Somewhere else in the planet of fruits Hog Solo gets closer to the device..."), 5000}})
|
|
248 |
table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You are the one who fled! So, you are alive..."), SAY_SAY, 4000}})
|
|
249 |
table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I'm still low on hogs. If you are not afraid I could use a set of extra hands"), SAY_SAY, 4000}})
|
|
250 |
table.insert(dialog02, {func = AnimWait, args = {hero.gear, 8000}})
|
|
251 |
table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I am sorry but I was looking for a device that may be hidden somewhere around here"), SAY_SAY, 4500}})
|
|
252 |
table.insert(dialog02, {func = AnimWait, args = {green1.gear, 12500}})
|
|
253 |
table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Many long forgotten things can be found in the same tunnels that we are about to search!"), SAY_SAY, 7000}})
|
|
254 |
table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("If you help us you can keep the device if you find it but we'll keep everything else"), SAY_SAY, 7000}})
|
|
255 |
table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("What do you say? Are you in?"), SAY_SAY, 3000}})
|
|
256 |
table.insert(dialog02, {func = AnimWait, args = {hero.gear, 1800}})
|
|
257 |
table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("Ok then!"), SAY_SAY, 2000}})
|
|
258 |
table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}})
|
9527
|
259 |
end
|
|
260 |
|
|
261 |
------------- OTHER FUNCTIONS ---------------
|
|
262 |
|