author | mikade |
Mon, 31 Oct 2011 19:40:39 +0200 | |
changeset 6253 | d73317579ae4 |
parent 5827 | a416f1070fdf |
child 6747 | 3f85b103f29f |
permissions | -rw-r--r-- |
5277 | 1 |
---------------------------------- |
5817
70208e400a59
For now, don't spawn anything other than health crates.
mikade
parents:
5797
diff
changeset
|
2 |
-- THE SPECIALISTS MODE 0.6 |
5277 | 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 |
||
5362
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
19 |
---------------- |
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
20 |
-- version 0.3 |
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
21 |
---------------- |
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
22 |
-- added switching on start |
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
23 |
-- removed switch from engineer weaponset |
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
24 |
|
5382 | 25 |
---------------- |
26 |
-- version 0.4 |
|
27 |
---------------- |
|
28 |
-- Attempted to: |
|
29 |
-- fix potential switch explit |
|
30 |
-- improve user feedback on start |
|
31 |
||
5457 | 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 |
||
5817
70208e400a59
For now, don't spawn anything other than health crates.
mikade
parents:
5797
diff
changeset
|
38 |
---------------- |
70208e400a59
For now, don't spawn anything other than health crates.
mikade
parents:
5797
diff
changeset
|
39 |
-- version 0.6 |
70208e400a59
For now, don't spawn anything other than health crates.
mikade
parents:
5797
diff
changeset
|
40 |
---------------- |
70208e400a59
For now, don't spawn anything other than health crates.
mikade
parents:
5797
diff
changeset
|
41 |
-- for the meanwhile, don't drop any crates except health crates |
70208e400a59
For now, don't spawn anything other than health crates.
mikade
parents:
5797
diff
changeset
|
42 |
|
5277 | 43 |
-------------------- |
44 |
--TO DO |
|
45 |
-------------------- |
|
46 |
||
5457 | 47 |
-- balance hog health, maybe |
48 |
-- add proper gameflag checking, maybe (so that we can throw in a .cfg and let the users break everything) |
|
49 |
-- set crate drops etc. (super crate for each class? or will this ruin the mode's simplicity?) |
|
5277 | 50 |
|
51 |
loadfile(GetDataPath() .. "Scripts/Locale.lua")() |
|
5457 | 52 |
loadfile(GetDataPath() .. "Scripts/Tracker.lua")() |
5277 | 53 |
|
5382 | 54 |
local numhhs = 0 |
55 |
local hhs = {} |
|
5277 | 56 |
|
5382 | 57 |
local currName |
5277 | 58 |
local lastName |
5362
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
59 |
local started = false |
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
60 |
local switchStage = 0 |
5277 | 61 |
|
5457 | 62 |
local hogCounter |
63 |
||
64 |
function CountHog(gear) |
|
65 |
hogCounter = hogCounter +1 |
|
66 |
end |
|
67 |
||
5277 | 68 |
function CreateTeam() |
69 |
||
5382 | 70 |
currTeam = "" |
71 |
lastTeam = "" |
|
72 |
z = 0 |
|
5277 | 73 |
|
5382 | 74 |
for i = 0, (numhhs-1) do |
5277 | 75 |
|
5382 | 76 |
currTeam = GetHogTeamName(hhs[i]) |
5277 | 77 |
|
5382 | 78 |
if currTeam == lastTeam then |
79 |
z = z + 1 |
|
80 |
else |
|
81 |
z = 1 |
|
82 |
end |
|
5277 | 83 |
|
5382 | 84 |
if z == 1 then |
5277 | 85 |
|
5382 | 86 |
SetHogName(hhs[i],"Soldier") |
5797 | 87 |
SetHogHat(hhs[i], "sf_vega") |
5382 | 88 |
SetHealth(hhs[i],200) |
5277 | 89 |
|
5382 | 90 |
elseif z == 2 then |
5277 | 91 |
|
5382 | 92 |
SetHogHat(hhs[i], "Glasses") |
93 |
SetHogName(hhs[i],"Engineer") |
|
5277 | 94 |
|
5382 | 95 |
elseif z == 3 then |
5277 | 96 |
|
5382 | 97 |
SetHogName(hhs[i],"Ninja") |
98 |
SetHogHat(hhs[i], "NinjaFull") |
|
99 |
SetHealth(hhs[i],80) |
|
5277 | 100 |
|
5382 | 101 |
elseif z == 4 then |
5277 | 102 |
|
5382 | 103 |
SetHogName(hhs[i],"Demo") |
104 |
SetHogHat(hhs[i], "Skull") |
|
105 |
SetHealth(hhs[i],200) |
|
5277 | 106 |
|
5382 | 107 |
elseif z == 5 then |
5277 | 108 |
|
5382 | 109 |
SetHogName(hhs[i],"Sniper") |
110 |
SetHogHat(hhs[i], "Sniper") |
|
111 |
SetHealth(hhs[i],120) |
|
5277 | 112 |
|
5382 | 113 |
elseif z == 6 then |
5277 | 114 |
|
5382 | 115 |
SetHogName(hhs[i],"Saint") |
116 |
SetHogHat(hhs[i], "angel") |
|
117 |
SetHealth(hhs[i],300) |
|
5277 | 118 |
|
5382 | 119 |
elseif z == 7 then |
120 |
||
121 |
SetHogName(hhs[i],"Pyro") |
|
122 |
SetHogHat(hhs[i], "Gasmask") |
|
123 |
SetHealth(hhs[i],150) |
|
124 |
||
125 |
elseif z == 8 then |
|
5277 | 126 |
|
5382 | 127 |
SetHogName(hhs[i],"Loon") |
128 |
SetHogHat(hhs[i], "clown") |
|
129 |
SetHealth(hhs[i],100) |
|
5277 | 130 |
|
5382 | 131 |
end |
5277 | 132 |
|
5382 | 133 |
lastTeam = GetHogTeamName(hhs[i]) |
5277 | 134 |
|
5382 | 135 |
end |
5277 | 136 |
|
137 |
end |
|
138 |
||
139 |
function ResetAllAmmo() |
|
140 |
||
5382 | 141 |
AddAmmo(CurrentHedgehog, amBazooka, 0) |
142 |
AddAmmo(CurrentHedgehog, amGrenade, 0) |
|
143 |
AddAmmo(CurrentHedgehog, amShotgun, 0) |
|
5277 | 144 |
|
5382 | 145 |
AddAmmo(CurrentHedgehog, amGirder, 0) |
146 |
AddAmmo(CurrentHedgehog, amBlowTorch, 0) |
|
147 |
AddAmmo(CurrentHedgehog, amPickHammer, 0) |
|
148 |
AddAmmo(CurrentHedgehog, amSwitch, 0) |
|
149 |
||
150 |
AddAmmo(CurrentHedgehog, amRope, 0) |
|
151 |
AddAmmo(CurrentHedgehog, amParachute, 0) |
|
152 |
AddAmmo(CurrentHedgehog, amFirePunch, 0) |
|
5277 | 153 |
|
5382 | 154 |
AddAmmo(CurrentHedgehog, amDynamite, 0) |
155 |
AddAmmo(CurrentHedgehog, amDrill, 0) |
|
156 |
AddAmmo(CurrentHedgehog, amMine, 0) |
|
5277 | 157 |
|
5382 | 158 |
AddAmmo(CurrentHedgehog, amSniperRifle, 0) |
159 |
AddAmmo(CurrentHedgehog, amDEagle, 0) |
|
160 |
AddAmmo(CurrentHedgehog, amPortalGun, 0) |
|
5277 | 161 |
|
5382 | 162 |
AddAmmo(CurrentHedgehog, amSeduction, 0) |
163 |
AddAmmo(CurrentHedgehog, amResurrector, 0) |
|
164 |
AddAmmo(CurrentHedgehog, amInvulnerable, 0) |
|
165 |
||
166 |
AddAmmo(CurrentHedgehog, amFlamethrower, 0) |
|
167 |
AddAmmo(CurrentHedgehog, amMolotov, 0) |
|
168 |
AddAmmo(CurrentHedgehog, amNapalm, 0) |
|
169 |
||
170 |
AddAmmo(CurrentHedgehog, amBaseballBat, 0) |
|
171 |
AddAmmo(CurrentHedgehog, amGasBomb, 0) |
|
172 |
AddAmmo(CurrentHedgehog, amKamikaze, 0) |
|
5277 | 173 |
|
174 |
end |
|
175 |
||
176 |
function AssignAmmo() |
|
177 |
||
5382 | 178 |
ResetAllAmmo() |
179 |
n = GetHogName(CurrentHedgehog) |
|
5277 | 180 |
|
5382 | 181 |
AddAmmo(CurrentHedgehog, amSkip,100) |
5277 | 182 |
|
5382 | 183 |
if n == "Soldier" then |
184 |
AddAmmo(CurrentHedgehog, amBazooka,1) |
|
185 |
AddAmmo(CurrentHedgehog, amGrenade,1) |
|
186 |
AddAmmo(CurrentHedgehog, amShotgun,1) |
|
187 |
elseif n == "Engineer" then |
|
188 |
AddAmmo(CurrentHedgehog, amGirder, 2) |
|
189 |
AddAmmo(CurrentHedgehog, amBlowTorch, 1) |
|
190 |
AddAmmo(CurrentHedgehog, amPickHammer, 1) |
|
191 |
elseif n == "Ninja" then |
|
192 |
AddAmmo(CurrentHedgehog, amRope, 100) |
|
193 |
AddAmmo(CurrentHedgehog, amParachute, 100) |
|
194 |
AddAmmo(CurrentHedgehog, amFirePunch, 1) |
|
195 |
elseif n == "Demo" then |
|
196 |
AddAmmo(CurrentHedgehog, amDynamite, 1) |
|
197 |
AddAmmo(CurrentHedgehog, amMine, 1) |
|
198 |
AddAmmo(CurrentHedgehog, amDrill, 1) |
|
199 |
elseif n == "Sniper" then |
|
200 |
AddAmmo(CurrentHedgehog, amSniperRifle, 1) |
|
201 |
AddAmmo(CurrentHedgehog, amDEagle, 1) |
|
202 |
AddAmmo(CurrentHedgehog, amPortalGun, 2) |
|
203 |
elseif n == "Saint" then |
|
204 |
AddAmmo(CurrentHedgehog, amSeduction, 100) |
|
205 |
AddAmmo(CurrentHedgehog, amResurrector, 1) |
|
206 |
AddAmmo(CurrentHedgehog, amInvulnerable, 1) |
|
207 |
elseif n == "Pyro" then |
|
208 |
AddAmmo(CurrentHedgehog, amFlamethrower, 1) |
|
209 |
AddAmmo(CurrentHedgehog, amMolotov, 1) |
|
210 |
AddAmmo(CurrentHedgehog, amNapalm, 1) |
|
211 |
elseif n == "Loon" then |
|
212 |
AddAmmo(CurrentHedgehog, amBaseballBat, 1) |
|
213 |
AddAmmo(CurrentHedgehog, amGasBomb, 1) |
|
214 |
AddAmmo(CurrentHedgehog, amKamikaze, 1) |
|
215 |
end |
|
5277 | 216 |
|
217 |
end |
|
218 |
||
219 |
function onGameInit() |
|
5382 | 220 |
GameFlags = gfRandomOrder + gfResetWeps + gfInfAttack + gfPlaceHog |
221 |
Delay = 10 |
|
5817
70208e400a59
For now, don't spawn anything other than health crates.
mikade
parents:
5797
diff
changeset
|
222 |
HealthCaseProb = 100 |
5277 | 223 |
end |
224 |
||
225 |
function onGameStart() |
|
5382 | 226 |
|
227 |
CreateTeam() |
|
5277 | 228 |
|
5382 | 229 |
ShowMission ( |
230 |
loc("THE SPECIALISTS"), |
|
231 |
loc("a Hedgewars mini-game"), |
|
5277 | 232 |
|
5382 | 233 |
loc("Eliminate the enemy specialists.") .. "|" .. |
234 |
" " .. "|" .. |
|
5277 | 235 |
|
5382 | 236 |
loc("Game Modifiers: ") .. "|" .. |
237 |
loc("Per-Hog Ammo") .. "|" .. |
|
238 |
loc("Weapons Reset") .. "|" .. |
|
239 |
loc("Unlimited Attacks") .. "|" .. |
|
5277 | 240 |
|
5382 | 241 |
"", 4, 4000 |
242 |
) |
|
5277 | 243 |
|
5457 | 244 |
trackTeams() |
245 |
||
5277 | 246 |
end |
247 |
||
248 |
||
249 |
function onNewTurn() |
|
5382 | 250 |
currName = GetHogName(CurrentHedgehog) |
251 |
lastName = GetHogName(CurrentHedgehog) |
|
252 |
AssignAmmo() |
|
5457 | 253 |
started = true |
5382 | 254 |
switchStage = 0 |
5277 | 255 |
end |
256 |
||
257 |
function onGameTick() |
|
258 |
||
259 |
if (CurrentHedgehog ~= nil) then |
|
260 |
||
261 |
currName = GetHogName(CurrentHedgehog) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
262 |
|
5382 | 263 |
if (currName ~= lastName) and (switchStage > 100) then |
5277 | 264 |
AddCaption(loc("Switched to ") .. currName .. "!") |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
265 |
AssignAmmo() |
5277 | 266 |
end |
267 |
||
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
268 |
if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and (switchStage < 100) then |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
269 |
|
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
270 |
AddCaption(loc("Prepare yourself") .. ", " .. currName .. "!") |
5382 | 271 |
|
5457 | 272 |
hogCounter = 0 |
273 |
runOnHogsInTeam(CountHog, GetHogTeamName(CurrentHedgehog) ) |
|
274 |
||
275 |
if hogCounter > 1 then |
|
276 |
||
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
277 |
switchStage = switchStage + 1 |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
278 |
|
5457 | 279 |
if switchStage == 1 then |
280 |
AddAmmo(CurrentHedgehog, amSwitch, 1) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
281 |
|
5457 | 282 |
elseif switchStage == 2 then |
283 |
ParseCommand("setweap " .. string.char(amSwitch)) |
|
284 |
elseif switchStage == 3 then |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
285 |
SetGearMessage(CurrentHedgehog,gmAttack) |
5457 | 286 |
elseif switchStage == 4 then |
287 |
switchStage = 110 |
|
288 |
AddAmmo(CurrentHedgehog, amSwitch, 0) |
|
289 |
end |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
290 |
|
5457 | 291 |
else |
5362
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
292 |
switchStage = 110 |
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
293 |
end |
5457 | 294 |
|
295 |
||
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
296 |
end |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
297 |
|
5277 | 298 |
lastName = currName |
299 |
||
300 |
end |
|
301 |
||
302 |
end |
|
303 |
||
304 |
function onGearAdd(gear) |
|
5382 | 305 |
|
306 |
if GetGearType(gear) == gtHedgehog then |
|
307 |
hhs[numhhs] = gear |
|
308 |
numhhs = numhhs + 1 |
|
5457 | 309 |
elseif (GetGearType(gear) == gtMine) and (started == true) then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
310 |
SetTimer(gear,5000) |
5457 | 311 |
end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
312 |
|
5457 | 313 |
if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then |
314 |
trackGear(gear) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
315 |
end |
5457 | 316 |
|
5277 | 317 |
|
318 |
end |
|
319 |
||
320 |
function onGearDelete(gear) |
|
5457 | 321 |
if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then |
322 |
trackDeletion(gear) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
323 |
end |
5277 | 324 |
end |
325 |
||
326 |
function onAmmoStoreInit() |
|
5362
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
327 |
-- |
5277 | 328 |
end |
329 |