author | Periklis Ntanasis <pntanasis@gmail.com> |
Tue, 03 Sep 2013 04:01:19 +0300 | |
branch | spacecampaign |
changeset 9601 | 6af4ca27421a |
child 9602 | a8ed4853963e |
permissions | -rw-r--r-- |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
1 |
------------------- ABOUT ---------------------- |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
2 |
-- |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
3 |
-- Hero has been surrounded my some space villains |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
4 |
-- He has to defeat them in order to escape |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
5 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
6 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
7 |
HedgewarsScriptLoad("/Scripts/Animate.lua") |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
8 |
HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua") |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
9 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
10 |
----------------- VARIABLES -------------------- |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
11 |
-- globals |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
12 |
local missionName = loc("Killing the specialists") |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
13 |
local challengeObjectives = loc("Use your available weapons in order to eliminate the enemies").."|".. |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
14 |
loc("Each time you play this missions enemy hogs will have a random playing order").."|".. |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
15 |
loc("Each enemy hog can use only the weapon that he is named of").."|".. |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
16 |
loc("If you kill a hog with the weapon that he uses your hp will be 100").."|".. |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
17 |
loc("If you kill a hog with another weapon you'll get 35% of the damaged dealt").."|".. |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
18 |
loc("Every time you kill an enemy hog your ammo will get reseted").."|".. |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
19 |
loc("Rope won't get reseted") |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
20 |
-- hogs |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
21 |
local hero = { |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
22 |
name = loc("Hog Solo"), |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
23 |
x = 850, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
24 |
y = 460, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
25 |
mortarAmmo = 2, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
26 |
firepunchAmmo = 1, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
27 |
deagleAmmo = 4, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
28 |
bazookaAmmo = 2, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
29 |
grenadeAmmo = 4, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
30 |
} |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
31 |
local enemies = { |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
32 |
{ name = loc("Mortar"), x = 1890, y = 520, weapon = amMortar, additionalWeapons = {}}, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
33 |
{ name = loc("Desert Eagle"), x = 1390, y = 790, weapon = amDEagle, additionalWeapons = {}}, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
34 |
{ name = loc("Grenade"), x = 186, y = 48, weapon = amGrenade, additionalWeapons = {}}, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
35 |
{ name = loc("Shyryuken"), x = 330, y = 270, weapon = amFirePunch, additionalWeapons = {}}, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
36 |
{ name = loc("Bazooka"), x = 1950, y = 150, weapon = amBazooka, additionalWeapons = {}}, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
37 |
} |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
38 |
-- teams |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
39 |
local teamA = { |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
40 |
name = loc("Hog Solo"), |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
41 |
color = tonumber("38D61C",16) -- green |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
42 |
} |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
43 |
local teamB = { |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
44 |
name = loc("5 deadly hogs"), |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
45 |
color = tonumber("FF0000",16) -- red |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
46 |
} |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
47 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
48 |
-------------- LuaAPI EVENT HANDLERS ------------------ |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
49 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
50 |
function onGameInit() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
51 |
Seed = 1 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
52 |
TurnTime = 25000 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
53 |
CaseFreq = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
54 |
MinesNum = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
55 |
MinesTime = 1 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
56 |
Explosives = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
57 |
Map = "death02_map" |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
58 |
Theme = "Hell" |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
59 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
60 |
-- Hog Solo |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
61 |
AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "cm_birdy") |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
62 |
hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1") |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
63 |
AnimSetGearPosition(hero.gear, hero.x, hero.y) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
64 |
-- enemies |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
65 |
shuffleHogs(enemies) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
66 |
AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_birdy") |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
67 |
for i=1,table.getn(enemies) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
68 |
enemies[i].gear = AddHog(enemies[i].name, 1, 100, "war_desertgrenadier1") |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
69 |
AnimSetGearPosition(enemies[i].gear, enemies[i].x, enemies[i].y) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
70 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
71 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
72 |
initCheckpoint("death02") |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
73 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
74 |
AnimInit() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
75 |
--AnimationSetup() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
76 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
77 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
78 |
function onGameStart() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
79 |
AnimWait(hero.gear, 3000) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
80 |
FollowGear(hero.gear) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
81 |
ShowMission(missionName, loc("Challenge Objectives"), challengeObjectives, -amSkip, 0) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
82 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
83 |
AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
84 |
AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 0) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
85 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
86 |
--hero ammo |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
87 |
AddAmmo(hero.gear, amSkip, 100) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
88 |
AddAmmo(hero.gear, amRope, 2) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
89 |
refreshHeroAmmo() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
90 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
91 |
SendHealthStatsOff() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
92 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
93 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
94 |
function onNewTurn() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
95 |
if CurrentHedgehog ~= hero.gear then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
96 |
enemyWeapons() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
97 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
98 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
99 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
100 |
function onGearDelete(gear) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
101 |
if isHog(gear) then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
102 |
SetHealth(hero.gear, 100) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
103 |
local deadHog = getHog(gear) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
104 |
if deadHog.weapon == amDynamite then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
105 |
hero.dynamiteAmmo = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
106 |
elseif deadHog.weapon == amFirePunch then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
107 |
hero.firepunchAmmo = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
108 |
elseif deadHog.weapon == amDEagle then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
109 |
hero.deagleAmmo = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
110 |
elseif deadHog.weapon == amBazooka then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
111 |
hero.bazookaAmmo = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
112 |
elseif deadHog.weapon == amGrenade then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
113 |
hero.grenadeAmmo = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
114 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
115 |
local randomHog = math.random(1,table.getn(enemies)) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
116 |
while not GetHealth(enemies[randomHog].gear) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
117 |
randomHog = math.random(1,table.getn(enemies)) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
118 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
119 |
table.insert(enemies[randomHog].additionalWeapons, deadHog.weapon) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
120 |
for i=1,table.getn(deadHog.additionalWeapons) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
121 |
table.insert(enemies[randomHog].additionalWeapons, deadHog.additionalWeapons[i]) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
122 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
123 |
refreshHeroAmmo() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
124 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
125 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
126 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
127 |
function onGearDamage(gear, damage) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
128 |
if isHog(gear) and GetHealth(hero.gear) then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
129 |
SetHealth(hero.gear, GetHealth(hero.gear) + damage/3) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
130 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
131 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
132 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
133 |
function onGameTick() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
134 |
AnimUnWait() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
135 |
if ShowAnimation() == false then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
136 |
return |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
137 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
138 |
ExecuteAfterAnimations() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
139 |
CheckEvents() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
140 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
141 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
142 |
function onPrecise() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
143 |
if GameTime > 3000 then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
144 |
SetAnimSkip(true) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
145 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
146 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
147 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
148 |
-------------- EVENTS ------------------ |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
149 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
150 |
function onHeroDeath(gear) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
151 |
if not GetHealth(hero.gear) then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
152 |
return true |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
153 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
154 |
return false |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
155 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
156 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
157 |
function onHeroWin(gear) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
158 |
local allDead = true |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
159 |
for i=1,table.getn(enemies) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
160 |
if GetHealth(enemies[i].gear) then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
161 |
allDead = false |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
162 |
break |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
163 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
164 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
165 |
return allDead |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
166 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
167 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
168 |
-------------- ACTIONS ------------------ |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
169 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
170 |
function heroDeath(gear) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
171 |
SendStat('siGameResult', loc("Hog Solo lost, try again!")) --1 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
172 |
SendStat('siCustomAchievement', loc("You have to eliminate all the enemies")) --11 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
173 |
SendStat('siCustomAchievement', loc("Read the Challenge Objectives from within the mission for more details")) --11 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
174 |
SendStat('siPlayerKills','1',teamB.name) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
175 |
SendStat('siPlayerKills','0',teamA.name) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
176 |
EndGame() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
177 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
178 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
179 |
function heroWin(gear) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
180 |
SendStat('siGameResult', loc("Congratulations, you won!")) --1 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
181 |
SendStat('siCustomAchievement', loc("You complete the mission in "..TotalRounds.." rounds")) --11 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
182 |
-- TODO SendStat('siCustomAchievement', loc("You have gained some extra life")) --11 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
183 |
SendStat('siPlayerKills','1',teamA.name) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
184 |
EndGame() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
185 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
186 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
187 |
------------ Other Functions ------------------- |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
188 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
189 |
function shuffleHogs(hogs) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
190 |
local hogsNumber = table.getn(hogs) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
191 |
for i=1,hogsNumber do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
192 |
local randomHog = math.random(hogsNumber) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
193 |
hogs[i], hogs[randomHog] = hogs[randomHog], hogs[i] |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
194 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
195 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
196 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
197 |
function refreshHeroAmmo() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
198 |
local extraAmmo = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
199 |
if getAliveEnemiesCount() == 1 then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
200 |
extraAmmo = 2 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
201 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
202 |
AddAmmo(hero.gear, amMortar, hero.mortarAmmo + extraAmmo) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
203 |
AddAmmo(hero.gear, amFirePunch, hero.firepunchAmmo + extraAmmo) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
204 |
AddAmmo(hero.gear, amDEagle, hero.deagleAmmo + extraAmmo) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
205 |
AddAmmo(hero.gear, amBazooka, hero.bazookaAmmo + extraAmmo) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
206 |
AddAmmo(hero.gear, amGrenade, hero.grenadeAmmo + extraAmmo) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
207 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
208 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
209 |
function enemyWeapons() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
210 |
for i=1,table.getn(enemies) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
211 |
if GetHealth(enemies[i].gear) and enemies[i].gear == CurrentHedgehog then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
212 |
AddAmmo(enemies[i].gear, amMortar, 0) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
213 |
AddAmmo(enemies[i].gear, amFirePunch, 0) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
214 |
AddAmmo(enemies[i].gear, amDEagle, 0) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
215 |
AddAmmo(enemies[i].gear, amBazooka, 0) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
216 |
AddAmmo(enemies[i].gear, amGrenade, 0) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
217 |
AddAmmo(enemies[i].gear, enemies[i].weapon, 1) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
218 |
for w=1,table.getn(enemies[i].additionalWeapons) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
219 |
AddAmmo(enemies[i].gear, enemies[i].additionalWeapons[w], 1) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
220 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
221 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
222 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
223 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
224 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
225 |
function isHog(gear) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
226 |
local hog = false |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
227 |
for i=1,table.getn(enemies) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
228 |
if gear == enemies[i].gear then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
229 |
hog = true |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
230 |
break |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
231 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
232 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
233 |
return hog |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
234 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
235 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
236 |
function getHog(gear) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
237 |
for i=1,table.getn(enemies) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
238 |
if gear == enemies[i].gear then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
239 |
return enemies[i] |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
240 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
241 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
242 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
243 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
244 |
function getAliveEnemiesCount() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
245 |
local count = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
246 |
for i=1,table.getn(enemies) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
247 |
if GetHealth(enemies[i].gear) then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
248 |
count = count + 1 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
249 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
250 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
251 |
return count |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
252 |
end |