author | nemo |
Sat, 05 Jan 2019 13:23:43 -0500 | |
changeset 14521 | f5487302d53b |
parent 14406 | 6c21bd8547dd |
child 14522 | 2fd8f4cd3aa4 |
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") |
|
14521 | 57 |
HedgewarsScriptLoad("/Scripts/Params.lua") |
58 |
||
59 |
-- S=(S)oldier D=(D)emo E=(E)ngineer N=(N)inja P=(P)yro C=(C)lown H=(H)olyman[saint] X=Sniper [running out of letters, but X-out or X-hair or something] |
|
60 |
-- default team values |
|
61 |
local currTeamIdx = 0; |
|
62 |
local teamRoles = |
|
63 |
{ |
|
64 |
{'S','E','N','D','X','H','P','C'}, |
|
65 |
{'S','E','N','D','X','H','P','C'}, |
|
66 |
{'S','E','N','D','X','H','P','C'}, |
|
67 |
{'S','E','N','D','X','H','P','C'}, |
|
68 |
{'S','E','N','D','X','H','P','C'}, |
|
69 |
{'S','E','N','D','X','H','P','C'}, |
|
70 |
{'S','E','N','D','X','H','P','C'}, |
|
71 |
{'S','E','N','D','X','H','P','C'} |
|
72 |
}; |
|
5277 | 73 |
|
5382 | 74 |
local numhhs = 0 |
75 |
local hhs = {} |
|
5277 | 76 |
|
5362
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
77 |
local started = false |
5457 | 78 |
|
14521 | 79 |
function onParameters() |
80 |
parseParams() |
|
81 |
for i = 1, 8 do |
|
82 |
if params['t'..i] ~= nil then |
|
83 |
for j = 1, 8 do |
|
84 |
if string.len(params['t'..i]) >= j then |
|
85 |
teamRoles[i][j] = string.upper(string.sub(params['t'..i],j,j)); |
|
86 |
end |
|
87 |
end |
|
88 |
end |
|
89 |
end |
|
90 |
end |
|
91 |
||
6747 | 92 |
function onNewAmmoStore(groupIndex, hogIndex) |
5277 | 93 |
|
6747 | 94 |
SetAmmo(amSkip, 9, 0, 0, 0) |
14521 | 95 |
groupIndex = groupIndex + 1 |
96 |
hogIndex = hogIndex + 1 |
|
5277 | 97 |
|
14521 | 98 |
if teamRoles[groupIndex][hogIndex] == 'S' then |
6747 | 99 |
SetAmmo(amBazooka, 1, 0, 0, 0) |
100 |
SetAmmo(amGrenade, 1, 0, 0, 0) |
|
101 |
SetAmmo(amShotgun, 1, 0, 0, 0) |
|
14521 | 102 |
elseif teamRoles[groupIndex][hogIndex] == 'E' then |
6747 | 103 |
SetAmmo(amGirder, 2, 0, 0, 0) |
104 |
SetAmmo(amBlowTorch, 1, 0, 0, 0) |
|
105 |
SetAmmo(amPickHammer, 1, 0, 0, 0) |
|
14521 | 106 |
elseif teamRoles[groupIndex][hogIndex] == 'N' then |
6747 | 107 |
SetAmmo(amRope, 9, 0, 0, 0) |
108 |
SetAmmo(amParachute, 9, 0, 0, 0) |
|
109 |
SetAmmo(amFirePunch, 1, 0, 0, 0) |
|
14521 | 110 |
elseif teamRoles[groupIndex][hogIndex] == 'D' then |
6747 | 111 |
SetAmmo(amDynamite, 1, 0, 0, 0) |
112 |
SetAmmo(amMine, 1, 0, 0, 0) |
|
113 |
SetAmmo(amDrill, 1, 0, 0, 0) |
|
14521 | 114 |
elseif teamRoles[groupIndex][hogIndex] == 'X' then |
6747 | 115 |
SetAmmo(amSniperRifle, 1, 0, 0, 0) |
116 |
SetAmmo(amDEagle, 1, 0, 0, 0) |
|
117 |
SetAmmo(amPortalGun, 2, 0, 0, 0) |
|
14521 | 118 |
elseif teamRoles[groupIndex][hogIndex] == 'H' then |
6747 | 119 |
SetAmmo(amSeduction, 9, 0, 0, 0) |
120 |
SetAmmo(amResurrector, 1, 0, 0, 0) |
|
121 |
SetAmmo(amInvulnerable, 1, 0, 0, 0) |
|
12355 | 122 |
SetAmmo(amLowGravity, 1, 0, 0, 0) |
14521 | 123 |
elseif teamRoles[groupIndex][hogIndex] == 'P' then |
6747 | 124 |
SetAmmo(amFlamethrower, 1, 0, 0, 0) |
125 |
SetAmmo(amMolotov, 1, 0, 0, 0) |
|
126 |
SetAmmo(amNapalm, 1, 0, 0, 0) |
|
14521 | 127 |
elseif teamRoles[groupIndex][hogIndex] == 'C' then |
6747 | 128 |
SetAmmo(amBaseballBat, 1, 0, 0, 0) |
129 |
SetAmmo(amGasBomb, 1, 0, 0, 0) |
|
130 |
SetAmmo(amKamikaze, 1, 0, 0, 0) |
|
131 |
end |
|
5277 | 132 |
|
133 |
end |
|
134 |
||
6747 | 135 |
function CreateTeam() |
5277 | 136 |
|
6747 | 137 |
currTeam = "" |
138 |
lastTeam = "" |
|
139 |
z = 0 |
|
140 |
||
141 |
for i = 0, (numhhs-1) do |
|
5277 | 142 |
|
6747 | 143 |
currTeam = GetHogTeamName(hhs[i]) |
5382 | 144 |
|
6747 | 145 |
if currTeam == lastTeam then |
146 |
z = z + 1 |
|
147 |
else |
|
148 |
z = 1 |
|
14521 | 149 |
currTeamIdx = currTeamIdx + 1; |
6747 | 150 |
end |
5277 | 151 |
|
14521 | 152 |
if teamRoles[currTeamIdx][z] == 'S' then |
5277 | 153 |
|
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
154 |
SetHogName(hhs[i],loc("Soldier")) |
6747 | 155 |
SetHogHat(hhs[i], "sf_vega") |
156 |
SetHealth(hhs[i],200) |
|
157 |
||
14521 | 158 |
elseif teamRoles[currTeamIdx][z] == 'E' then |
5382 | 159 |
|
6747 | 160 |
SetHogHat(hhs[i], "Glasses") |
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
161 |
SetHogName(hhs[i],loc("Engineer")) |
5382 | 162 |
|
14521 | 163 |
elseif teamRoles[currTeamIdx][z] == 'N' then |
5277 | 164 |
|
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
165 |
SetHogName(hhs[i],loc("Ninja")) |
6747 | 166 |
SetHogHat(hhs[i], "NinjaFull") |
167 |
SetHealth(hhs[i],80) |
|
5277 | 168 |
|
14521 | 169 |
elseif teamRoles[currTeamIdx][z] == 'D' then |
6747 | 170 |
|
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
171 |
SetHogName(hhs[i],loc("Demo")) |
6747 | 172 |
SetHogHat(hhs[i], "Skull") |
173 |
SetHealth(hhs[i],200) |
|
174 |
||
14521 | 175 |
elseif teamRoles[currTeamIdx][z] == 'X' then |
5277 | 176 |
|
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
177 |
SetHogName(hhs[i],loc("Sniper")) |
6747 | 178 |
SetHogHat(hhs[i], "Sniper") |
179 |
SetHealth(hhs[i],120) |
|
180 |
||
14521 | 181 |
elseif teamRoles[currTeamIdx][z] == 'H' then |
6747 | 182 |
|
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
183 |
SetHogName(hhs[i],loc("Saint")) |
6747 | 184 |
SetHogHat(hhs[i], "angel") |
185 |
SetHealth(hhs[i],300) |
|
5277 | 186 |
|
14521 | 187 |
elseif teamRoles[currTeamIdx][z] == 'P' then |
6747 | 188 |
|
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
189 |
SetHogName(hhs[i],loc("Pyro")) |
6747 | 190 |
SetHogHat(hhs[i], "Gasmask") |
191 |
SetHealth(hhs[i],150) |
|
192 |
||
14521 | 193 |
elseif teamRoles[currTeamIdx][z] == 'C' then |
6747 | 194 |
|
11301
fa18940f290d
- Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents:
10289
diff
changeset
|
195 |
SetHogName(hhs[i],loc("Loon")) |
6747 | 196 |
SetHogHat(hhs[i], "clown") |
197 |
SetHealth(hhs[i],100) |
|
198 |
||
199 |
end |
|
200 |
||
201 |
lastTeam = GetHogTeamName(hhs[i]) |
|
202 |
||
203 |
end |
|
5277 | 204 |
|
205 |
end |
|
206 |
||
207 |
function onGameInit() |
|
10036 | 208 |
ClearGameFlags() |
14521 | 209 |
EnableGameFlags(gfResetWeps, gfInfAttack, gfPlaceHog, gfPerHogAmmo, gfSwitchHog) |
5817
70208e400a59
For now, don't spawn anything other than health crates.
mikade
parents:
5797
diff
changeset
|
210 |
HealthCaseProb = 100 |
5277 | 211 |
end |
212 |
||
213 |
function onGameStart() |
|
5382 | 214 |
|
6747 | 215 |
CreateTeam() |
5277 | 216 |
|
6747 | 217 |
ShowMission ( |
5382 | 218 |
loc("THE SPECIALISTS"), |
219 |
loc("a Hedgewars mini-game"), |
|
5277 | 220 |
|
5382 | 221 |
loc("Eliminate the enemy specialists.") .. "|" .. |
222 |
" " .. "|" .. |
|
5277 | 223 |
|
5382 | 224 |
loc("Game Modifiers: ") .. "|" .. |
225 |
loc("Per-Hog Ammo") .. "|" .. |
|
226 |
loc("Weapons Reset") .. "|" .. |
|
227 |
loc("Unlimited Attacks") .. "|" .. |
|
5277 | 228 |
|
5382 | 229 |
"", 4, 4000 |
230 |
) |
|
5277 | 231 |
|
5457 | 232 |
trackTeams() |
233 |
||
5277 | 234 |
end |
235 |
||
236 |
||
237 |
function onNewTurn() |
|
13278
8f579173b161
The Specialits: Use gfSwitchHog for hog switching and delete the terrible Lua hacks
Wuzzy <Wuzzy2@mail.ru>
parents:
12355
diff
changeset
|
238 |
|
6747 | 239 |
started = true |
13278
8f579173b161
The Specialits: Use gfSwitchHog for hog switching and delete the terrible Lua hacks
Wuzzy <Wuzzy2@mail.ru>
parents:
12355
diff
changeset
|
240 |
AddCaption(loc("Prepare yourself") .. ", " .. GetHogName(CurrentHedgehog).. "!") |
5277 | 241 |
|
242 |
end |
|
243 |
||
244 |
function onGearAdd(gear) |
|
5382 | 245 |
|
6747 | 246 |
if GetGearType(gear) == gtHedgehog then |
247 |
hhs[numhhs] = gear |
|
248 |
numhhs = numhhs + 1 |
|
249 |
elseif (GetGearType(gear) == gtMine) and (started == true) then |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
250 |
SetTimer(gear,5000) |
5457 | 251 |
end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
252 |
|
5457 | 253 |
if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then |
254 |
trackGear(gear) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
255 |
end |
5457 | 256 |
|
5277 | 257 |
end |
258 |
||
259 |
function onGearDelete(gear) |
|
5457 | 260 |
if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then |
261 |
trackDeletion(gear) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
262 |
end |
5277 | 263 |
end |
264 |