author | Wuzzy <Wuzzy2@mail.ru> |
Mon, 12 Feb 2018 19:38:07 +0100 | |
changeset 12990 | add647b0036e |
parent 12355 | 193eba524369 |
child 13278 | 8f579173b161 |
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) |
|
12355 | 100 |
SetAmmo(amLowGravity, 1, 0, 0, 0) |
6747 | 101 |
elseif hogIndex == 6 then |
102 |
SetAmmo(amFlamethrower, 1, 0, 0, 0) |
|
103 |
SetAmmo(amMolotov, 1, 0, 0, 0) |
|
104 |
SetAmmo(amNapalm, 1, 0, 0, 0) |
|
105 |
elseif hogIndex == 7 then |
|
106 |
SetAmmo(amBaseballBat, 1, 0, 0, 0) |
|
107 |
SetAmmo(amGasBomb, 1, 0, 0, 0) |
|
108 |
SetAmmo(amKamikaze, 1, 0, 0, 0) |
|
109 |
end |
|
5277 | 110 |
|
111 |
end |
|
112 |
||
6747 | 113 |
function CreateTeam() |
5277 | 114 |
|
6747 | 115 |
currTeam = "" |
116 |
lastTeam = "" |
|
117 |
z = 0 |
|
118 |
||
119 |
for i = 0, (numhhs-1) do |
|
5277 | 120 |
|
6747 | 121 |
currTeam = GetHogTeamName(hhs[i]) |
5382 | 122 |
|
6747 | 123 |
if currTeam == lastTeam then |
124 |
z = z + 1 |
|
125 |
else |
|
126 |
z = 1 |
|
127 |
end |
|
5277 | 128 |
|
6747 | 129 |
if z == 1 then |
5277 | 130 |
|
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
131 |
SetHogName(hhs[i],loc("Soldier")) |
6747 | 132 |
SetHogHat(hhs[i], "sf_vega") |
133 |
SetHealth(hhs[i],200) |
|
134 |
||
135 |
elseif z == 2 then |
|
5382 | 136 |
|
6747 | 137 |
SetHogHat(hhs[i], "Glasses") |
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
138 |
SetHogName(hhs[i],loc("Engineer")) |
5382 | 139 |
|
6747 | 140 |
elseif z == 3 then |
5277 | 141 |
|
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
142 |
SetHogName(hhs[i],loc("Ninja")) |
6747 | 143 |
SetHogHat(hhs[i], "NinjaFull") |
144 |
SetHealth(hhs[i],80) |
|
5277 | 145 |
|
6747 | 146 |
elseif z == 4 then |
147 |
||
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
148 |
SetHogName(hhs[i],loc("Demo")) |
6747 | 149 |
SetHogHat(hhs[i], "Skull") |
150 |
SetHealth(hhs[i],200) |
|
151 |
||
152 |
elseif z == 5 then |
|
5277 | 153 |
|
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
154 |
SetHogName(hhs[i],loc("Sniper")) |
6747 | 155 |
SetHogHat(hhs[i], "Sniper") |
156 |
SetHealth(hhs[i],120) |
|
157 |
||
158 |
elseif z == 6 then |
|
159 |
||
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
160 |
SetHogName(hhs[i],loc("Saint")) |
6747 | 161 |
SetHogHat(hhs[i], "angel") |
162 |
SetHealth(hhs[i],300) |
|
5277 | 163 |
|
6747 | 164 |
elseif z == 7 then |
165 |
||
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
166 |
SetHogName(hhs[i],loc("Pyro")) |
6747 | 167 |
SetHogHat(hhs[i], "Gasmask") |
168 |
SetHealth(hhs[i],150) |
|
169 |
||
170 |
elseif z == 8 then |
|
171 |
||
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
172 |
SetHogName(hhs[i],loc("Loon")) |
6747 | 173 |
SetHogHat(hhs[i], "clown") |
174 |
SetHealth(hhs[i],100) |
|
175 |
||
176 |
end |
|
177 |
||
178 |
lastTeam = GetHogTeamName(hhs[i]) |
|
179 |
||
180 |
end |
|
5277 | 181 |
|
182 |
end |
|
183 |
||
184 |
function onGameInit() |
|
10036 | 185 |
ClearGameFlags() |
186 |
EnableGameFlags(gfRandomOrder, gfResetWeps, gfInfAttack, gfPlaceHog, gfPerHogAmmo) |
|
6747 | 187 |
Delay = 10 |
5817
70208e400a59
For now, don't spawn anything other than health crates.
mikade
parents:
5797
diff
changeset
|
188 |
HealthCaseProb = 100 |
5277 | 189 |
end |
190 |
||
191 |
function onGameStart() |
|
5382 | 192 |
|
6747 | 193 |
CreateTeam() |
5277 | 194 |
|
6747 | 195 |
ShowMission ( |
5382 | 196 |
loc("THE SPECIALISTS"), |
197 |
loc("a Hedgewars mini-game"), |
|
5277 | 198 |
|
5382 | 199 |
loc("Eliminate the enemy specialists.") .. "|" .. |
200 |
" " .. "|" .. |
|
5277 | 201 |
|
5382 | 202 |
loc("Game Modifiers: ") .. "|" .. |
203 |
loc("Per-Hog Ammo") .. "|" .. |
|
204 |
loc("Weapons Reset") .. "|" .. |
|
205 |
loc("Unlimited Attacks") .. "|" .. |
|
5277 | 206 |
|
5382 | 207 |
"", 4, 4000 |
208 |
) |
|
5277 | 209 |
|
5457 | 210 |
trackTeams() |
211 |
||
5277 | 212 |
end |
213 |
||
214 |
||
215 |
function onNewTurn() |
|
6747 | 216 |
currName = GetHogName(CurrentHedgehog) |
217 |
lastName = GetHogName(CurrentHedgehog) |
|
218 |
started = true |
|
219 |
switchStage = 0 |
|
5277 | 220 |
end |
221 |
||
7143 | 222 |
function onGameTick20() |
5277 | 223 |
|
224 |
if (CurrentHedgehog ~= nil) then |
|
225 |
||
226 |
currName = GetHogName(CurrentHedgehog) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
227 |
|
7143 | 228 |
if (currName ~= lastName) and (switchStage > 5) then |
5277 | 229 |
AddCaption(loc("Switched to ") .. currName .. "!") |
230 |
end |
|
231 |
||
7143 | 232 |
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
|
233 |
|
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
234 |
AddCaption(loc("Prepare yourself") .. ", " .. currName .. "!") |
5382 | 235 |
|
5457 | 236 |
hogCounter = 0 |
237 |
runOnHogsInTeam(CountHog, GetHogTeamName(CurrentHedgehog) ) |
|
238 |
||
239 |
if hogCounter > 1 then |
|
240 |
||
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
241 |
switchStage = switchStage + 1 |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
242 |
|
5457 | 243 |
if switchStage == 1 then |
244 |
AddAmmo(CurrentHedgehog, amSwitch, 1) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
245 |
|
5457 | 246 |
elseif switchStage == 2 then |
10289 | 247 |
SetWeapon(amSwitch) |
5457 | 248 |
elseif switchStage == 3 then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
249 |
SetGearMessage(CurrentHedgehog,gmAttack) |
5457 | 250 |
elseif switchStage == 4 then |
7143 | 251 |
switchStage = 6 |
5457 | 252 |
AddAmmo(CurrentHedgehog, amSwitch, 0) |
253 |
end |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
254 |
|
5457 | 255 |
else |
7143 | 256 |
switchStage = 6 |
5362
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
257 |
end |
5457 | 258 |
|
259 |
||
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
260 |
end |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
261 |
|
5277 | 262 |
lastName = currName |
263 |
||
264 |
end |
|
265 |
||
266 |
end |
|
267 |
||
268 |
function onGearAdd(gear) |
|
5382 | 269 |
|
6747 | 270 |
if GetGearType(gear) == gtHedgehog then |
271 |
hhs[numhhs] = gear |
|
272 |
numhhs = numhhs + 1 |
|
273 |
elseif (GetGearType(gear) == gtMine) and (started == true) then |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
274 |
SetTimer(gear,5000) |
5457 | 275 |
end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
276 |
|
5457 | 277 |
if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then |
278 |
trackGear(gear) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
279 |
end |
5457 | 280 |
|
5277 | 281 |
|
282 |
end |
|
283 |
||
284 |
function onGearDelete(gear) |
|
5457 | 285 |
if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then |
286 |
trackDeletion(gear) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
287 |
end |
5277 | 288 |
end |
289 |
||
290 |
function onAmmoStoreInit() |
|
5362
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
291 |
-- |
5277 | 292 |
end |
293 |