7568
|
1 |
----------------------------------
|
|
2 |
-- THE SPECIALISTS MODE 0.7
|
|
3 |
-- by mikade
|
|
4 |
----------------------------------
|
|
5 |
|
|
6 |
-- version history
|
|
7 |
-----------------
|
|
8 |
-- version 0.1
|
|
9 |
-----------------
|
|
10 |
-- concept test
|
|
11 |
|
|
12 |
----------------
|
|
13 |
-- version 0.2
|
|
14 |
----------------
|
|
15 |
-- added gfRandomOrder to gameflags
|
|
16 |
-- removed some deprecated variables/methods
|
|
17 |
-- fixed lack of portal reset
|
|
18 |
|
|
19 |
----------------
|
|
20 |
-- version 0.3
|
|
21 |
----------------
|
|
22 |
-- added switching on start
|
|
23 |
-- removed switch from engineer weaponset
|
|
24 |
|
|
25 |
----------------
|
|
26 |
-- version 0.4
|
|
27 |
----------------
|
|
28 |
-- Attempted to:
|
|
29 |
-- fix potential switch explit
|
|
30 |
-- improve user feedback on start
|
|
31 |
|
|
32 |
----------------
|
|
33 |
-- version 0.5
|
|
34 |
----------------
|
|
35 |
-- provision for variable minetimer / demo mines set to 5000ms
|
|
36 |
-- don't autoswitch if player only has 1 hog on his team
|
|
37 |
|
|
38 |
----------------
|
|
39 |
-- version 0.6
|
|
40 |
----------------
|
|
41 |
-- for the meanwhile, don't drop any crates except health crates
|
|
42 |
|
|
43 |
----------------
|
|
44 |
-- version 0.7
|
|
45 |
----------------
|
|
46 |
-- perhogadmsdf :D :D :D :D
|
|
47 |
|
|
48 |
--------------------
|
|
49 |
--TO DO
|
|
50 |
--------------------
|
|
51 |
|
|
52 |
-- balance hog health, maybe
|
|
53 |
-- add proper gameflag checking, maybe (so that we can throw in a .cfg and let the users break everything)
|
|
54 |
|
|
55 |
loadfile(GetDataPath() .. "Scripts/Locale.lua")()
|
|
56 |
loadfile(GetDataPath() .. "Scripts/Tracker.lua")()
|
|
57 |
|
|
58 |
local numhhs = 0
|
|
59 |
local hhs = {}
|
|
60 |
|
|
61 |
local currName
|
|
62 |
local lastName
|
|
63 |
local started = false
|
|
64 |
local switchStage = 0
|
|
65 |
|
|
66 |
local hogCounter
|
|
67 |
|
|
68 |
function CountHog(gear)
|
|
69 |
hogCounter = hogCounter +1
|
|
70 |
end
|
|
71 |
|
|
72 |
function onNewAmmoStore(groupIndex, hogIndex)
|
|
73 |
|
|
74 |
SetAmmo(amSkip, 9, 0, 0, 0)
|
|
75 |
|
|
76 |
if hogIndex == 0 then
|
|
77 |
SetAmmo(amBazooka, 1, 0, 0, 0)
|
|
78 |
SetAmmo(amGrenade, 1, 0, 0, 0)
|
|
79 |
SetAmmo(amShotgun, 1, 0, 0, 0)
|
|
80 |
elseif hogIndex == 1 then
|
|
81 |
SetAmmo(amGirder, 2, 0, 0, 0)
|
|
82 |
SetAmmo(amBlowTorch, 1, 0, 0, 0)
|
|
83 |
SetAmmo(amPickHammer, 1, 0, 0, 0)
|
|
84 |
elseif hogIndex == 2 then
|
|
85 |
SetAmmo(amRope, 9, 0, 0, 0)
|
|
86 |
SetAmmo(amParachute, 9, 0, 0, 0)
|
|
87 |
SetAmmo(amFirePunch, 1, 0, 0, 0)
|
|
88 |
elseif hogIndex == 3 then
|
|
89 |
SetAmmo(amDynamite, 1, 0, 0, 0)
|
|
90 |
SetAmmo(amMine, 1, 0, 0, 0)
|
|
91 |
SetAmmo(amDrill, 1, 0, 0, 0)
|
|
92 |
elseif hogIndex == 4 then
|
|
93 |
SetAmmo(amSniperRifle, 1, 0, 0, 0)
|
|
94 |
SetAmmo(amDEagle, 1, 0, 0, 0)
|
|
95 |
SetAmmo(amPortalGun, 2, 0, 0, 0)
|
|
96 |
elseif hogIndex == 5 then
|
|
97 |
SetAmmo(amSeduction, 9, 0, 0, 0)
|
|
98 |
SetAmmo(amResurrector, 1, 0, 0, 0)
|
|
99 |
SetAmmo(amInvulnerable, 1, 0, 0, 0)
|
|
100 |
elseif hogIndex == 6 then
|
|
101 |
SetAmmo(amFlamethrower, 1, 0, 0, 0)
|
|
102 |
SetAmmo(amMolotov, 1, 0, 0, 0)
|
|
103 |
SetAmmo(amNapalm, 1, 0, 0, 0)
|
|
104 |
elseif hogIndex == 7 then
|
|
105 |
SetAmmo(amBaseballBat, 1, 0, 0, 0)
|
|
106 |
SetAmmo(amGasBomb, 1, 0, 0, 0)
|
|
107 |
SetAmmo(amKamikaze, 1, 0, 0, 0)
|
|
108 |
end
|
|
109 |
|
|
110 |
end
|
|
111 |
|
|
112 |
function CreateTeam()
|
|
113 |
|
|
114 |
currTeam = ""
|
|
115 |
lastTeam = ""
|
|
116 |
z = 0
|
|
117 |
|
|
118 |
for i = 0, (numhhs-1) do
|
|
119 |
|
|
120 |
currTeam = GetHogTeamName(hhs[i])
|
|
121 |
|
|
122 |
if currTeam == lastTeam then
|
|
123 |
z = z + 1
|
|
124 |
else
|
|
125 |
z = 1
|
|
126 |
end
|
|
127 |
|
|
128 |
if z == 1 then
|
|
129 |
|
|
130 |
SetHogName(hhs[i],"Soldier")
|
|
131 |
SetHogHat(hhs[i], "sf_vega")
|
|
132 |
SetHealth(hhs[i],200)
|
|
133 |
|
|
134 |
elseif z == 2 then
|
|
135 |
|
|
136 |
SetHogHat(hhs[i], "Glasses")
|
|
137 |
SetHogName(hhs[i],"Engineer")
|
|
138 |
|
|
139 |
elseif z == 3 then
|
|
140 |
|
|
141 |
SetHogName(hhs[i],"Ninja")
|
|
142 |
SetHogHat(hhs[i], "NinjaFull")
|
|
143 |
SetHealth(hhs[i],80)
|
|
144 |
|
|
145 |
elseif z == 4 then
|
|
146 |
|
|
147 |
SetHogName(hhs[i],"Demo")
|
|
148 |
SetHogHat(hhs[i], "Skull")
|
|
149 |
SetHealth(hhs[i],200)
|
|
150 |
|
|
151 |
elseif z == 5 then
|
|
152 |
|
|
153 |
SetHogName(hhs[i],"Sniper")
|
|
154 |
SetHogHat(hhs[i], "Sniper")
|
|
155 |
SetHealth(hhs[i],120)
|
|
156 |
|
|
157 |
elseif z == 6 then
|
|
158 |
|
|
159 |
SetHogName(hhs[i],"Saint")
|
|
160 |
SetHogHat(hhs[i], "angel")
|
|
161 |
SetHealth(hhs[i],300)
|
|
162 |
|
|
163 |
elseif z == 7 then
|
|
164 |
|
|
165 |
SetHogName(hhs[i],"Pyro")
|
|
166 |
SetHogHat(hhs[i], "Gasmask")
|
|
167 |
SetHealth(hhs[i],150)
|
|
168 |
|
|
169 |
elseif z == 8 then
|
|
170 |
|
|
171 |
SetHogName(hhs[i],"Loon")
|
|
172 |
SetHogHat(hhs[i], "clown")
|
|
173 |
SetHealth(hhs[i],100)
|
|
174 |
|
|
175 |
end
|
|
176 |
|
|
177 |
lastTeam = GetHogTeamName(hhs[i])
|
|
178 |
|
|
179 |
end
|
|
180 |
|
|
181 |
end
|
|
182 |
|
|
183 |
function onGameInit()
|
|
184 |
GameFlags = gfRandomOrder + gfResetWeps + gfInfAttack + gfPlaceHog +gfPerHogAmmo
|
|
185 |
Delay = 10
|
|
186 |
HealthCaseProb = 100
|
|
187 |
end
|
|
188 |
|
|
189 |
function onGameStart()
|
|
190 |
|
|
191 |
CreateTeam()
|
|
192 |
|
|
193 |
ShowMission (
|
|
194 |
loc("THE SPECIALISTS"),
|
|
195 |
loc("a Hedgewars mini-game"),
|
|
196 |
|
|
197 |
loc("Eliminate the enemy specialists.") .. "|" ..
|
|
198 |
" " .. "|" ..
|
|
199 |
|
|
200 |
loc("Game Modifiers: ") .. "|" ..
|
|
201 |
loc("Per-Hog Ammo") .. "|" ..
|
|
202 |
loc("Weapons Reset") .. "|" ..
|
|
203 |
loc("Unlimited Attacks") .. "|" ..
|
|
204 |
|
|
205 |
"", 4, 4000
|
|
206 |
)
|
|
207 |
|
|
208 |
trackTeams()
|
|
209 |
|
|
210 |
end
|
|
211 |
|
|
212 |
|
|
213 |
function onNewTurn()
|
|
214 |
currName = GetHogName(CurrentHedgehog)
|
|
215 |
lastName = GetHogName(CurrentHedgehog)
|
|
216 |
started = true
|
|
217 |
switchStage = 0
|
|
218 |
end
|
|
219 |
|
|
220 |
function onGameTick20()
|
|
221 |
|
|
222 |
if (CurrentHedgehog ~= nil) then
|
|
223 |
|
|
224 |
currName = GetHogName(CurrentHedgehog)
|
|
225 |
|
|
226 |
if (currName ~= lastName) and (switchStage > 5) then
|
|
227 |
AddCaption(loc("Switched to ") .. currName .. "!")
|
|
228 |
end
|
|
229 |
|
|
230 |
if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and (switchStage < 5) then
|
|
231 |
|
|
232 |
AddCaption(loc("Prepare yourself") .. ", " .. currName .. "!")
|
|
233 |
|
|
234 |
hogCounter = 0
|
|
235 |
runOnHogsInTeam(CountHog, GetHogTeamName(CurrentHedgehog) )
|
|
236 |
|
|
237 |
if hogCounter > 1 then
|
|
238 |
|
|
239 |
switchStage = switchStage + 1
|
|
240 |
|
|
241 |
if switchStage == 1 then
|
|
242 |
AddAmmo(CurrentHedgehog, amSwitch, 1)
|
|
243 |
|
|
244 |
elseif switchStage == 2 then
|
|
245 |
ParseCommand("setweap " .. string.char(amSwitch))
|
|
246 |
elseif switchStage == 3 then
|
|
247 |
SetGearMessage(CurrentHedgehog,gmAttack)
|
|
248 |
elseif switchStage == 4 then
|
|
249 |
switchStage = 6
|
|
250 |
AddAmmo(CurrentHedgehog, amSwitch, 0)
|
|
251 |
end
|
|
252 |
|
|
253 |
else
|
|
254 |
switchStage = 6
|
|
255 |
end
|
|
256 |
|
|
257 |
|
|
258 |
end
|
|
259 |
|
|
260 |
lastName = currName
|
|
261 |
|
|
262 |
end
|
|
263 |
|
|
264 |
end
|
|
265 |
|
|
266 |
function onGearAdd(gear)
|
|
267 |
|
|
268 |
if GetGearType(gear) == gtHedgehog then
|
|
269 |
hhs[numhhs] = gear
|
|
270 |
numhhs = numhhs + 1
|
|
271 |
elseif (GetGearType(gear) == gtMine) and (started == true) then
|
|
272 |
SetTimer(gear,5000)
|
|
273 |
end
|
|
274 |
|
|
275 |
if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then
|
|
276 |
trackGear(gear)
|
|
277 |
end
|
|
278 |
|
|
279 |
|
|
280 |
end
|
|
281 |
|
|
282 |
function onGearDelete(gear)
|
|
283 |
if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then
|
|
284 |
trackDeletion(gear)
|
|
285 |
end
|
|
286 |
end
|
|
287 |
|
|
288 |
function onAmmoStoreInit()
|
|
289 |
--
|
|
290 |
end
|
|
291 |
|