author | Wuzzy <almikes@aol.com> |
Thu, 28 Sep 2017 17:26:54 +0200 | |
changeset 12575 | 0c5ce463949b |
parent 12565 | 392f90c79b78 |
child 12577 | e2b5c6e805e8 |
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") |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
9831
diff
changeset
|
13 |
local challengeObjectives = loc("Use your available weapons in order to eliminate the enemies.").."|".. |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
9831
diff
changeset
|
14 |
loc("Each time you play this missions enemy hogs will play in a random order.").."|".. |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
9831
diff
changeset
|
15 |
loc("At the start of the game each enemy hog has only the weapon that he is named after.").."|".. |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
9831
diff
changeset
|
16 |
loc("A random hedgehog will inherit the weapons of his deceased team-mates.").."|".. |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
9831
diff
changeset
|
17 |
loc("If you kill a hedgehog with the respective weapon your health points will be set to 100.").."|".. |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
9831
diff
changeset
|
18 |
loc("If you injure a hedgehog you'll get 35% of the damage dealt.").."|".. |
12089
0183b4c448bf
Fix Killing the Specialists giving you a free turn after killing Desert Eagle with a desert eagle with shot 1-3
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
19 |
loc("Every time you kill an enemy hog your ammo will get reset next turn.").."|".. |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
9831
diff
changeset
|
20 |
loc("The rope won't get reset.") |
9602
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
21 |
-- dialogs |
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
22 |
local dialog01 = {} |
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
23 |
-- mission objectives |
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
24 |
local goals = { |
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
25 |
["init"] = {missionName, loc("Challenge objectives"), challengeObjectives, 1, 35000}, |
9602
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
26 |
} |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
27 |
-- hogs |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
28 |
local hero = { |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
29 |
name = loc("Hog Solo"), |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
30 |
x = 850, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
31 |
y = 460, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
32 |
mortarAmmo = 2, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
33 |
firepunchAmmo = 1, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
34 |
deagleAmmo = 4, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
35 |
bazookaAmmo = 2, |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
36 |
grenadeAmmo = 4, |
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 |
local enemies = { |
12565
392f90c79b78
ASA, death02: Use GetAmmoName for the enemy hog names
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
39 |
{ name = GetAmmoName(amMortar), x = 1890, y = 520, weapon = amMortar, additionalWeapons = {}}, |
392f90c79b78
ASA, death02: Use GetAmmoName for the enemy hog names
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
40 |
{ name = GetAmmoName(amDEagle), x = 1390, y = 790, weapon = amDEagle, additionalWeapons = {}}, |
392f90c79b78
ASA, death02: Use GetAmmoName for the enemy hog names
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
41 |
{ name = GetAmmoName(amGrenade), x = 186, y = 48, weapon = amGrenade, additionalWeapons = {}}, |
392f90c79b78
ASA, death02: Use GetAmmoName for the enemy hog names
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
42 |
{ name = GetAmmoName(amFirePunch), x = 330, y = 270, weapon = amFirePunch, additionalWeapons = {}}, |
392f90c79b78
ASA, death02: Use GetAmmoName for the enemy hog names
Wuzzy <almikes@aol.com>
parents:
12538
diff
changeset
|
43 |
{ name = GetAmmoName(amBazooka), x = 1950, y = 150, weapon = amBazooka, additionalWeapons = {}}, |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
44 |
} |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
45 |
-- teams |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
46 |
local teamA = { |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
47 |
name = loc("Hog Solo"), |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
48 |
color = tonumber("38D61C",16) -- green |
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 |
local teamB = { |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
9831
diff
changeset
|
51 |
name = loc("5 Deadly Hogs"), |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
52 |
color = tonumber("FF0000",16) -- red |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
53 |
} |
12089
0183b4c448bf
Fix Killing the Specialists giving you a free turn after killing Desert Eagle with a desert eagle with shot 1-3
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
54 |
-- After hero killed an enemy, his weapons will be reset in the next round |
0183b4c448bf
Fix Killing the Specialists giving you a free turn after killing Desert Eagle with a desert eagle with shot 1-3
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
55 |
local heroWeaponResetPending = false |
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
56 |
local battleStarted = false |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
57 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
58 |
-------------- LuaAPI EVENT HANDLERS ------------------ |
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 |
function onGameInit() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
61 |
Seed = 1 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
62 |
TurnTime = 25000 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
63 |
CaseFreq = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
64 |
MinesNum = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
65 |
MinesTime = 1 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
66 |
Explosives = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
67 |
Map = "death02_map" |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
68 |
Theme = "Hell" |
12468
d652c6f5d5f1
Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents:
12089
diff
changeset
|
69 |
-- Disable Sudden Death |
d652c6f5d5f1
Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents:
12089
diff
changeset
|
70 |
WaterRise = 0 |
d652c6f5d5f1
Disable Sudden Death for a couple of ASA missions
Wuzzy <almikes@aol.com>
parents:
12089
diff
changeset
|
71 |
HealthDecrease = 0 |
9758 | 72 |
|
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
73 |
-- Hog Solo |
12049
030464f34d47
Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents:
11965
diff
changeset
|
74 |
AddTeam(teamA.name, teamA.color, "Bone", "Island", "HillBilly", "hedgewars") |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
75 |
hero.gear = AddHog(hero.name, 0, 100, "war_desertgrenadier1") |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
76 |
AnimSetGearPosition(hero.gear, hero.x, hero.y) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
77 |
-- enemies |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
78 |
shuffleHogs(enemies) |
12049
030464f34d47
Tweak flags used in all missions to fit more to the theme
Wuzzy <almikes@aol.com>
parents:
11965
diff
changeset
|
79 |
AddTeam(teamB.name, teamB.color, "Bone", "Island", "HillBilly", "cm_skull") |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
80 |
for i=1,table.getn(enemies) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
81 |
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
|
82 |
AnimSetGearPosition(enemies[i].gear, enemies[i].x, enemies[i].y) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
83 |
end |
9758 | 84 |
|
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
85 |
initCheckpoint("death02") |
9758 | 86 |
|
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12049
diff
changeset
|
87 |
AnimInit(true) |
9602
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
88 |
AnimationSetup() |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
89 |
end |
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 |
function onGameStart() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
92 |
AnimWait(hero.gear, 3000) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
93 |
FollowGear(hero.gear) |
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
94 |
ShowMission(unpack(goals["init"])) |
9758 | 95 |
|
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
96 |
AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
97 |
AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 0) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
98 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
99 |
--hero ammo |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
100 |
AddAmmo(hero.gear, amSkip, 100) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
101 |
AddAmmo(hero.gear, amRope, 2) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
102 |
refreshHeroAmmo() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
103 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
104 |
SendHealthStatsOff() |
9602
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
105 |
AddAnim(dialog01) |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
106 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
107 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
108 |
function onNewTurn() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
109 |
if CurrentHedgehog ~= hero.gear then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
110 |
enemyWeapons() |
12089
0183b4c448bf
Fix Killing the Specialists giving you a free turn after killing Desert Eagle with a desert eagle with shot 1-3
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
111 |
elseif heroWeaponResetPending then |
0183b4c448bf
Fix Killing the Specialists giving you a free turn after killing Desert Eagle with a desert eagle with shot 1-3
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
112 |
refreshHeroAmmo() |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
113 |
end |
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 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
116 |
function onGearDelete(gear) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
117 |
if isHog(gear) then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
118 |
SetHealth(hero.gear, 100) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
119 |
local deadHog = getHog(gear) |
9603
47b8edc799f5
changed some left amDynamite to amMortar
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9602
diff
changeset
|
120 |
if deadHog.weapon == amMortar then |
47b8edc799f5
changed some left amDynamite to amMortar
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9602
diff
changeset
|
121 |
hero.mortarAmmo = 0 |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
122 |
elseif deadHog.weapon == amFirePunch then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
123 |
hero.firepunchAmmo = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
124 |
elseif deadHog.weapon == amDEagle then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
125 |
hero.deagleAmmo = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
126 |
elseif deadHog.weapon == amBazooka then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
127 |
hero.bazookaAmmo = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
128 |
elseif deadHog.weapon == amGrenade then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
129 |
hero.grenadeAmmo = 0 |
9758 | 130 |
end |
9810
54c0fdec4600
changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9758
diff
changeset
|
131 |
local randomHog = GetRandom(table.getn(enemies))+1 |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
132 |
while not GetHealth(enemies[randomHog].gear) do |
9810
54c0fdec4600
changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9758
diff
changeset
|
133 |
randomHog = GetRandom(table.getn(enemies))+1 |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
134 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
135 |
table.insert(enemies[randomHog].additionalWeapons, deadHog.weapon) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
136 |
for i=1,table.getn(deadHog.additionalWeapons) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
137 |
table.insert(enemies[randomHog].additionalWeapons, deadHog.additionalWeapons[i]) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
138 |
end |
12089
0183b4c448bf
Fix Killing the Specialists giving you a free turn after killing Desert Eagle with a desert eagle with shot 1-3
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
139 |
heroWeaponResetPending = true |
9601
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 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
142 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
143 |
function onGearDamage(gear, damage) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
144 |
if isHog(gear) and GetHealth(hero.gear) then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
145 |
SetHealth(hero.gear, GetHealth(hero.gear) + damage/3) |
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 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
148 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
149 |
function onGameTick() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
150 |
AnimUnWait() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
151 |
if ShowAnimation() == false then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
152 |
return |
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 |
ExecuteAfterAnimations() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
155 |
CheckEvents() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
156 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
157 |
|
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
158 |
-- Hide mission panel when player does anything |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
159 |
function hideMissionOnAction() |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
160 |
if battleStarted then |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
161 |
HideMission() |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
162 |
end |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
163 |
end |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
164 |
|
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
165 |
onHogAttack = hideMissionOnAction |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
166 |
onAttack = hideMissionOnAction |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
167 |
onLeft = hideMissionOnAction |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
168 |
onRight = hideMissionOnAction |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
169 |
onUp = hideMissionOnAction |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
170 |
onDown = hideMissionOnAction |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
171 |
onLJump = hideMissionOnAction |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
172 |
onHJump = hideMissionOnAction |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
173 |
onSlot = hideMissionOnAction |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
174 |
onSetWeapon = hideMissionOnAction |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
175 |
onTimer = hideMissionOnAction |
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
176 |
|
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
177 |
function onPrecise() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
178 |
if GameTime > 3000 then |
9758 | 179 |
SetAnimSkip(true) |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
180 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
181 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
182 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
183 |
-------------- EVENTS ------------------ |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
184 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
185 |
function onHeroDeath(gear) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
186 |
if not GetHealth(hero.gear) then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
187 |
return true |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
188 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
189 |
return false |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
190 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
191 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
192 |
function onHeroWin(gear) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
193 |
local allDead = true |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
194 |
for i=1,table.getn(enemies) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
195 |
if GetHealth(enemies[i].gear) then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
196 |
allDead = false |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
197 |
break |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
198 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
199 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
200 |
return allDead |
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 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
203 |
-------------- ACTIONS ------------------ |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
204 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
205 |
function heroDeath(gear) |
9642
8a691e0f117a
use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9631
diff
changeset
|
206 |
SendStat(siGameResult, loc("Hog Solo lost, try again!")) |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
9831
diff
changeset
|
207 |
SendStat(siCustomAchievement, loc("You have to eliminate all the enemies.")) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
9831
diff
changeset
|
208 |
SendStat(siCustomAchievement, loc("Read the challenge objectives from within the mission for more details.")) |
12538
952afc3d2df2
Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents:
12468
diff
changeset
|
209 |
sendSimpleTeamRankings({teamB.name, teamA.name}) |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
210 |
EndGame() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
211 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
212 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
213 |
function heroWin(gear) |
9630 | 214 |
saveBonus(3, 4) |
9642
8a691e0f117a
use consts for TStatInfo enum
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9631
diff
changeset
|
215 |
SendStat(siGameResult, loc("Congratulations, you won!")) |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
9831
diff
changeset
|
216 |
SendStat(siCustomAchievement, string.format(loc("You completed the mission in %d rounds."), TotalRounds)) |
11892
0526a26ddd6e
Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
217 |
local record = tonumber(GetCampaignVar("FastestSpecialistsKill")) |
0526a26ddd6e
Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
218 |
if record ~= nil and TotalRounds >= record then |
0526a26ddd6e
Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
219 |
SendStat(siCustomAchievement, string.format(loc("Your fastest victory so far: %d rounds"), record)) |
0526a26ddd6e
Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
220 |
end |
0526a26ddd6e
Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
221 |
if record == nil or TotalRounds < record then |
0526a26ddd6e
Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
222 |
SaveCampaignVar("FastestSpecialistsKill", tostring(TotalRounds)) |
0526a26ddd6e
Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
223 |
if record ~= nil then |
0526a26ddd6e
Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
224 |
SendStat(siCustomAchievement, loc("This is a new personal best, congratulations!")) |
0526a26ddd6e
Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
225 |
end |
0526a26ddd6e
Save fastest rounds in Killing the specialists and Precise shooting missions
Wuzzy <almikes@aol.com>
parents:
11692
diff
changeset
|
226 |
end |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
9831
diff
changeset
|
227 |
SendStat(siCustomAchievement, loc("The next 4 times you play the \"The last encounter\" mission you'll get 20 more hit points and a laser sight.")) |
12538
952afc3d2df2
Show correct kill counts in all ASA missions (fixes #147)
Wuzzy <almikes@aol.com>
parents:
12468
diff
changeset
|
228 |
sendSimpleTeamRankings({teamA.name, teamB.name}) |
11952
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
11892
diff
changeset
|
229 |
SaveCampaignVar("Mission11Won", "true") |
11965
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
230 |
checkAllMissionsCompleted() |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
231 |
EndGame() |
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 |
|
9602
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
234 |
-------------- ANIMATIONS ------------------ |
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
235 |
|
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
236 |
function Skipanim(anim) |
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
237 |
startBattle() |
9602
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
238 |
end |
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
239 |
|
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
240 |
function AnimationSetup() |
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
241 |
-- DIALOG 01 - Start, game instructions |
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
242 |
AddSkipFunction(dialog01, Skipanim, {dialog01}) |
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
243 |
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}}) |
11692
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
9831
diff
changeset
|
244 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Somewhere on the Planet of Death ..."), 3000}}) |
68eddcdc9f26
Typo fixes for A Space Adventure campaign
Wuzzy <almikes@aol.com>
parents:
9831
diff
changeset
|
245 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("... Hog Solo fights for his life"), 3000}}) |
9602
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
246 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Each time you play this missions enemy hogs will play in a random order"), 5000}}) |
9758 | 247 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("At the start of the game each enemy hog has only the weapon that he is named after"), 5000}}) |
248 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("A random hedgehog will inherit the weapons of his deceased team-mates"), 5000}}) |
|
9831 | 249 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you kill a hedgehog with the respective weapon your health points will be set to 100"), 5000}}) |
9758 | 250 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("If you injure a hedgehog you'll get 35% of the damage dealt"), 5000}}) |
12089
0183b4c448bf
Fix Killing the Specialists giving you a free turn after killing Desert Eagle with a desert eagle with shot 1-3
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
251 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Every time you kill an enemy hog your ammo will get reset next turn"), 5000}}) |
9758 | 252 |
table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Rope won't get reset"), 2000}}) |
9602
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
253 |
table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}}) |
9758 | 254 |
table.insert(dialog01, {func = startBattle, args = {hero.gear}}) |
9602
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
255 |
end |
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
256 |
|
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
257 |
------------ Other Functions ------------------- |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
258 |
|
9602
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
259 |
function startBattle() |
12575
0c5ce463949b
ASA: Improve displaying of mission panels all over the place
Wuzzy <almikes@aol.com>
parents:
12565
diff
changeset
|
260 |
battleStarted = true |
9602
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
261 |
AnimSwitchHog(hero.gear) |
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
262 |
TurnTimeLeft = TurnTime |
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
263 |
end |
a8ed4853963e
dialogs with objectives added
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9601
diff
changeset
|
264 |
|
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
265 |
function shuffleHogs(hogs) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
266 |
local hogsNumber = table.getn(hogs) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
267 |
for i=1,hogsNumber do |
9810
54c0fdec4600
changing math functions that may cause desyncs
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9758
diff
changeset
|
268 |
local randomHog = GetRandom(hogsNumber) + 1 |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
269 |
hogs[i], hogs[randomHog] = hogs[randomHog], hogs[i] |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
270 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
271 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
272 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
273 |
function refreshHeroAmmo() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
274 |
local extraAmmo = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
275 |
if getAliveEnemiesCount() == 1 then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
276 |
extraAmmo = 2 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
277 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
278 |
AddAmmo(hero.gear, amMortar, hero.mortarAmmo + extraAmmo) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
279 |
AddAmmo(hero.gear, amFirePunch, hero.firepunchAmmo + extraAmmo) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
280 |
AddAmmo(hero.gear, amDEagle, hero.deagleAmmo + extraAmmo) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
281 |
AddAmmo(hero.gear, amBazooka, hero.bazookaAmmo + extraAmmo) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
282 |
AddAmmo(hero.gear, amGrenade, hero.grenadeAmmo + extraAmmo) |
12089
0183b4c448bf
Fix Killing the Specialists giving you a free turn after killing Desert Eagle with a desert eagle with shot 1-3
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
283 |
heroWeaponResetPending = false |
9601
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
284 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
285 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
286 |
function enemyWeapons() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
287 |
for i=1,table.getn(enemies) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
288 |
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
|
289 |
AddAmmo(enemies[i].gear, amMortar, 0) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
290 |
AddAmmo(enemies[i].gear, amFirePunch, 0) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
291 |
AddAmmo(enemies[i].gear, amDEagle, 0) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
292 |
AddAmmo(enemies[i].gear, amBazooka, 0) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
293 |
AddAmmo(enemies[i].gear, amGrenade, 0) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
294 |
AddAmmo(enemies[i].gear, enemies[i].weapon, 1) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
295 |
for w=1,table.getn(enemies[i].additionalWeapons) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
296 |
AddAmmo(enemies[i].gear, enemies[i].additionalWeapons[w], 1) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
297 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
298 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
299 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
300 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
301 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
302 |
function isHog(gear) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
303 |
local hog = false |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
304 |
for i=1,table.getn(enemies) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
305 |
if gear == enemies[i].gear then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
306 |
hog = true |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
307 |
break |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
308 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
309 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
310 |
return hog |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
311 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
312 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
313 |
function getHog(gear) |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
314 |
for i=1,table.getn(enemies) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
315 |
if gear == enemies[i].gear then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
316 |
return enemies[i] |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
317 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
318 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
319 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
320 |
|
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
321 |
function getAliveEnemiesCount() |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
322 |
local count = 0 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
323 |
for i=1,table.getn(enemies) do |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
324 |
if GetHealth(enemies[i].gear) then |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
325 |
count = count + 1 |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
326 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
327 |
end |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
328 |
return count |
6af4ca27421a
added death planet side mission
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
329 |
end |