share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua
author Wuzzy <Wuzzy2@mail.ru>
Sun, 11 Feb 2018 20:28:21 +0100
changeset 12974 f92e9b1df096
parent 12350 193eba524369
child 13273 8f579173b161
permissions -rw-r--r--
Construction Mode: Hide crate contents and object/crate placer submodes from prying eyes over the net
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
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    61
local currName
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    62
local lastName
5362
5f0c46e78e50 Enable autoswitch on turn start for The Specialists Mode.
mikade
parents: 5277
diff changeset
    63
local started = false
5f0c46e78e50 Enable autoswitch on turn start for The Specialists Mode.
mikade
parents: 5277
diff changeset
    64
local switchStage = 0
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    65
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    66
local hogCounter
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    67
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    68
function CountHog(gear)
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    69
	hogCounter = hogCounter +1
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    70
end
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    71
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    72
function onNewAmmoStore(groupIndex, hogIndex)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    73
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    74
	SetAmmo(amSkip, 9, 0, 0, 0)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    75
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    76
	if hogIndex == 0 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    77
		SetAmmo(amBazooka, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    78
		SetAmmo(amGrenade, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    79
		SetAmmo(amShotgun, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    80
	elseif hogIndex == 1 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    81
		SetAmmo(amGirder, 2, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    82
		SetAmmo(amBlowTorch, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    83
		SetAmmo(amPickHammer, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    84
	elseif hogIndex == 2 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    85
		SetAmmo(amRope, 9, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    86
		SetAmmo(amParachute, 9, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    87
		SetAmmo(amFirePunch, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    88
	elseif hogIndex == 3 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    89
		SetAmmo(amDynamite, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    90
		SetAmmo(amMine, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    91
		SetAmmo(amDrill, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    92
	elseif hogIndex == 4 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    93
		SetAmmo(amSniperRifle, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    94
		SetAmmo(amDEagle, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    95
		SetAmmo(amPortalGun, 2, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    96
	elseif hogIndex == 5 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    97
		SetAmmo(amSeduction, 9, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    98
		SetAmmo(amResurrector, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
    99
		SetAmmo(amInvulnerable, 1, 0, 0, 0)
12350
193eba524369 fly saint flyy
nemo
parents: 11301
diff changeset
   100
        SetAmmo(amLowGravity, 1, 0, 0, 0)
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   101
	elseif hogIndex == 6 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   102
		SetAmmo(amFlamethrower, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   103
		SetAmmo(amMolotov, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   104
		SetAmmo(amNapalm, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   105
	elseif hogIndex == 7 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   106
		SetAmmo(amBaseballBat, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   107
		SetAmmo(amGasBomb, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   108
		SetAmmo(amKamikaze, 1, 0, 0, 0)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   109
	end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   110
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   111
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   112
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   113
function CreateTeam()
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   114
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   115
	currTeam = ""
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   116
	lastTeam = ""
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   117
	z = 0
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   118
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   119
	for i = 0, (numhhs-1) do
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   120
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   121
			currTeam = GetHogTeamName(hhs[i])
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   122
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   123
			if currTeam == lastTeam then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   124
					z = z + 1
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   125
			else
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   126
					z = 1
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   127
			end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   128
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   129
			if z == 1 then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   130
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   131
					SetHogName(hhs[i],loc("Soldier"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   132
					SetHogHat(hhs[i], "sf_vega")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   133
					SetHealth(hhs[i],200)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   134
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   135
			elseif z == 2 then
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   136
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   137
					SetHogHat(hhs[i], "Glasses")
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   138
					SetHogName(hhs[i],loc("Engineer"))
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   139
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   140
			elseif z == 3 then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   141
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   142
					SetHogName(hhs[i],loc("Ninja"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   143
					SetHogHat(hhs[i], "NinjaFull")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   144
					SetHealth(hhs[i],80)
5277
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
			elseif z == 4 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   147
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   148
					SetHogName(hhs[i],loc("Demo"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   149
					SetHogHat(hhs[i], "Skull")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   150
					SetHealth(hhs[i],200)
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
			elseif z == 5 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("Sniper"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   155
					SetHogHat(hhs[i], "Sniper")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   156
					SetHealth(hhs[i],120)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   157
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   158
			elseif z == 6 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   159
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   160
					SetHogName(hhs[i],loc("Saint"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   161
					SetHogHat(hhs[i], "angel")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   162
					SetHealth(hhs[i],300)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   163
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   164
			elseif z == 7 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   165
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   166
					SetHogName(hhs[i],loc("Pyro"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   167
					SetHogHat(hhs[i], "Gasmask")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   168
					SetHealth(hhs[i],150)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   169
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   170
			elseif z == 8 then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   171
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10289
diff changeset
   172
					SetHogName(hhs[i],loc("Loon"))
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   173
					SetHogHat(hhs[i], "clown")
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   174
					SetHealth(hhs[i],100)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   175
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   176
			end
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   177
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   178
			lastTeam = GetHogTeamName(hhs[i])
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   179
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   180
	end
5277
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
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   183
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   184
function onGameInit()
10036
3be36d2fdca6 use new API for changing GameFlags
sheepluva
parents: 8043
diff changeset
   185
	ClearGameFlags()
3be36d2fdca6 use new API for changing GameFlags
sheepluva
parents: 8043
diff changeset
   186
	EnableGameFlags(gfRandomOrder, gfResetWeps, gfInfAttack, gfPlaceHog, gfPerHogAmmo)
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   187
	Delay = 10
5817
70208e400a59 For now, don't spawn anything other than health crates.
mikade
parents: 5797
diff changeset
   188
	HealthCaseProb = 100
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   189
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   190
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   191
function onGameStart()
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   192
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   193
	CreateTeam()
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   194
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   195
	ShowMission     (
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   196
                                loc("THE SPECIALISTS"),
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   197
                                loc("a Hedgewars mini-game"),
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   198
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   199
                                loc("Eliminate the enemy specialists.") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   200
                                " " .. "|" ..
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   201
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   202
                                loc("Game Modifiers: ") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   203
                                loc("Per-Hog Ammo") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   204
                                loc("Weapons Reset") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   205
                                loc("Unlimited Attacks") .. "|" ..
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   206
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   207
                                "", 4, 4000
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   208
                                )
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   209
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   210
	trackTeams()
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   211
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   212
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   213
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   214
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   215
function onNewTurn()
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   216
	currName = GetHogName(CurrentHedgehog)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   217
	lastName = GetHogName(CurrentHedgehog)
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   218
	started = true
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   219
	switchStage = 0
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   220
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   221
7143
cd86f95b46c9 also change specialists
nemo
parents: 6747
diff changeset
   222
function onGameTick20()
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   223
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   224
	if (CurrentHedgehog ~= nil) then
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   225
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   226
		currName = GetHogName(CurrentHedgehog)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   227
7143
cd86f95b46c9 also change specialists
nemo
parents: 6747
diff changeset
   228
		if (currName ~= lastName) and (switchStage > 5) then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   229
			AddCaption(loc("Switched to ") .. currName .. "!")
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
7143
cd86f95b46c9 also change specialists
nemo
parents: 6747
diff changeset
   232
		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and (switchStage < 5) then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   233
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   234
			AddCaption(loc("Prepare yourself") .. ", " .. currName .. "!")
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   235
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   236
			hogCounter = 0
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   237
			runOnHogsInTeam(CountHog, GetHogTeamName(CurrentHedgehog) )
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   238
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   239
			if hogCounter > 1 then
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   240
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   241
				switchStage = switchStage + 1
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   242
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   243
				if switchStage == 1 then
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   244
					AddAmmo(CurrentHedgehog, amSwitch, 1)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   245
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   246
				elseif switchStage == 2 then
10289
c3a77ff02a23 lua api: SetWeapon(ammoType)
sheepluva
parents: 10036
diff changeset
   247
					SetWeapon(amSwitch)
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   248
				elseif switchStage == 3 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   249
					SetGearMessage(CurrentHedgehog,gmAttack)
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   250
				elseif switchStage == 4 then
7143
cd86f95b46c9 also change specialists
nemo
parents: 6747
diff changeset
   251
					switchStage = 6
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   252
					AddAmmo(CurrentHedgehog, amSwitch, 0)
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   253
				end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   254
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   255
			else
7143
cd86f95b46c9 also change specialists
nemo
parents: 6747
diff changeset
   256
				switchStage = 6
5362
5f0c46e78e50 Enable autoswitch on turn start for The Specialists Mode.
mikade
parents: 5277
diff changeset
   257
			end
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   258
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   259
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   260
		end
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   261
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   262
		lastName = currName
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   263
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   264
	end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   265
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
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   268
function onGearAdd(gear)
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   269
6747
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   270
    if GetGearType(gear) == gtHedgehog then
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   271
		hhs[numhhs] = gear
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   272
		numhhs = numhhs + 1
3f85b103f29f use per hog ammo game flag. improves AI play
mikade
parents: 5827
diff changeset
   273
	elseif (GetGearType(gear) == gtMine) and (started == true) then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   274
		SetTimer(gear,5000)
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   275
	end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   276
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   277
	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
   278
		trackGear(gear)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   279
	end
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   280
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   281
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   282
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   283
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   284
function onGearDelete(gear)
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   285
	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
   286
		trackDeletion(gear)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   287
	end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   288
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   289
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   290
function onAmmoStoreInit()
5362
5f0c46e78e50 Enable autoswitch on turn start for The Specialists Mode.
mikade
parents: 5277
diff changeset
   291
--
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   292
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   293