share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua
author nemo
Sat, 05 Jan 2019 13:23:43 -0500
changeset 14516 f5487302d53b
parent 14401 6c21bd8547dd
child 14517 2fd8f4cd3aa4
permissions -rw-r--r--
Allow customising the teams
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
     1
----------------------------------
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
     2
-- THE SPECIALISTS MODE 0.7
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
     3
-- by mikade
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
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
     6
-- version history
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
     7
-----------------
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
     8
-- version 0.1
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
     9
-----------------
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    10
-- concept test
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    11
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    12
----------------
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    13
-- version 0.2
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    14
----------------
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    15
-- added gfRandomOrder to gameflags
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    16
-- removed some deprecated variables/methods
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    17
-- fixed lack of portal reset
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    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
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    25
----------------
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    26
-- version 0.4
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    27
----------------
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    28
-- Attempted to:
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    29
-- fix potential switch explit
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    30
-- improve user feedback on start
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    31
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    32
----------------
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    33
-- version 0.5
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    34
----------------
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    35
-- provision for variable minetimer / demo mines set to 5000ms
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    36
-- don't autoswitch if player only has 1 hog on his team
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    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
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    43
----------------
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    44
-- version 0.7
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    45
----------------
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    46
-- perhogadmsdf :D :D :D :D
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    47
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    48
--------------------
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    49
--TO DO
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    50
--------------------
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    51
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    52
-- balance hog health, maybe
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    53
-- add proper gameflag checking, maybe (so that we can throw in a .cfg and let the users break everything)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    54
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7143
diff changeset
    55
HedgewarsScriptLoad("/Scripts/Locale.lua")
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7143
diff changeset
    56
