share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua
author Wuzzy <Wuzzy2@mail.ru>
Sat, 05 Jan 2019 21:52:15 +0100
changeset 14542 8a11548cb1d2
parent 14541 c96079ee4687
child 14544 e176bf229649
permissions -rw-r--r--
TS: Improve configurability by game scheme
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
     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
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
     4
----------------------------------
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
     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
a97216ff1c51 Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents: 14538
diff changeset
    29
  I = Sniper
a97216ff1c51 Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents: 14538
diff changeset
    30
  A = Saint
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
14540
213a636f57fe TS: Add script param to set specialists for all teams at once
Wuzzy <Wuzzy2@mail.ru>
parents: 14539
diff changeset
    43
    t1=LPAIDNES,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
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    56
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7143
diff changeset
    57
HedgewarsScriptLoad("/Scripts/Locale.lua")
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7143
diff changeset
    58
HedgewarsScriptLoad("/Scripts/Tracker.lua")
14537
f5487302d53b Allow customising the teams
nemo
parents: 14422
diff changeset
    59
HedgewarsScriptLoad("/Scripts/Params.lua")
f5487302d53b Allow customising the teams
nemo
parents: 14422
diff changeset
    60
f5487302d53b Allow customising the teams
nemo
parents: 14422
diff changeset
    61
-- default team values
f5487302d53b Allow customising the teams
nemo
parents: 14422
diff changeset
    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 = {
14539
a97216ff1c51 Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents: 14538
diff changeset
    64
	{'S','E','N','D','I','A','P','L'},
a97216ff1c51 Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents: 14538
diff changeset
    65
	{'S','E','N','D','I','A','P','L'},
a97216ff1c51 Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents: 14538
diff changeset
    66
	{'S','E','N','D','I','A','P','L'},
a97216ff1c51 Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents: 14538
diff changeset
    67
	{'S','E','N','D','I','A','P','L'},
a97216ff1c51 Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents: 14538
diff changeset
    68
	{'S','E','N','D','I','A','P','L'},
a97216ff1c51 Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents: 14538
diff changeset
    69
	{'S','E','N','D','I','A','P','L'},
a97216ff1c51 Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents: 14538
diff changeset
    70
	{'S','E','N','D','I','A','P','L'},
a97216ff1c51 Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents: 14538
diff changeset
    71
	{'S','E','N','D','I','A','P','L'}
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
    72
};
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    73
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    74
local numhhs = 0
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    75
local hhs = {}
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    76
5362
5f0c46e78e50 Enable autoswitch on turn start for The Specialists Mode.
mikade
parents: 5277
diff changeset
    77
local started = false
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    78
14537
f5487302d53b Allow customising the teams
nemo
parents: 14422
diff changeset
    79
function onParameters()
f5487302d53b Allow customising the teams
nemo
parents: 14422
diff changeset
    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
f5487302d53b Allow customising the teams
nemo
parents: 14422
diff changeset
    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
f5487302d53b Allow customising the teams
nemo
parents: 14422
diff changeset
   101
