share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua
author mikade
Mon, 31 Oct 2011 19:40:39 +0200
changeset 6253 d73317579ae4
parent 5827 a416f1070fdf
child 6747 3f85b103f29f
permissions -rw-r--r--
Add "Surfer" achievement to Space Invasion. Balance "Shield Miser" in Space Invasion. Fix disappearing ghost bug in Racer Extend waypoint limit to 8 in Racer Lengthen ghost tracking interval to improve performance in Racer. Allow users to view score between turns now that HideMission() is fixed.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
     1
----------------------------------
5817
70208e400a59 For now, don't spawn anything other than health crates.
mikade
parents: 5797
diff changeset
     2
-- THE SPECIALISTS MODE 0.6
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
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    43
--------------------
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    44
--TO DO
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    45
--------------------
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    46
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    47
-- balance hog health, maybe
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    48
-- add proper gameflag checking, maybe (so that we can throw in a .cfg and let the users break everything)
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    49
-- set crate drops etc. (super crate for each class? or will this ruin the mode's simplicity?)
5277
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
loadfile(GetDataPath() .. "Scripts/Locale.lua")()
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    52
loadfile(GetDataPath() .. "Scripts/Tracker.lua")()
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    53
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    54
local numhhs = 0
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    55
local hhs = {}
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    56
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    57
local currName
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    58
local lastName
5362
5f0c46e78e50 Enable autoswitch on turn start for The Specialists Mode.
mikade
parents: 5277
diff changeset
    59
local started = false
5f0c46e78e50 Enable autoswitch on turn start for The Specialists Mode.
mikade
parents: 5277
diff changeset
    60
local switchStage = 0
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    61
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    62
local hogCounter
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    63
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    64
function CountHog(gear)
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    65
	hogCounter = hogCounter +1
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    66
end
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
    67
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    68
function CreateTeam()
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    69
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    70
        currTeam = ""
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    71
        lastTeam = ""
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    72
        z = 0
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
        for i = 0, (numhhs-1) do
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    75
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    76
                currTeam = GetHogTeamName(hhs[i])
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    77
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    78
                if currTeam == lastTeam then
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    79
                        z = z + 1
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    80
                else
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    81
                        z = 1
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    82
                end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    83
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    84
                if z == 1 then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    85
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    86
                        SetHogName(hhs[i],"Soldier")
5797
d61cd92865c2 fix hat name
nemo
parents: 5457
diff changeset
    87
                        SetHogHat(hhs[i], "sf_vega")
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    88
                        SetHealth(hhs[i],200)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    89
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    90
                elseif z == 2 then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    91
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    92
                        SetHogHat(hhs[i], "Glasses")
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    93
                        SetHogName(hhs[i],"Engineer")
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    94
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    95
                elseif z == 3 then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
    96
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    97
                        SetHogName(hhs[i],"Ninja")
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    98
                        SetHogHat(hhs[i], "NinjaFull")
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
    99
                        SetHealth(hhs[i],80)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   100
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   101
                elseif z == 4 then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   102
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   103
                        SetHogName(hhs[i],"Demo")
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   104
                        SetHogHat(hhs[i], "Skull")
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   105
                        SetHealth(hhs[i],200)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   106
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   107
                elseif z == 5 then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   108
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   109
                        SetHogName(hhs[i],"Sniper")
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   110
                        SetHogHat(hhs[i], "Sniper")
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   111
                        SetHealth(hhs[i],120)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   112
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   113
                elseif z == 6 then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   114
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   115
                        SetHogName(hhs[i],"Saint")
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   116
                        SetHogHat(hhs[i], "angel")
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   117
                        SetHealth(hhs[i],300)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   118
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   119
                elseif z == 7 then
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   120
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   121
                        SetHogName(hhs[i],"Pyro")
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   122
                        SetHogHat(hhs[i], "Gasmask")
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   123
                        SetHealth(hhs[i],150)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   124
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   125
                elseif z == 8 then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   126
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   127
                        SetHogName(hhs[i],"Loon")
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   128
                        SetHogHat(hhs[i], "clown")
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   129
                        SetHealth(hhs[i],100)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   130
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   131
                end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   132
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   133
                lastTeam = GetHogTeamName(hhs[i])
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   134
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   135
        end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   136
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   137
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   138
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   139
function ResetAllAmmo()
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   140
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   141
        AddAmmo(CurrentHedgehog, amBazooka, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   142
        AddAmmo(CurrentHedgehog, amGrenade, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   143
        AddAmmo(CurrentHedgehog, amShotgun, 0)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   144
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   145
        AddAmmo(CurrentHedgehog, amGirder, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   146
        AddAmmo(CurrentHedgehog, amBlowTorch, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   147
        AddAmmo(CurrentHedgehog, amPickHammer, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   148
        AddAmmo(CurrentHedgehog, amSwitch, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   149
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   150
        AddAmmo(CurrentHedgehog, amRope, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   151
        AddAmmo(CurrentHedgehog, amParachute, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   152
        AddAmmo(CurrentHedgehog, amFirePunch, 0)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   153
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   154
        AddAmmo(CurrentHedgehog, amDynamite, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   155
        AddAmmo(CurrentHedgehog, amDrill, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   156
        AddAmmo(CurrentHedgehog, amMine, 0)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   157
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   158
        AddAmmo(CurrentHedgehog, amSniperRifle, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   159
        AddAmmo(CurrentHedgehog, amDEagle, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   160
        AddAmmo(CurrentHedgehog, amPortalGun, 0)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   161
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   162
        AddAmmo(CurrentHedgehog, amSeduction, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   163
        AddAmmo(CurrentHedgehog, amResurrector, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   164
        AddAmmo(CurrentHedgehog, amInvulnerable, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   165
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   166
        AddAmmo(CurrentHedgehog, amFlamethrower, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   167
        AddAmmo(CurrentHedgehog, amMolotov, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   168
        AddAmmo(CurrentHedgehog, amNapalm, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   169
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   170
        AddAmmo(CurrentHedgehog, amBaseballBat, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   171
        AddAmmo(CurrentHedgehog, amGasBomb, 0)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   172
        AddAmmo(CurrentHedgehog, amKamikaze, 0)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   173
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   174
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   175
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   176
function AssignAmmo()
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   177
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   178
        ResetAllAmmo()
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   179
        n = GetHogName(CurrentHedgehog)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   180
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   181
        AddAmmo(CurrentHedgehog, amSkip,100)
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   182
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   183
        if n == "Soldier" then
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   184
                AddAmmo(CurrentHedgehog, amBazooka,1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   185
                AddAmmo(CurrentHedgehog, amGrenade,1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   186
                AddAmmo(CurrentHedgehog, amShotgun,1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   187
        elseif n == "Engineer" then
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   188
                AddAmmo(CurrentHedgehog, amGirder, 2)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   189
                AddAmmo(CurrentHedgehog, amBlowTorch, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   190
                AddAmmo(CurrentHedgehog, amPickHammer, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   191
        elseif n == "Ninja" then
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   192
                AddAmmo(CurrentHedgehog, amRope, 100)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   193
                AddAmmo(CurrentHedgehog, amParachute, 100)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   194
                AddAmmo(CurrentHedgehog, amFirePunch, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   195
        elseif n == "Demo" then
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   196
                AddAmmo(CurrentHedgehog, amDynamite, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   197
                AddAmmo(CurrentHedgehog, amMine, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   198
                AddAmmo(CurrentHedgehog, amDrill, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   199
        elseif n == "Sniper" then
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   200
                AddAmmo(CurrentHedgehog, amSniperRifle, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   201
                AddAmmo(CurrentHedgehog, amDEagle, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   202
                AddAmmo(CurrentHedgehog, amPortalGun, 2)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   203
        elseif n == "Saint" then
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   204
                AddAmmo(CurrentHedgehog, amSeduction, 100)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   205
                AddAmmo(CurrentHedgehog, amResurrector, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   206
                AddAmmo(CurrentHedgehog, amInvulnerable, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   207
        elseif n == "Pyro" then
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   208
                AddAmmo(CurrentHedgehog, amFlamethrower, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   209
                AddAmmo(CurrentHedgehog, amMolotov, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   210
                AddAmmo(CurrentHedgehog, amNapalm, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   211
        elseif n == "Loon" then
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   212
                AddAmmo(CurrentHedgehog, amBaseballBat, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   213
                AddAmmo(CurrentHedgehog, amGasBomb, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   214
                AddAmmo(CurrentHedgehog, amKamikaze, 1)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   215
        end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   216
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   217
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   218
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   219
function onGameInit()
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   220
        GameFlags = gfRandomOrder + gfResetWeps + gfInfAttack + gfPlaceHog
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   221
        Delay = 10
5817
70208e400a59 For now, don't spawn anything other than health crates.
mikade
parents: 5797
diff changeset
   222
	HealthCaseProb = 100
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   223
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   224
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   225
function onGameStart()
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   226
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   227
        CreateTeam()
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
        ShowMission     (
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   230
                                loc("THE SPECIALISTS"),
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   231
                                loc("a Hedgewars mini-game"),
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   232
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   233
                                loc("Eliminate the enemy specialists.") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   234
                                " " .. "|" ..
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   235
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   236
                                loc("Game Modifiers: ") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   237
                                loc("Per-Hog Ammo") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   238
                                loc("Weapons Reset") .. "|" ..
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   239
                                loc("Unlimited Attacks") .. "|" ..
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   240
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   241
                                "", 4, 4000
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   242
                                )
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   243
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   244
	trackTeams()
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   245
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   246
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   247
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   248
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   249
function onNewTurn()
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   250
        currName = GetHogName(CurrentHedgehog)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   251
        lastName = GetHogName(CurrentHedgehog)
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   252
        AssignAmmo()
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   253
        started = true
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   254
        switchStage = 0
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   255
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   256
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   257
function onGameTick()
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
	if (CurrentHedgehog ~= nil) then
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   260
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   261
		currName = GetHogName(CurrentHedgehog)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   262
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   263
		if (currName ~= lastName) and (switchStage > 100) then
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   264
			AddCaption(loc("Switched to ") .. currName .. "!")
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   265
			AssignAmmo()
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   266
		end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   267
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   268
		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and (switchStage < 100) then
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   269
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   270
			AddCaption(loc("Prepare yourself") .. ", " .. currName .. "!")
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   271
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   272
			hogCounter = 0
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   273
			runOnHogsInTeam(CountHog, GetHogTeamName(CurrentHedgehog) )
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   274
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   275
			if hogCounter > 1 then
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   276
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   277
				switchStage = switchStage + 1
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   278
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   279
				if switchStage == 1 then
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   280
					AddAmmo(CurrentHedgehog, amSwitch, 1)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   281
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   282
				elseif switchStage == 2 then
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   283
					ParseCommand("setweap " .. string.char(amSwitch))
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   284
				elseif switchStage == 3 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   285
					SetGearMessage(CurrentHedgehog,gmAttack)
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   286
				elseif switchStage == 4 then
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   287
					switchStage = 110
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   288
					AddAmmo(CurrentHedgehog, amSwitch, 0)
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   289
				end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   290
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   291
			else
5362
5f0c46e78e50 Enable autoswitch on turn start for The Specialists Mode.
mikade
parents: 5277
diff changeset
   292
				switchStage = 110
5f0c46e78e50 Enable autoswitch on turn start for The Specialists Mode.
mikade
parents: 5277
diff changeset
   293
			end
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   294
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   295
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   296
		end
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   297
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   298
		lastName = currName
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   299
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   300
	end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   301
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   302
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   303
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   304
function onGearAdd(gear)
5382
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   305
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   306
        if GetGearType(gear) == gtHedgehog then
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   307
                hhs[numhhs] = gear
d5321b22aed2 Altered switch behavior on 'The Specialists'.
mikade
parents: 5362
diff changeset
   308
                numhhs = numhhs + 1
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   309
        elseif (GetGearType(gear) == gtMine) and (started == true) then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   310
		SetTimer(gear,5000)
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   311
	end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   312
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   313
	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
   314
		trackGear(gear)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   315
	end
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   316
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   317
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   318
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   319
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   320
function onGearDelete(gear)
5457
48fe8e03a9cf Don't activate switch if player only has 1 hog
mikade
parents: 5382
diff changeset
   321
	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
   322
		trackDeletion(gear)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5817
diff changeset
   323
	end
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   324
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   325
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   326
function onAmmoStoreInit()
5362
5f0c46e78e50 Enable autoswitch on turn start for The Specialists Mode.
mikade
parents: 5277
diff changeset
   327
--
5277
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   328
end
09beef0752ab PianoStrike exploit fix for Capture The Flag.
mikade
parents:
diff changeset
   329