author | Wuzzy <Wuzzy2@mail.ru> |
Sat, 12 Jan 2019 06:19:16 +0100 | |
changeset 14579 | 90c215f83273 |
parent 14544 | e176bf229649 |
permissions | -rw-r--r-- |
5277 | 1 |
---------------------------------- |
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
2 |
-- THE SPECIALISTS |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
3 |
-- original style by mikade |
5277 | 4 |
---------------------------------- |
5 |
||
14539
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
6 |
-- SCRIPT PARAMETER SYNTAX |
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
7 |
--[[ |
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
8 |
With the script parameter, you can change the order of specialists per team. |
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
9 |
|
14540
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
10 |
== Changing the specialists for all teams == |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
11 |
In the script parameter, put: |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
12 |
|
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
13 |
t=XXXXXXXX |
14539
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
14 |
|
14540
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
15 |
Where 'X' is a “specialist letter” (see below). Each letter stands for |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
16 |
the role of a hedgehog in the team (in that order). |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
17 |
If you leave out a letter, that hedgehog will be the default. |
14539
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
18 |
|
14540
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
19 |
== Changing the specialists for on a per-team basis == |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
20 |
Same as above, but instead of “t”, you use “t1”, “t2”, ... “t8” for |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
21 |
each of the teams (team 1 to team 8). |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
22 |
|
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
23 |
== Specialist letters == |
14539
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
24 |
|
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
25 |
S = Soldier |
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
26 |
E = Engineer |
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
27 |
N = Ninja |
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
28 |
D = Demo |
14579
90c215f83273
TS: Restore 2 of the "specialist" letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14544
diff
changeset
|
29 |
X = Sniper |
90c215f83273
TS: Restore 2 of the "specialist" letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14544
diff
changeset
|
30 |
H = Saint |
14539
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
31 |
P = Pyro |
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
32 |
L = Loon |
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
33 |
|
14540
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
34 |
== Examples == |
14539
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
35 |
Example 1: |
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
36 |
|
14540
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
37 |
t=SSSSPPPP |
14539
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
38 |
|
14540
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
39 |
4 soldiers and 4 pyros for all teams. |
14539
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
40 |
|
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
41 |
Example 2: |
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
42 |
|
14579
90c215f83273
TS: Restore 2 of the "specialist" letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14544
diff
changeset
|
43 |
t1=LPHXDNES,t2=NNNNNNNN |
14539
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
44 |
|
14540
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
45 |
Team 1: Loon, Pyro, Saint, Sniper, Demo, Ninja, Engineer, Soldier. |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
46 |
Team 2: All-ninja team. |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
47 |
All other teams use the default settings. |
14539
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
48 |
|
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
49 |
]] |
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
50 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
51 |
-------------------- |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
52 |
-- TODO |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
53 |
-------------------- |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
54 |
-- add proper gameflag checking, maybe (so that we can throw in a .cfg and let the users break everything) |
5362
5f0c46e78e50
Enable autoswitch on turn start for The Specialists Mode.
mikade
parents:
5277
diff
changeset
|
55 |
|
5277 | 56 |
|
8043 | 57 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
58 |
HedgewarsScriptLoad("/Scripts/Tracker.lua") |
|
14537 | 59 |
HedgewarsScriptLoad("/Scripts/Params.lua") |
60 |
||
61 |
-- default team values |
|
62 |
local currTeamIdx = 0; |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
63 |
local teamRoles = { |
14579
90c215f83273
TS: Restore 2 of the "specialist" letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14544
diff
changeset
|
64 |
{'S','E','N','D','X','H','P','L'}, |
90c215f83273
TS: Restore 2 of the "specialist" letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14544
diff
changeset
|
65 |
{'S','E','N','D','X','H','P','L'}, |
90c215f83273
TS: Restore 2 of the "specialist" letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14544
diff
changeset
|
66 |
{'S','E','N','D','X','H','P','L'}, |
90c215f83273
TS: Restore 2 of the "specialist" letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14544
diff
changeset
|
67 |
{'S','E','N','D','X','H','P','L'}, |
90c215f83273
TS: Restore 2 of the "specialist" letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14544
diff
changeset
|
68 |
{'S','E','N','D','X','H','P','L'}, |
90c215f83273
TS: Restore 2 of the "specialist" letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14544
diff
changeset
|
69 |
{'S','E','N','D','X','H','P','L'}, |
90c215f83273
TS: Restore 2 of the "specialist" letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14544
diff
changeset
|
70 |
{'S','E','N','D','X','H','P','L'}, |
90c215f83273
TS: Restore 2 of the "specialist" letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14544
diff
changeset
|
71 |
{'S','E','N','D','X','H','P','L'} |
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
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 |
|
14537 | 79 |
function onParameters() |
80 |
parseParams() |
|
14540
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
81 |
-- All teams |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
82 |
if params['t'] ~= nil then |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
83 |
for i = 1, 8 do |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
84 |
for j = 1, 8 do |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
85 |
if string.len(params['t']) >= j then |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
86 |
teamRoles[i][j] = string.upper(string.sub(params['t'],j,j)); |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
87 |
end |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
88 |
end |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
89 |
end |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
90 |
end |
213a636f57fe
TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents:
14539
diff
changeset
|
91 |
-- Specific team |
14537 | 92 |
for i = 1, 8 do |
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
93 |
if params['t'..i] ~= nil then |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
94 |
for j = 1, 8 do |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
95 |
if string.len(params['t'..i]) >= j then |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
96 |
teamRoles[i][j] = string.upper(string.sub(params['t'..i],j,j)); |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
97 |
end |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
98 |
end |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
99 |
end |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
100 |
end |
14537 | 101 |
end |
102 |
||
6747 | 103 |
function onNewAmmoStore(groupIndex, hogIndex) |
5277 | 104 |
|
6747 | 105 |
SetAmmo(amSkip, 9, 0, 0, 0) |
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
106 |
groupIndex = groupIndex + 1 |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
107 |
hogIndex = hogIndex + 1 |
5277 | 108 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
109 |
if teamRoles[groupIndex][hogIndex] == 'S' then |
6747 | 110 |
SetAmmo(amBazooka, 1, 0, 0, 0) |
111 |
SetAmmo(amGrenade, 1, 0, 0, 0) |
|
112 |
SetAmmo(amShotgun, 1, 0, 0, 0) |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
113 |
elseif teamRoles[groupIndex][hogIndex] == 'E' then |
6747 | 114 |
SetAmmo(amGirder, 2, 0, 0, 0) |
115 |
SetAmmo(amBlowTorch, 1, 0, 0, 0) |
|
116 |
SetAmmo(amPickHammer, 1, 0, 0, 0) |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
117 |
elseif teamRoles[groupIndex][hogIndex] == 'N' then |
6747 | 118 |
SetAmmo(amRope, 9, 0, 0, 0) |
119 |
SetAmmo(amParachute, 9, 0, 0, 0) |
|
120 |
SetAmmo(amFirePunch, 1, 0, 0, 0) |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
121 |
elseif teamRoles[groupIndex][hogIndex] == 'D' then |
6747 | 122 |
SetAmmo(amDynamite, 1, 0, 0, 0) |
123 |
SetAmmo(amMine, 1, 0, 0, 0) |
|
124 |
SetAmmo(amDrill, 1, 0, 0, 0) |
|
14579
90c215f83273
TS: Restore 2 of the "specialist" letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14544
diff
changeset
|
125 |
elseif teamRoles[groupIndex][hogIndex] == 'X' then |
6747 | 126 |
SetAmmo(amSniperRifle, 1, 0, 0, 0) |
127 |
SetAmmo(amDEagle, 1, 0, 0, 0) |
|
128 |
SetAmmo(amPortalGun, 2, 0, 0, 0) |
|
14579
90c215f83273
TS: Restore 2 of the "specialist" letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14544
diff
changeset
|
129 |
elseif teamRoles[groupIndex][hogIndex] == 'H' then |
6747 | 130 |
SetAmmo(amSeduction, 9, 0, 0, 0) |
131 |
SetAmmo(amResurrector, 1, 0, 0, 0) |
|
132 |
SetAmmo(amInvulnerable, 1, 0, 0, 0) |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
133 |
SetAmmo(amLowGravity, 1, 0, 0, 0) |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
134 |
elseif teamRoles[groupIndex][hogIndex] == 'P' then |
6747 | 135 |
SetAmmo(amFlamethrower, 1, 0, 0, 0) |
136 |
SetAmmo(amMolotov, 1, 0, 0, 0) |
|
137 |
SetAmmo(amNapalm, 1, 0, 0, 0) |
|
14539
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
138 |
elseif teamRoles[groupIndex][hogIndex] == 'L' then |
6747 | 139 |
SetAmmo(amBaseballBat, 1, 0, 0, 0) |
140 |
SetAmmo(amGasBomb, 1, 0, 0, 0) |
|
141 |
SetAmmo(amKamikaze, 1, 0, 0, 0) |
|
142 |
end |
|
5277 | 143 |
|
144 |
end |
|
145 |
||
6747 | 146 |
function CreateTeam() |
5277 | 147 |
|
6747 | 148 |
currTeam = "" |
149 |
lastTeam = "" |
|
150 |
z = 0 |
|
151 |
||
152 |
for i = 0, (numhhs-1) do |
|
5277 | 153 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
154 |
currTeam = GetHogTeamName(hhs[i]) |
5382 | 155 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
156 |
if currTeam == lastTeam then |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
157 |
z = z + 1 |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
158 |
else |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
159 |
z = 1 |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
160 |
currTeamIdx = currTeamIdx + 1; |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
161 |
end |
5277 | 162 |
|
14544
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
163 |
-- Scale health of each hog with “initial health” setting from game scheme. |
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
164 |
-- 100 = default health |
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
165 |
-- 200 = double health for all hogs |
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
166 |
-- 50 = half health for all hogs |
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
167 |
local function scaleHealth(health) |
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
168 |
local newHealth = div(health * InitHealth, 100) |
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
169 |
-- At least 1 health |
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
170 |
if newHealth <= 0 then |
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
171 |
newHealth = 1 |
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
172 |
end |
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
173 |
return newHealth |
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
174 |
end |
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
175 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
176 |
if teamRoles[currTeamIdx][z] == 'S' then |
5277 | 177 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
178 |
SetHogName(hhs[i],loc("Soldier")) |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
179 |
SetHogHat(hhs[i], "sf_vega") |
14544
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
180 |
SetHealth(hhs[i], scaleHealth(200)) |
6747 | 181 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
182 |
elseif teamRoles[currTeamIdx][z] == 'E' then |
5382 | 183 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
184 |
SetHogHat(hhs[i], "Glasses") |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
185 |
SetHogName(hhs[i],loc("Engineer")) |
14544
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
186 |
SetHealth(hhs[i], scaleHealth(100)) |
5382 | 187 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
188 |
elseif teamRoles[currTeamIdx][z] == 'N' then |
5277 | 189 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
190 |
SetHogName(hhs[i],loc("Ninja")) |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
191 |
SetHogHat(hhs[i], "NinjaFull") |
14544
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
192 |
SetHealth(hhs[i], scaleHealth(80)) |
5277 | 193 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
194 |
elseif teamRoles[currTeamIdx][z] == 'D' then |
6747 | 195 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
196 |
SetHogName(hhs[i],loc("Demo")) |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
197 |
SetHogHat(hhs[i], "Skull") |
14544
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
198 |
SetHealth(hhs[i], scaleHealth(200)) |
6747 | 199 |
|
14579
90c215f83273
TS: Restore 2 of the "specialist" letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14544
diff
changeset
|
200 |
elseif teamRoles[currTeamIdx][z] == 'X' then |
5277 | 201 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
202 |
SetHogName(hhs[i],loc("Sniper")) |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
203 |
SetHogHat(hhs[i], "Sniper") |
14544
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
204 |
SetHealth(hhs[i], scaleHealth(120)) |
6747 | 205 |
|
14579
90c215f83273
TS: Restore 2 of the "specialist" letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14544
diff
changeset
|
206 |
elseif teamRoles[currTeamIdx][z] == 'H' then |
6747 | 207 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
208 |
SetHogName(hhs[i],loc("Saint")) |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
209 |
SetHogHat(hhs[i], "angel") |
14544
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
210 |
SetHealth(hhs[i], scaleHealth(300)) |
5277 | 211 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
212 |
elseif teamRoles[currTeamIdx][z] == 'P' then |
6747 | 213 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
214 |
SetHogName(hhs[i],loc("Pyro")) |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
215 |
SetHogHat(hhs[i], "Gasmask") |
14544
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
216 |
SetHealth(hhs[i], scaleHealth(150)) |
6747 | 217 |
|
14539
a97216ff1c51
Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents:
14538
diff
changeset
|
218 |
elseif teamRoles[currTeamIdx][z] == 'L' then |
6747 | 219 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
220 |
SetHogName(hhs[i],loc("Loon")) |
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
221 |
SetHogHat(hhs[i], "clown") |
14544
e176bf229649
TS: Scale health with the “initial health” setting from game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14542
diff
changeset
|
222 |
SetHealth(hhs[i], scaleHealth(100)) |
6747 | 223 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
224 |
end |
6747 | 225 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
226 |
lastTeam = GetHogTeamName(hhs[i]) |
6747 | 227 |
|
228 |
end |
|
5277 | 229 |
|
230 |
end |
|
231 |
||
232 |
function onGameInit() |
|
14542
8a11548cb1d2
TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14541
diff
changeset
|
233 |
-- Force-disable harmful game flags |
8a11548cb1d2
TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14541
diff
changeset
|
234 |
DisableGameFlags(gfSharedAmmo, gfKing) |
8a11548cb1d2
TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14541
diff
changeset
|
235 |
-- Force-enable game-critical game flags |
8a11548cb1d2
TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14541
diff
changeset
|
236 |
EnableGameFlags(gfPerHogAmmo, gfResetWeps) |
8a11548cb1d2
TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14541
diff
changeset
|
237 |
-- NOTE: For your game scheme, these game flags are recommended: gfResetWeps, gfPlaceHog, gfSwitchHog, gfInfAttack |
8a11548cb1d2
TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14541
diff
changeset
|
238 |
|
8a11548cb1d2
TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14541
diff
changeset
|
239 |
-- No weapon crates |
5817
70208e400a59
For now, don't spawn anything other than health crates.
mikade
parents:
5797
diff
changeset
|
240 |
HealthCaseProb = 100 |
14542
8a11548cb1d2
TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14541
diff
changeset
|
241 |
|
8a11548cb1d2
TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents:
14541
diff
changeset
|
242 |
-- Instructions |
14541
c96079ee4687
TS: Simplify mission panel, fix bad string concatenation
Wuzzy <Wuzzy2@mail.ru>
parents:
14540
diff
changeset
|
243 |
Goals = loc("The Specialists: Each hedgehog starts with its own weapon set") |
5277 | 244 |
end |
245 |
||
246 |
function onGameStart() |
|
5382 | 247 |
|
6747 | 248 |
CreateTeam() |
5457 | 249 |
trackTeams() |
250 |
||
5277 | 251 |
end |
252 |
||
253 |
||
254 |
function onNewTurn() |
|
13273
8f579173b161
The Specialits: Use gfSwitchHog for hog switching and delete the terrible Lua hacks
Wuzzy <Wuzzy2@mail.ru>
parents:
12350
diff
changeset
|
255 |
|
6747 | 256 |
started = true |
14541
c96079ee4687
TS: Simplify mission panel, fix bad string concatenation
Wuzzy <Wuzzy2@mail.ru>
parents:
14540
diff
changeset
|
257 |
AddCaption(string.format(loc("Prepare yourself, %s!"), GetHogName(CurrentHedgehog))) |
5277 | 258 |
|
259 |
end |
|
260 |
||
261 |
function onGearAdd(gear) |
|
5382 | 262 |
|
14538
2fd8f4cd3aa4
Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents:
14537
diff
changeset
|
263 |
if GetGearType(gear) == gtHedgehog then |
6747 | 264 |
hhs[numhhs] = gear |
265 |
numhhs = numhhs + 1 |
|
266 |
elseif (GetGearType(gear) == gtMine) and (started == true) then |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
267 |
SetTimer(gear,5000) |
5457 | 268 |
end |
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
269 |
|
5457 | 270 |
if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then |
271 |
trackGear(gear) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
272 |
end |
5457 | 273 |
|
5277 | 274 |
end |
275 |
||
276 |
function onGearDelete(gear) |
|
5457 | 277 |
if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then |
278 |
trackDeletion(gear) |
|
5827
a416f1070fdf
we don't need trailing whitespaces... I guess :P
sheepluva
parents:
5817
diff
changeset
|
279 |
end |
5277 | 280 |
end |
281 |