author | nemo |
Sat, 20 Dec 2014 16:20:37 -0500 | |
changeset 10696 | 173069dd7b17 |
parent 10289 | c3a77ff02a23 |
child 11301 | fa18940f290d |
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() |
|
10036 | 184 |
ClearGameFlags() |
185 |
EnableGameFlags(gfRandomOrder, gfResetWeps, gfInfAttack, gfPlaceHog, gfPerHogAmmo) |
|
6747 | 186 |
Delay = 10 |
5817
70208e400a59
For now, don't spawn anything other than health crates.
mikade
parents:
5797
diff
changeset
|
187 |
HealthCaseProb = 100 |
5277 | 188 |
end |
189 |
||
190 |
function onGameStart() |
|
5382 | 191 |
|
6747 | 192 |
CreateTeam() |
5277 | 193 |
|
6747 | 194 |
ShowMission ( |
5382 | 195 |
loc("THE SPECIALISTS"), |
196 |
loc("a Hedgewars mini-game"), |
|
5277 | 197 |
|
5382 | 198 |
loc("Eliminate the enemy specialists.") .. "|" .. |
199 |
" " .. "|" .. |
|
5277 | 200 |
|
5382 | 201 |
loc("Game Modifiers: ") .. "|" .. |
202 |
loc("Per-Hog Ammo") .. "|" .. |
|
203 |
loc("Weapons Reset") .. "|" .. |
|
204 |
loc("Unlimited Attacks") .. "|" .. |
|
5277 | 205 |
|
5382 | 206 |
"", 4, 4000 |
207 |
) |
|
5277 | 208 |
|
5457 | 209 |
trackTeams() |
210 |
||
5277 | 211 |
end |
212 |
||
213 |
||
214 |
function onNewTurn() |
|
6747 | 215 |
currName = GetHogName(CurrentHedgehog) |
216 |
lastName = GetHogName(CurrentHedgehog) |
|
217 |
started = true |
|
218 |
switchStage = 0 |
|
5277 | 219 |
end |
220 |
||
7143 | 221 |
function onGameTick20() |
5277 | 222 |
|
223 |
if (CurrentHedgehog ~= nil) then |
|
224 |
||
225 |
currName = GetHogName(CurrentHedgehog) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
226 |
|
7143 | 227 |
if (currName ~= lastName) and (switchStage > 5) then |
5277 | 228 |
AddCaption(loc("Switched to ") .. currName .. "!") |
229 |
end |
|
230 |
||
7143 | 231 |
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
|
232 |
|
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
233 |
AddCaption(loc("Prepare yourself") .. ", " .. currName .. "!") |
5382 | 234 |
|
5457 | 235 |
hogCounter = 0 |
236 |
runOnHogsInTeam(CountHog, GetHogTeamName(CurrentHedgehog) ) |
|
237 |
||
238 |
if hogCounter > 1 then |
|
239 |
||
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
240 |
switchStage = switchStage + 1 |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
241 |
|
5457 | 242 |
if switchStage == 1 then |
243 |
AddAmmo(CurrentHedgehog, amSwitch, 1) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
244 |
|
5457 | 245 |
elseif switchStage == 2 then |
10289 | 246 |
SetWeapon(amSwitch) |
5457 | 247 |
elseif switchStage == 3 then |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
248 |
SetGearMessage(CurrentHedgehog,gmAttack) |
5457 | 249 |
elseif switchStage == 4 then |
7143 | 250 |
switchStage = 6 |
5457 | 251 |
AddAmmo(CurrentHedgehog, amSwitch, 0) |
252 |
end |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
253 |
|
5457 | 254 |
else |
7143 | 255 |
switchStage = 6 |
5362
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
256 |
end |
5457 | 257 |
|
258 |
||
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
259 |
end |
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
260 |
|
5277 | 261 |
lastName = currName |
262 |
||
263 |
end |
|
264 |
||
265 |
end |
|
266 |
||
267 |
function onGearAdd(gear) |
|
5382 | 268 |
|
6747 | 269 |
if GetGearType(gear) == gtHedgehog then |
270 |
hhs[numhhs] = gear |
|
271 |
numhhs = numhhs + 1 |
|
272 |
elseif (GetGearType(gear) == gtMine) and (started == true) then |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
273 |
SetTimer(gear,5000) |
5457 | 274 |
end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
275 |
|
5457 | 276 |
if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then |
277 |
trackGear(gear) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
278 |
end |
5457 | 279 |
|
5277 | 280 |
|
281 |
end |
|
282 |
||
283 |
function onGearDelete(gear) |
|
5457 | 284 |
if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then |
285 |
trackDeletion(gear) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
286 |
end |
5277 | 287 |
end |
288 |
||
289 |
function onAmmoStoreInit() |
|
5362
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
290 |
-- |
5277 | 291 |
end |
292 |