author | unc0rr |
Sun, 25 Nov 2012 01:13:51 +0400 | |
branch | flibqtfrontend |
changeset 8100 | 0e6fadf81a2c |
parent 8043 | da083f8d95e6 |
child 10036 | 3be36d2fdca6 |
permissions | -rw-r--r-- |
5277 | 1 |
---------------------------------- |
6747 | 2 |
-- THE SPECIALISTS MODE 0.7 |
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 |
|
6747 | 43 |
---------------- |
44 |
-- version 0.7 |
|
45 |
---------------- |
|
46 |
-- perhogadmsdf :D :D :D :D |
|
47 |
||
5277 | 48 |
-------------------- |
49 |
--TO DO |
|
50 |
-------------------- |
|
51 |
||
5457 | 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) |
|
5277 | 54 |
|
8043 | 55 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
56 |
HedgewarsScriptLoad("/Scripts/Tracker.lua") |
|
5277 | 57 |
|
5382 | 58 |
local numhhs = 0 |
59 |
local hhs = {} |
|
5277 | 60 |
|
5382 | 61 |
local currName |
5277 | 62 |
local lastName |
5362
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
63 |
local started = false |
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
64 |
local switchStage = 0 |
5277 | 65 |
|
5457 | 66 |
local hogCounter |
67 |
||
68 |
function CountHog(gear) |
|
69 |
hogCounter = hogCounter +1 |
|
70 |
end |
|
71 |
||
6747 | 72 |
function onNewAmmoStore(groupIndex, hogIndex) |
5277 | 73 |
|
6747 | 74 |
SetAmmo(amSkip, 9, 0, 0, 0) |
5277 | 75 |
|
6747 | 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 |
|
5277 | 109 |
|
110 |
end |
|
111 |
||
6747 | 112 |
function CreateTeam() |
5277 | 113 |
|
6747 | 114 |
currTeam = "" |
115 |
lastTeam = "" |
|
116 |
z = 0 |
|
117 |
||
118 |
for i = 0, (numhhs-1) do |
|
5277 | 119 |
|
6747 | 120 |
currTeam = GetHogTeamName(hhs[i]) |
5382 | 121 |
|
6747 | 122 |
if currTeam == lastTeam then |
123 |
z = z + 1 |
|
124 |
else |
|
125 |
z = 1 |
|
126 |
end |
|
5277 | 127 |
|
6747 | 128 |
if z == 1 then |
5277 | 129 |
|
6747 | 130 |
SetHogName(hhs[i],"Soldier") |
131 |
SetHogHat(hhs[i], "sf_vega") |
|
132 |
SetHealth(hhs[i],200) |
|
133 |
||
134 |
elseif z == 2 then |
|
5382 | 135 |
|
6747 | 136 |
SetHogHat(hhs[i], "Glasses") |
137 |
SetHogName(hhs[i],"Engineer") |
|
5382 | 138 |
|
6747 | 139 |
elseif z == 3 then |
5277 | 140 |
|
6747 | 141 |
SetHogName(hhs[i],"Ninja") |
142 |
SetHogHat(hhs[i], "NinjaFull") |
|
143 |
SetHealth(hhs[i],80) |
|
5277 | 144 |
|
6747 | 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 |
|
5277 | 152 |
|
6747 | 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) |
|
5277 | 162 |
|
6747 | 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 |
|
5277 | 180 |
|
181 |
end |
|
182 |
||
183 |
function onGameInit() |
|
6747 | 184 |
GameFlags = gfRandomOrder + gfResetWeps + gfInfAttack + gfPlaceHog +gfPerHogAmmo |
185 |
Delay = 10 |
|
5817
70208e400a59
For now, don't spawn anything other than health crates.
mikade
parents:
5797
diff
changeset
|
186 |
HealthCaseProb = 100 |
5277 | 187 |
end |
188 |
||
189 |
function onGameStart() |
|
5382 | 190 |
|
6747 | 191 |
CreateTeam() |
5277 | 192 |
|
6747 | 193 |
ShowMission ( |
5382 | 194 |
loc("THE SPECIALISTS"), |
195 |
loc("a Hedgewars mini-game"), |
|
5277 | 196 |
|
5382 | 197 |
loc("Eliminate the enemy specialists.") .. "|" .. |
198 |
" " .. "|" .. |
|
5277 | 199 |
|
5382 | 200 |
loc("Game Modifiers: ") .. "|" .. |
201 |
loc("Per-Hog Ammo") .. "|" .. |
|
202 |
loc("Weapons Reset") .. "|" .. |
|
203 |
loc("Unlimited Attacks") .. "|" .. |
|
5277 | 204 |
|
5382 | 205 |
"", 4, 4000 |
206 |
) |
|
5277 | 207 |
|
5457 | 208 |
trackTeams() |
209 |
||
5277 | 210 |
end |
211 |
||
212 |
||
213 |
function onNewTurn() |
|
6747 | 214 |
currName = GetHogName(CurrentHedgehog) |
215 |
lastName = GetHogName(CurrentHedgehog) |
|
216 |
started = true |
|
217 |
switchStage = 0 |
|
5277 | 218 |
end |
219 |
||
7143 | 220 |
function onGameTick20() |
5277 | 221 |
|
222 |
if (CurrentHedgehog ~= nil) then |
|
223 |
||
224 |
currName = GetHogName(CurrentHedgehog) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
225 |
|
7143 | 226 |
if (currName ~= lastName) and (switchStage > 5) then |
5277 | 227 |
AddCaption(loc("Switched to ") .. currName .. "!") |
228 |
end |
|
229 |
||
7143 | 230 |
if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and (switchStage < 5) then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
231 |
|
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
232 |
AddCaption(loc("Prepare yourself") .. ", " .. currName .. "!") |
5382 | 233 |
|
5457 | 234 |
hogCounter = 0 |
235 |
runOnHogsInTeam(CountHog, GetHogTeamName(CurrentHedgehog) ) |
|
236 |
||
237 |
if hogCounter > 1 then |
|
238 |
||
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
239 |
switchStage = switchStage + 1 |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
240 |
|
5457 | 241 |
if switchStage == 1 then |
242 |
AddAmmo(CurrentHedgehog, amSwitch, 1) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
243 |
|
5457 | 244 |
elseif switchStage == 2 then |
245 |
ParseCommand("setweap " .. string.char(amSwitch)) |
|
246 |
elseif switchStage == 3 then |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
247 |
SetGearMessage(CurrentHedgehog,gmAttack) |
5457 | 248 |
elseif switchStage == 4 then |
7143 | 249 |
switchStage = 6 |
5457 | 250 |
AddAmmo(CurrentHedgehog, amSwitch, 0) |
251 |
end |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
252 |
|
5457 | 253 |
else |
7143 | 254 |
switchStage = 6 |
5362
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
255 |
end |
5457 | 256 |
|
257 |
||
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
258 |
end |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
259 |
|
5277 | 260 |
lastName = currName |
261 |
||
262 |
end |
|
263 |
||
264 |
end |
|
265 |
||
266 |
function onGearAdd(gear) |
|
5382 | 267 |
|
6747 | 268 |
if GetGearType(gear) == gtHedgehog then |
269 |
hhs[numhhs] = gear |
|
270 |
numhhs = numhhs + 1 |
|
271 |
elseif (GetGearType(gear) == gtMine) and (started == true) then |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
272 |
SetTimer(gear,5000) |
5457 | 273 |
end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
274 |
|
5457 | 275 |
if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then |
276 |
trackGear(gear) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
277 |
end |
5457 | 278 |
|
5277 | 279 |
|
280 |
end |
|
281 |
||
282 |
function onGearDelete(gear) |
|
5457 | 283 |
if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then |
284 |
trackDeletion(gear) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
285 |
end |
5277 | 286 |
end |
287 |
||
288 |
function onAmmoStoreInit() |
|
5362
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
289 |
-- |
5277 | 290 |
end |
291 |