share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua
author sheepluva
Tue, 15 May 2018 17:05:40 +0200
branchui-scaling
changeset 13386 72bbccf9a715
parent 13273 8f579173b161
child 14422 6c21bd8547dd
permissions -rw-r--r--
fix some accidental code corruption caused by my last commit
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")
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    57
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    58
local numhhs = 0
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    59
local hhs = {}
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    60
5362
5f0c46e78e50 Enable autoswitch on turn start for The Specialists Mode.
mikade
parents: 5277
diff changeset
    61
local started = false
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    62
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    63
function onNewAmmoStore(groupIndex, hogIndex)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    64
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    65
	SetAmmo(amSkip, 9, 0, 0, 0)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    66
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    67
	if hogIndex == 0 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    68
		SetAmmo(amBazooka, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    69
		SetAmmo(amGrenade, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    70
		SetAmmo(amShotgun, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    71
	elseif hogIndex == 1 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    72
		SetAmmo(amGirder, 2, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    73
		SetAmmo(amBlowTorch, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    74
		SetAmmo(amPickHammer, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    75
	elseif hogIndex == 2 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    76
		SetAmmo(amRope, 9, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    77
		SetAmmo(amParachute, 9, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    78
		SetAmmo(amFirePunch, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    79
	elseif hogIndex == 3 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    80
		SetAmmo(amDynamite, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    81
		SetAmmo(amMine, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    82
		SetAmmo(amDrill, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    83
	elseif hogIndex == 4 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    84
		SetAmmo(amSniperRifle, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    85
		SetAmmo(amDEagle, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    86
		SetAmmo(amPortalGun, 2, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    87
	elseif hogIndex == 5 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    88
		SetAmmo(amSeduction, 9, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    89
		SetAmmo(amResurrector, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    90
		SetAmmo(amInvulnerable, 1, 0, 0, 0)
12350
193eba524369 fly saint flyy
nemo
parents: 11301
diff changeset
    91
        SetAmmo(amLowGravity, 1, 0, 0, 0)
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    92
	elseif hogIndex == 6 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    93
		SetAmmo(amFlamethrower, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    94
		SetAmmo(amMolotov, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    95
		SetAmmo(amNapalm, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    96
	elseif hogIndex == 7 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    97
		SetAmmo(amBaseballBat, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    98
		SetAmmo(amGasBomb, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    99
		SetAmmo(amKamikaze, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   100
	end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   101
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   102
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   103
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   104
function CreateTeam()
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   105
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   106
	currTeam = ""
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   107
	lastTeam = ""
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   108
	z = 0
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   109
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   110
	for i = 0, (numhhs-1) do
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   111
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   112
			currTeam = GetHogTeamName(hhs[i])
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   113
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   114
			if currTeam == lastTeam then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   115
					z = z + 1
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   116
			else
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   117
					z = 1
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   118
			end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   119
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   120
			if z == 1 then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   121
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   122
					SetHogName(hhs[i],loc("Soldier"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   123
					SetHogHat(hhs[i], "sf_vega")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   124
					SetHealth(hhs[i],200)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   125
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   126
			elseif z == 2 then
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   127
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   128
					SetHogHat(hhs[i], "Glasses")
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   129
					SetHogName(hhs[i],loc("Engineer"))
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   130
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   131
			elseif z == 3 then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   132
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   133
					SetHogName(hhs[i],loc("Ninja"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   134
					SetHogHat(hhs[i], "NinjaFull")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   135
					SetHealth(hhs[i],80)
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
			elseif z == 4 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   138
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   139
					SetHogName(hhs[i],loc("Demo"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   140
					SetHogHat(hhs[i], "Skull")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   141
					SetHealth(hhs[i],200)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   142
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   143
			elseif z == 5 then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   144
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   145
					SetHogName(hhs[i],loc("Sniper"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   146
					SetHogHat(hhs[i], "Sniper")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   147
					SetHealth(hhs[i],120)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   148
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   149
			elseif z == 6 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   150
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   151
					SetHogName(hhs[i],loc("Saint"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   152
					SetHogHat(hhs[i], "angel")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   153
					SetHealth(hhs[i],300)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   154
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   155
			elseif z == 7 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   156
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   157
					SetHogName(hhs[i],loc("Pyro"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   158
					SetHogHat(hhs[i], "Gasmask")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   159
					SetHealth(hhs[i],150)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   160
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   161
			elseif z == 8 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   162
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   163
					SetHogName(hhs[i],loc("Loon"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   164
					SetHogHat(hhs[i], "clown")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   165
					SetHealth(hhs[i],100)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   166
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   167
			end
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   168
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   169
			lastTeam = GetHogTeamName(hhs[i])
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   170
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   171
	end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   172
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   173
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   174
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   175
function onGameInit()
10036
3be36d2fdca6 use new API for changing GameFlags
sheepluva
parents: 8043
diff changeset
   176
	ClearGameFlags()
13273
8f579173b161 The Specialits: Use gfSwitchHog for hog switching and delete the terrible Lua hacks
Wuzzy <Wuzzy2@mail.ru>
parents: 12350
diff changeset
   177
	EnableGameFlags(gfRandomOrder, gfResetWeps, gfInfAttack, gfPlaceHog, gfPerHogAmmo, gfSwitchHog)
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   178
	Delay = 10
5817
70208e400a59 For now, don't spawn anything other than health crates.
mikade
parents: 5797
diff changeset
   179
	HealthCaseProb = 100
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   180
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   181
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   182
function onGameStart()
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   183
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   184
	CreateTeam()
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   185
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   186
	ShowMission     (
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   187
                                loc("THE SPECIALISTS"),
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   188
                                loc("a Hedgewars mini-game"),
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   189
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   190
                                loc("Eliminate the enemy specialists.") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   191
                                " " .. "|" ..
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   192
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   193
                                loc("Game Modifiers: ") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   194
                                loc("Per-Hog Ammo") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   195
                                loc("Weapons Reset") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   196
                                loc("Unlimited Attacks") .. "|" ..
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   197
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   198
                                "", 4, 4000
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   199
                                )
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   200
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   201
	trackTeams()
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   202
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   203
end
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
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   206
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
   207
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   208
	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
   209
	AddCaption(loc("Prepare yourself") .. ", " .. GetHogName(CurrentHedgehog).. "!")
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   210
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 onGearAdd(gear)
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
    if GetGearType(gear) == gtHedgehog then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   216
		hhs[numhhs] = gear
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   217
		numhhs = numhhs + 1
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   218
	elseif (GetGearType(gear) == gtMine) and (started == true) then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   219
		SetTimer(gear,5000)
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   220
	end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   221
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   222
	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
   223
		trackGear(gear)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   224
	end
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   225
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   226
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   227
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   228
function onGearDelete(gear)
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   229
	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
   230
		trackDeletion(gear)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   231
	end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   232
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   233