end
f5487302d53b Allow customising the teams
nemo
parents: 14422
diff changeset
   102
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   103
function onNewAmmoStore(groupIndex, hogIndex)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   104
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   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
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   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
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   110
		SetAmmo(amBazooka, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   111
		SetAmmo(amGrenade, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   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
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   114
		SetAmmo(amGirder, 2, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   115
		SetAmmo(amBlowTorch, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   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
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   118
		SetAmmo(amRope, 9, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   119
		SetAmmo(amParachute, 9, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   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
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   122
		SetAmmo(amDynamite, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   123
		SetAmmo(amMine, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   124
		SetAmmo(amDrill, 1, 0, 0, 0)
14539
a97216ff1c51 Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents: 14538
diff changeset
   125
	elseif teamRoles[groupIndex][hogIndex] == 'I' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   126
		SetAmmo(amSniperRifle, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   127
		SetAmmo(amDEagle, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   128
		SetAmmo(amPortalGun, 2, 0, 0, 0)
14539
a97216ff1c51 Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents: 14538
diff changeset
   129
	elseif teamRoles[groupIndex][hogIndex] == 'A' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   130
		SetAmmo(amSeduction, 9, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   131
		SetAmmo(amResurrector, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   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
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   135
		SetAmmo(amFlamethrower, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   136
		SetAmmo(amMolotov, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   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
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   139
		SetAmmo(amBaseballBat, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   140
		SetAmmo(amGasBomb, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   141
		SetAmmo(amKamikaze, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   142
	end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   143
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   144
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   145
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   146
function CreateTeam()
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   147
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   148
	currTeam = ""
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   149
	lastTeam = ""
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   150
	z = 0
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   151
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   152
	for i = 0, (numhhs-1) do
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   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
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   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
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   162
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   163
		if teamRoles[currTeamIdx][z] == 'S' then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   164
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   165
			SetHogName(hhs[i],loc("Soldier"))
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   166
			SetHogHat(hhs[i], "sf_vega")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   167
			SetHealth(hhs[i],200)
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   168
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   169
		elseif teamRoles[currTeamIdx][z] == 'E' then
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   170
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   171
			SetHogHat(hhs[i], "Glasses")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   172
			SetHogName(hhs[i],loc("Engineer"))
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   173
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   174
		elseif teamRoles[currTeamIdx][z] == 'N' then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   175
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   176
			SetHogName(hhs[i],loc("Ninja"))
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   177
			SetHogHat(hhs[i], "NinjaFull")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   178
			SetHealth(hhs[i],80)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   179
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   180
		elseif teamRoles[currTeamIdx][z] == 'D' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   181
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   182
			SetHogName(hhs[i],loc("Demo"))
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   183
			SetHogHat(hhs[i], "Skull")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   184
			SetHealth(hhs[i],200)
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   185
14539
a97216ff1c51 Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents: 14538
diff changeset
   186
		elseif teamRoles[currTeamIdx][z] == 'I' then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   187
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   188
			SetHogName(hhs[i],loc("Sniper"))
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   189
			SetHogHat(hhs[i], "Sniper")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   190
			SetHealth(hhs[i],120)
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   191
14539
a97216ff1c51 Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents: 14538
diff changeset
   192
		elseif teamRoles[currTeamIdx][z] == 'A' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   193
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   194
			SetHogName(hhs[i],loc("Saint"))
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   195
			SetHogHat(hhs[i], "angel")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   196
			SetHealth(hhs[i],300)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   197
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   198
		elseif teamRoles[currTeamIdx][z] == 'P' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   199
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   200
			SetHogName(hhs[i],loc("Pyro"))
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   201
			SetHogHat(hhs[i], "Gasmask")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   202
			SetHealth(hhs[i],150)
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   203
14539
a97216ff1c51 Document TS script param syntax, change some letters
Wuzzy <Wuzzy2@mail.ru>
parents: 14538
diff changeset
   204
		elseif teamRoles[currTeamIdx][z] == 'L' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   205
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   206
			SetHogName(hhs[i],loc("Loon"))
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   207
			SetHogHat(hhs[i], "clown")
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   208
			SetHealth(hhs[i],100)
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   209
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   210
		end
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   211
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   212
		lastTeam = GetHogTeamName(hhs[i])
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   213
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   214
	end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   215
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   216
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   217
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   218
function onGameInit()
14542
8a11548cb1d2 TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents: 14541
diff changeset
   219
	-- Force-disable harmful game flags
8a11548cb1d2 TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents: 14541
diff changeset
   220
	DisableGameFlags(gfSharedAmmo, gfKing)
8a11548cb1d2 TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents: 14541
diff changeset
   221
	-- Force-enable game-critical game flags
8a11548cb1d2 TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents: 14541
diff changeset
   222
	EnableGameFlags(gfPerHogAmmo, gfResetWeps)
8a11548cb1d2 TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents: 14541
diff changeset
   223
	-- 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
   224
8a11548cb1d2 TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents: 14541
diff changeset
   225
	-- No weapon crates
5817
70208e400a59 For now, don't spawn anything other than health crates.
mikade
parents: 5797
diff changeset
   226
	HealthCaseProb = 100
14542
8a11548cb1d2 TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents: 14541
diff changeset
   227
8a11548cb1d2 TS: Improve configurability by game scheme
Wuzzy <Wuzzy2@mail.ru>
parents: 14541
diff changeset
   228
	-- Instructions
14541
c96079ee4687 TS: Simplify mission panel, fix bad string concatenation
Wuzzy <Wuzzy2@mail.ru>
parents: 14540
diff changeset
   229
	Goals = loc("The Specialists: Each hedgehog starts with its own weapon set")
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   230
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   231
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   232
function onGameStart()
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   233
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   234
	CreateTeam()
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   235
	trackTeams()
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   236
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   237
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   238
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   239
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   240
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
   241
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   242
	started = true
14541
c96079ee4687 TS: Simplify mission panel, fix bad string concatenation
Wuzzy <Wuzzy2@mail.ru>
parents: 14540
diff changeset
   243
	AddCaption(string.format(loc("Prepare yourself, %s!"), GetHogName(CurrentHedgehog)))
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   244
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   245
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   246
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   247
function onGearAdd(gear)
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   248
14538
2fd8f4cd3aa4 Clean up indents and comments in The_Specialists.lua
Wuzzy <Wuzzy2@mail.ru>
parents: 14537
diff changeset
   249
	if GetGearType(gear) == gtHedgehog then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   250
		hhs[numhhs] = gear
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   251
		numhhs = numhhs + 1
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   252
	elseif (GetGearType(gear) == gtMine) and (started == true) then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   253
		SetTimer(gear,5000)
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   254
	end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   255
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   256
	if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   257
		trackGear(gear)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   258
	end
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   259
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   260
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   261
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   262
function onGearDelete(gear)
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   263
	if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   264
		trackDeletion(gear)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   265
	end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   266
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   267