HedgewarsScriptLoad("/Scripts/Tracker.lua")
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    57
HedgewarsScriptLoad("/Scripts/Params.lua")
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    58
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    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]
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    60
-- default team values
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    61
local currTeamIdx = 0;
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    62
local teamRoles = 
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    63
        {
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    64
            {'S','E','N','D','X','H','P','C'},
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    65
            {'S','E','N','D','X','H','P','C'},
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    66
            {'S','E','N','D','X','H','P','C'},
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    67
            {'S','E','N','D','X','H','P','C'},
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    68
            {'S','E','N','D','X','H','P','C'},
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    69
            {'S','E','N','D','X','H','P','C'},
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    70
            {'S','E','N','D','X','H','P','C'},
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    71
            {'S','E','N','D','X','H','P','C'}
f5487302d53b Allow customising the teams
nemo
parents: 14401
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
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    79
function onParameters()
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    80
	parseParams()
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    81
	for i = 1, 8 do
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    82
        if params['t'..i] ~= nil then
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    83
            for j = 1, 8 do
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    84
                if string.len(params['t'..i]) >= j  then
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    85
                    teamRoles[i][j] = string.upper(string.sub(params['t'..i],j,j));
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    86
                end
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    87
            end
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    88
        end
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    89
    end
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    90
end
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    91
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    92
function onNewAmmoStore(groupIndex, hogIndex)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    93
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    94
	SetAmmo(amSkip, 9, 0, 0, 0)
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    95
    groupIndex = groupIndex + 1
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    96
    hogIndex = hogIndex + 1
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    97
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
    98
    if teamRoles[groupIndex][hogIndex] == 'S' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    99
		SetAmmo(amBazooka, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   100
		SetAmmo(amGrenade, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   101
		SetAmmo(amShotgun, 1, 0, 0, 0)
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   102
    elseif teamRoles[groupIndex][hogIndex] == 'E' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   103
		SetAmmo(amGirder, 2, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   104
		SetAmmo(amBlowTorch, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   105
		SetAmmo(amPickHammer, 1, 0, 0, 0)
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   106
    elseif teamRoles[groupIndex][hogIndex] == 'N' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   107
		SetAmmo(amRope, 9, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   108
		SetAmmo(amParachute, 9, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   109
		SetAmmo(amFirePunch, 1, 0, 0, 0)
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   110
    elseif teamRoles[groupIndex][hogIndex] == 'D' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   111
		SetAmmo(amDynamite, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   112
		SetAmmo(amMine, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   113
		SetAmmo(amDrill, 1, 0, 0, 0)
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   114
    elseif teamRoles[groupIndex][hogIndex] == 'X' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   115
		SetAmmo(amSniperRifle, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   116
		SetAmmo(amDEagle, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   117
		SetAmmo(amPortalGun, 2, 0, 0, 0)
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   118
    elseif teamRoles[groupIndex][hogIndex] == 'H' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   119
		SetAmmo(amSeduction, 9, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   120
		SetAmmo(amResurrector, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   121
		SetAmmo(amInvulnerable, 1, 0, 0, 0)
12350
193eba524369 fly saint flyy
nemo
parents: 11301
diff changeset
   122
        SetAmmo(amLowGravity, 1, 0, 0, 0)
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   123
    elseif teamRoles[groupIndex][hogIndex] == 'P' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   124
		SetAmmo(amFlamethrower, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   125
		SetAmmo(amMolotov, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   126
		SetAmmo(amNapalm, 1, 0, 0, 0)
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   127
    elseif teamRoles[groupIndex][hogIndex] == 'C' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   128
		SetAmmo(amBaseballBat, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   129
		SetAmmo(amGasBomb, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   130
		SetAmmo(amKamikaze, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   131
	end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   132
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   133
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   134
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   135
function CreateTeam()
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   136
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   137
	currTeam = ""
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   138
	lastTeam = ""
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   139
	z = 0
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   140
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   141
	for i = 0, (numhhs-1) do
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   142
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   143
			currTeam = GetHogTeamName(hhs[i])
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   144
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   145
			if currTeam == lastTeam then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   146
					z = z + 1
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   147
			else
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   148
					z = 1
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   149
                    currTeamIdx = currTeamIdx + 1;
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   150
			end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   151
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   152
			if teamRoles[currTeamIdx][z] == 'S' then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   153
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   154
					SetHogName(hhs[i],loc("Soldier"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   155
					SetHogHat(hhs[i], "sf_vega")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   156
					SetHealth(hhs[i],200)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   157
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   158
			elseif teamRoles[currTeamIdx][z] == 'E' then
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   159
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   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
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   162
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   163
			elseif teamRoles[currTeamIdx][z] == 'N' then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   164
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   165
					SetHogName(hhs[i],loc("Ninja"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   166
					SetHogHat(hhs[i], "NinjaFull")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   167
					SetHealth(hhs[i],80)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   168
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   169
			elseif teamRoles[currTeamIdx][z] == 'D' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   170
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   171
					SetHogName(hhs[i],loc("Demo"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   172
					SetHogHat(hhs[i], "Skull")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   173
					SetHealth(hhs[i],200)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   174
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   175
			elseif teamRoles[currTeamIdx][z] == 'X' then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   176
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   177
					SetHogName(hhs[i],loc("Sniper"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   178
					SetHogHat(hhs[i], "Sniper")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   179
					SetHealth(hhs[i],120)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   180
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   181
			elseif teamRoles[currTeamIdx][z] == 'H' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   182
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   183
					SetHogName(hhs[i],loc("Saint"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   184
					SetHogHat(hhs[i], "angel")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   185
					SetHealth(hhs[i],300)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   186
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   187
			elseif teamRoles[currTeamIdx][z] == 'P' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   188
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   189
					SetHogName(hhs[i],loc("Pyro"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   190
					SetHogHat(hhs[i], "Gasmask")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   191
					SetHealth(hhs[i],150)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   192
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   193
			elseif teamRoles[currTeamIdx][z] == 'C' then
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   194
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   195
					SetHogName(hhs[i],loc("Loon"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   196
					SetHogHat(hhs[i], "clown")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   197
					SetHealth(hhs[i],100)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   198
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   199
			end
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   200
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   201
			lastTeam = GetHogTeamName(hhs[i])
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   202
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   203
	end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   204
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   205
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   206
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   207
function onGameInit()
10036
3be36d2fdca6 use new API for changing GameFlags
sheepluva
parents: 8043
diff changeset
   208
	ClearGameFlags()
14516
f5487302d53b Allow customising the teams
nemo
parents: 14401
diff changeset
   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
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   211
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   212
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   213
function onGameStart()
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   214
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   215
	CreateTeam()
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   216
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   217
	ShowMission     (
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   218
                                loc("THE SPECIALISTS"),
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   219
                                loc("a Hedgewars mini-game"),
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   220
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   221
                                loc("Eliminate the enemy specialists.") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   222
                                " " .. "|" ..
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   223
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   224
                                loc("Game Modifiers: ") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   225
                                loc("Per-Hog Ammo") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   226
                                loc("Weapons Reset") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   227
                                loc("Unlimited Attacks") .. "|" ..
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   228
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   229
                                "", 4, 4000
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   230
                                )
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   231
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   232
	trackTeams()
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   233
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   234
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   235
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   236
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   237
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
   238
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   239
	started = true
13273
8f579173b161 The Specialits: Use gfSwitchHog for hog switching and delete the terrible Lua hacks
Wuzzy <Wuzzy2@mail.ru>
parents: 12350
diff changeset
   240
	AddCaption(loc("Prepare yourself") .. ", " .. GetHogName(CurrentHedgehog).. "!")
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   241
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   242
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   243
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   244
function onGearAdd(gear)
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   245
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   246
    if GetGearType(gear) == gtHedgehog then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   247
		hhs[numhhs] = gear
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   248
		numhhs = numhhs + 1
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   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
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   251
	end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   252
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   253
	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
   254
		trackGear(gear)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   255
	end
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   256
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   257
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   258
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   259
function onGearDelete(gear)
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   260
	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
   261
		trackDeletion(gear)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   262
	end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   263
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   264