share/hedgewars/Data/Maps/CTF_Blizzard/map.lua
author mikade
Sun, 26 Dec 2010 17:31:58 +0100
branch0.9.15
changeset 4698 6f14ef3e40ae
parent 4678 50716b795a4e
child 4764 674cdcf8b661
permissions -rw-r--r--
Updated maps CTF, Control and new unscripted map Blizzard
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
     1
--------------------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
     2
-- CTF_BLIZZARD 0.4
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
     3
--------------------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
     4
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
     5
---------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
     6
-- 0.2
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
     7
---------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
     8
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
     9
-- disabled super weapons
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    10
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    11
-- theme modifications
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    12
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    13
-- improved hog placement system: teams can now be put
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    14
-- in any order and be of any size
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    15
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    16
---------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    17
-- 0.3
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    18
---------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    19
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    20
-- In this version:
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    21
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    22
-- changed starting weapons
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    23
-- changed crate drop contents and rate of drops
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    24
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    25
-- completely removed super weapons and super weapon scripts
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    26
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    27
-- removed custom respawning
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    28
-- removed set respawn points
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    29
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    30
-- added AIRespawn-esque respawning
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    31
-- added simple left vs right respawn points
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    32
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    33
-- added non-lethal poison to flag carriers as an indicator
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    34
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    35
-- improved flag mechanics and player-flag feedback
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    36
-- flag now instantly respawns if you kill enemy hog and return it,
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    37
-- or if the flag falls in water, _BUT_ not if it is blown up
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    38
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    39
---------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    40
-- 0.4
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    41
---------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    42
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    43
-- tweaked crate drop rates and crate contents
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    44
-- improved the teleporters, they should now be able to handle rope... hopefully
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    45
-- updated SetEffect calls to be in line with 0.9.15 definitions
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    46
-- added visual gears when hogs respawn
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    47
-- added visual gears when hogs teleport
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    48
-- added visual gear to track flag and flag carriers
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    49
-- removed poisoning of flag carriers
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    50
-- removed health adjustments for flag carriers due to aforementioned poisons
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    51
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
    52
---------
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
    53
-- 0.5
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
    54
---------
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    55
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
    56
-- added translation support, hopefully
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
    57
-- added ctf rules
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
    58
-- added effects to the teleporters
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
    59
-- added aura round spawning area
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
    60
-- changed the aura around the flag carrier / flag to an aura and added some support for this
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
    61
-- changed things so the seed is no longer always the same...
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    62
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
    63
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
    64
loadfile(GetDataPath() .. "Scripts/Locale.lua")()
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    65
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    66
---------------------------------------------------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    67
----------lots of bad variables and things
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    68
----------because someone is too lazy
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    69
----------to read about tables properly
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    70
------------------ "Oh well, they probably have the memory"
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    71
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    72
local actionReset = 0 -- used in CheckTeleporters()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    73
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    74
local roundsCounter = 0	-- used to determine when to spawn more crates
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    75
						-- currently every 6 TURNS, should this work
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    76
						-- on ROUNDS instead?
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
    77
local effectTimer = 0
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    78
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    79
--------------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    80
-- hog and team tracking variales
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    81
--------------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    82
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    83
local numhhs = 0 -- store number of hedgehogs
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    84
local hhs = {} -- store hedgehog gears
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    85
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    86
local numTeams --  store the number of teams in the game
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    87
local teamNameArr = {}	-- store the list of teams
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    88
local teamSize = {}	-- store how many hogs per team
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    89
local teamIndex = {} -- at what point in the hhs{} does each team begin
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    90
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    91
-------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    92
-- flag variables
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    93
-------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    94
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    95
local fGear = {}	-- pointer to the case gears that represent the flag
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    96
local fThief = {}	-- pointer to the hogs who stole the flags
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    97
local fIsMissing = {}	-- have the flags been destroyed or captured
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    98
local fNeedsRespawn = {}	-- do the flags need to be respawned
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
    99
local fCaptures = {}	-- the team "scores" how many captures
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   100
local fSpawnX = {}		-- spawn X for flags
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   101
local fSpawnY = {}		-- spawn Y for flags
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   102
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   103
local fThiefX = {}
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   104
local fThiefY = {}
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   105
local FTTC = 0 -- flag thief tracker counter
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   106
--local fThiefsHealed = false
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   107
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   108
local fSpawnC = {}
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   109
local fCirc = {} -- flag/carrier marker circles
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   110
local fCol = {} -- colour of the clans
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   111
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   112
local vCircX = {}
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   113
local vCircY = {}
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   114
local vCircMinA = {}
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   115
local vCircMaxA = {}
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   116
local vCircType = {}
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   117
local vCircPulse = {}
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   118
local vCircFuckAll = {}
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   119
local vCircRadius = {}
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   120
local vCircWidth = {}
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   121
local vCircCol = {}
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   122
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   123
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   124
--------------------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   125
--zone and teleporter variables
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   126
--------------------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   127
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   128
local redTel
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   129
local orangeTel
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   130
--local areaArr = {} -- no longer used
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   131
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   132
local zXMin = {}
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   133
local zWidth = {}
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   134
local zYMin = {}
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   135
local zHeight = {}
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   136
local zOccupied = {}
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   137
local zCount = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   138
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   139
------------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   140
-- zone methods
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   141
------------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   142
-- see on gameTick also
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   143
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   144
function ManageTeleporterEffects()
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   145
	effectTimer = effectTimer + 1
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   146
	if effectTimer > 50 then -- 100
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   147
		effectTimer = 0
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   148
		
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   149
		for i = 0,1 do		
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   150
			eX = 10 + zXMin[i] + GetRandom(zWidth[i]-10)
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   151
			eY = 50 + zYMin[i] + GetRandom(zHeight[i]-110)
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   152
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   153
	-- steam and smoke and DUST look good, smokering looks trippy 
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   154
	-- smoketrace and eviltrace are not effected by wind?
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   155
	-- chunk is a LR falling gear
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   156
			tempE = AddVisualGear(eX, eY, vgtDust, 0, false)		
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   157
			g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   158
			SetVisualGearValues(tempE, eX, eY, g3, g4, g5, g6, g7, g8, g9, fCol[i])
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   159
		end
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   160
	end 
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   161
end
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   162
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   163
function CreateZone(xMin, yMin, width, height)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   164
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   165
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   166
	zXMin[zCount] = xMin
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   167
	zYMin[zCount] = yMin
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   168
	zWidth[zCount] = width
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   169
	zHeight[zCount] = height
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   170
	zOccupied[zCount] = false
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   171
	zCount = zCount + 1
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   172
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   173
	return (zCount-1)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   174
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   175
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   176
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   177
function GearIsInZone(gear, zI)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   178
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   179
	if (GetX(gear) > zXMin[zI]) and (GetX(gear) < (zXMin[zI]+zWidth[zI])) and (GetY(gear) > zYMin[zI]) and (GetY(gear) < (zYMin[zI]+zHeight[zI])) then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   180
		zOccupied[zI] = true
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   181
	else
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   182
		zOccupied[zI] = false
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   183
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   184
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   185
	return zOccupied[zI]
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   186
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   187
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   188
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   189
------------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   190
--flag methods
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   191
------------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   192
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   193
function CheckScore(teamID)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   194
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   195
	if teamID == 0 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   196
		alt = 1
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   197
		winner = "Red"
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   198
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   199
	elseif teamID == 1 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   200
		alt = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   201
		winner = "Blue"
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   202
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   203
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   204
	if fCaptures[teamID] == 2 then
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   205
		for i = 0, (numhhs-1) do
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   206
			if GetHogClan(hhs[i]) == alt then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   207
				SetEffect(hhs[i], heResurrectable, false)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   208
				SetHealth(hhs[i],0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   209
			end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   210
		end
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   211
		--ShowMission("GAME OVER!", "Victory for the " .. winner .. " Team!", "Hooray!", 0, 0)
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   212
		ShowMission(loc("GAME OVER!"), loc("Victory for the ") .. GetHogTeamName(CurrentHedgehog), loc("Hooray!"), 0, 0)
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   213
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   214
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   215
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   216
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   217
function HandleRespawns()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   218
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   219
	for i = 0, 1 do
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   220
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   221
		if fNeedsRespawn[i] == true then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   222
			fGear[i] = SpawnAmmoCrate(fSpawnX[i],fSpawnY[i],amSkip)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   223
			--fGear[i] = SpawnHealthCrate(fSpawnX[i],fSpawnY[i])
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   224
			fNeedsRespawn[i] = false
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   225
			fIsMissing[i] = false -- new, this should solve problems of a respawned flag being "returned" when a player tries to score
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   226
			AddCaption(loc("Flag respawned!"))
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   227
		end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   228
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   229
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   230
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   231
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   232
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   233
function FlagDeleted(gear)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   234
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   235
	if (gear == fGear[0]) then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   236
		wtf = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   237
		bbq = 1
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   238
	elseif (gear == fGear[1]) then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   239
		wtf = 1
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   240
		bbq = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   241
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   242
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   243
	--ShowMission("OH HAI!", "FlagDeleted was called", "Oh noes!", -amBazooka, 0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   244
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   245
	if CurrentHedgehog ~= nil then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   246
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   247
		--ShowMission("GUESS WAT?", "I'm not nil", "Oh noes!", -amBazooka, 0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   248
		--if the player picks up the flag
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   249
		if CheckDistance(CurrentHedgehog, fGear[wtf]) < 1600 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   250
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   251
			fGear[wtf] = nil -- the flag has now disappeared and we shouldnt be pointing to it
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   252
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   253
			-- player has successfully captured the enemy flag
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   254
			if (GetHogClan(CurrentHedgehog) == wtf) and (CurrentHedgehog == fThief[bbq]) and (fIsMissing[wtf] == false) then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   255
				fIsMissing[wtf] = false
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   256
				fNeedsRespawn[wtf] = true
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   257
				fIsMissing[bbq] = false
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   258
				fNeedsRespawn[bbq] = true
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   259
				fCaptures[wtf] = fCaptures[wtf] +1					--fCaptures[wtf]
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   260
				
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   261
				--ShowMission(loc("You have SCORED!!"), "Red Team: " .. fCaptures[0], "Blue Team: " .. fCaptures[1], -amBazooka, 0)
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   262
				ShowMission(loc("You have SCORED!!"), GetHogTeamName(CurrentHedgehog) .. ": " .. fCaptures[wtf], loc("Opposing Team: ") .. fCaptures[bbq], 0, 0)
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   263
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   264
				PlaySound(sndVictory)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   265
				--SetEffect(fThief[bbq], hePoisoned, false)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   266
				fThief[bbq] = nil -- player no longer has the enemy flag
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   267
				CheckScore(wtf)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   268
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   269
			--if the player is returning the flag
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   270
			elseif GetHogClan(CurrentHedgehog) == wtf then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   271
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   272
				fNeedsRespawn[wtf] = true
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   273
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   274
				-- NEW ADDIITON, does this work? Should make it possible to return your flag and then score in the same turn
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   275
				if fIsMissing[wtf] == true then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   276
					HandleRespawns() -- this will set fIsMissing[wtf] to false :)
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   277
					AddCaption(loc("Flag returned!"))
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   278
				elseif fIsMissing[wtf] == false then
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   279
					AddCaption(loc("That was pointless.") .. loc("The flag will respawn next round."))
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   280
				end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   281
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   282
				--fIsMissing[wtf] = false
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   283
				--ShowMission("Flag returned!", "Hooray", "", -amBazooka, 0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   284
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   285
			--if the player is taking the enemy flag
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   286
			elseif GetHogClan(CurrentHedgehog) == bbq then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   287
				fIsMissing[wtf] = true
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   288
				for i = 0,numhhs-1 do
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   289
					if CurrentHedgehog == hhs[i] then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   290
						fThief[wtf] = hhs[i]
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   291
						--SetEffect(fThief[wtf], hePoisoned, true)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   292
					end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   293
				end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   294
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   295
				AddCaption(loc("Flag captured!"))
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   296
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   297
			else --below line doesnt usually get called
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   298
				AddCaption("Hmm... that wasn't supposed to happen...")
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   299
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   300
			end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   301
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   302
		-- if flag has been destroyed, probably
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   303
		else
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   304
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   305
			if GetY(fGear[wtf]) > 2025 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   306
				fGear[wtf] = nil
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   307
				fIsMissing[wtf] = true
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   308
				fNeedsRespawn[wtf] = true
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   309
				HandleRespawns()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   310
			else
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   311
				fGear[wtf] = nil
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   312
				fIsMissing[wtf] = true
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   313
				fNeedsRespawn[wtf] = true
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   314
				AddCaption(loc("Boom!") .. " " .. loc("The flag will respawn next round."))
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   315
			end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   316
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   317
		end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   318
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   319
	-- if flag has been destroyed deep underwater and player is now nil
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   320
	-- probably only gets called if the flag thief drowns himself
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   321
	-- otherwise the above one will work fine
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   322
	else
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   323
		--ShowMission("NIL PLAYER!", "Oh snap", "Oh noes!", -amBazooka, 0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   324
		fGear[wtf] = nil
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   325
		fIsMissing[wtf] = true
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   326
		fNeedsRespawn[wtf] = true
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   327
		AddCaption(loc("The flag will respawn next round."))
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   328
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   329
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   330
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   331
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   332
function FlagThiefDead(gear)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   333
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   334
	if (gear == fThief[0]) then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   335
		wtf = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   336
		bbq = 1
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   337
	elseif (gear == fThief[1]) then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   338
		wtf = 1
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   339
		bbq = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   340
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   341
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   342
	if fThief[wtf] ~= nil then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   343
		--SetEffect(fThief[wtf], hePoisoned, false)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   344
		fGear[wtf] = SpawnAmmoCrate(fThiefX[wtf],fThiefY[wtf]-50,amSkip)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   345
		AddVisualGear(fThiefX[wtf], fThiefY[wtf], vgtBigExplosion, 0, false)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   346
		fThief[wtf] = nil
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   347
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   348
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   349
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   350
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   351
function HandleCircles()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   352
	
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   353
	for i = 0, 1 do
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   354
		if fIsMissing[i] == false then -- draw a circle at the flag's spawning place
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   355
			--SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 33, 2, fCol[i])
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   356
			SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i])
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   357
		elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   358
			if fThief[i] ~= nil then -- draw circle round flag carrier
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   359
				--SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], 20, 200, 0, 0, 100, 33, 2, fCol[i])
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   360
				SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i])
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   361
			elseif fThief[i] == nil then -- draw cirle round dropped flag
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   362
				--SetVisualGearValues(fCirc[i], GetX(fGear[i]), GetY(fGear[i]), 20, 200, 0, 0, 100, 33, 2, fCol[i])
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   363
				SetVisualGearValues(fCirc[i], GetX(fGear[i]),GetY(fGear[i]), vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i])
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   364
			end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   365
		end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   366
		
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   367
		if fNeedsRespawn[i] == true then -- if the flag has been destroyed, no need for a circle
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   368
			SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 0, 0, fCol[i])
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   369
		end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   370
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   371
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   372
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   373
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   374
------------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   375
-- general methods
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   376
------------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   377
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   378
function CheckDistance(gear1, gear2)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   379
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   380
	g1X, g1Y = GetGearPosition(gear1)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   381
	g2X, g2Y = GetGearPosition(gear2)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   382
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   383
	g1X = g1X - g2X
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   384
	g1Y = g1Y - g2Y
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   385
	z = (g1X*g1X) + (g1Y*g1Y)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   386
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   387
	--dist = math.sqrt(z)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   388
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   389
	dist = z
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   390
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   391
	return dist
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   392
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   393
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   394
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   395
function CheckTeleporters()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   396
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   397
	teleportActive = false
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   398
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   399
	if (GearIsInZone(CurrentHedgehog, redTel) == true) and (GetHogClan(CurrentHedgehog) == 0) then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   400
		teleportActive = true
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   401
		destinationX = 1402
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   402
		destinationY = 321
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   403
	elseif (GearIsInZone(CurrentHedgehog, orangeTel) == true) and (GetHogClan(CurrentHedgehog) == 1) then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   404
		teleportActive = true
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   405
		destinationX = 2692
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   406
		destinationY = 321
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   407
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   408
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   409
	if teleportActive == true then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   410
		if actionReset == 0 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   411
			SetGearMessage(CurrentHedgehog, gmAttack)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   412
			--AddCaption(actionReset .. ";" .. "attack")
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   413
		elseif actionReset == 10 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   414
			SetGearMessage(CurrentHedgehog, 0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   415
			--AddCaption(actionReset .. ";" .. "reset")
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   416
		elseif actionReset == 20 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   417
			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   418
			SetGearPosition(CurrentHedgehog,destinationX,destinationY)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   419
			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   420
			--AddCaption(actionReset .. ";" .. "teleport")
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   421
		end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   422
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   423
		actionReset = actionReset + 1
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   424
		if actionReset >= 30 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   425
			actionReset = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   426
		end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   427
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   428
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   429
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   430
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   431
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   432
function RebuildTeamInfo()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   433
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   434
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   435
	-- make a list of individual team names
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   436
	for i = 0, 5 do
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   437
		teamNameArr[i] = i
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   438
		teamSize[i] = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   439
		teamIndex[i] = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   440
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   441
	numTeams = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   442
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   443
	for i = 0, (numhhs-1) do
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   444
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   445
		z = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   446
		unfinished = true
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   447
		while(unfinished == true) do
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   448
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   449
			newTeam = true
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   450
			tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   451
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   452
			if tempHogTeamName == teamNameArr[z] then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   453
				newTeam = false
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   454
				unfinished = false
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   455
			end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   456
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   457
			z = z + 1
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   458
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   459
			if z == TeamsCount then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   460
				unfinished = false
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   461
				if newTeam == true then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   462
					teamNameArr[numTeams] = tempHogTeamName
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   463
					numTeams = numTeams + 1
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   464
				end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   465
			end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   466
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   467
		end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   468
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   469
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   470
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   471
	-- find out how many hogs per team, and the index of the first hog in hhs
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   472
	for i = 0, numTeams-1 do
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   473
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   474
		for z = 0, numhhs-1 do
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   475
			if GetHogTeamName(hhs[z]) == teamNameArr[i] then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   476
				if teamSize[i] == 0 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   477
					teamIndex[i] = z -- should give starting index
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   478
				end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   479
				teamSize[i] = teamSize[i] + 1
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   480
				--add a pointer so this hog appears at i in hhs
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   481
			end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   482
		end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   483
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   484
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   485
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   486
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   487
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   488
function HandleCrateDrops()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   489
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   490
	roundsCounter = roundsCounter +1
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   491
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   492
	if roundsCounter == 5 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   493
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   494
		roundsCounter = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   495
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   496
		r = GetRandom(8)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   497
		if r == 0 then
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   498
			SpawnUtilityCrate(0,0,amSwitch)
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   499
		elseif r == 1 then
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   500
			SpawnUtilityCrate(0,0,amTeleport)
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   501
		elseif r == 2 then
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   502
			SpawnUtilityCrate(0,0,amJetpack)
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   503
		elseif r == 3 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   504
			SpawnUtilityCrate(0,0,amExtraTime)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   505
		elseif r == 4 then
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   506
			SpawnUtilityCrate(0,0,amGirder)
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   507
		elseif r == 5 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   508
			SpawnAmmoCrate(0,0,amDynamite)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   509
		elseif r == 6 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   510
			SpawnAmmoCrate(0,0,amFlamethrower)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   511
		elseif r == 7 then
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   512
			SpawnUtilityCrate(0,0,amPortalGun)
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   513
		end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   514
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   515
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   516
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   517
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   518
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   519
------------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   520
-- game methods
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   521
------------------------
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   522
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   523
function onGameInit()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   524
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   525
	-- Things we don't modify here will use their default values.
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   526
	GameFlags = gfDivideTeams -- Game settings and rules
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   527
	TurnTime = 30000 -- (was 30) The time the player has to move each round (in ms)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   528
	CaseFreq = 0 -- The frequency of crate drops
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   529
	MinesNum = 0 -- The number of mines being placed
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   530
	MinesTime  = 2000
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   531
	Explosives = 0 -- The number of explosives being placed
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   532
	Delay = 10 -- The delay between each round
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   533
	SuddenDeathTurns = 99 -- suddendeath is off, effectively
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   534
	Map = "Blizzard" -- The map to be played
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   535
	Theme = "Snow" -- The theme to be used "Nature"
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   536
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   537
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   538
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   539
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   540
function onGameStart()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   541
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   542
	--ShowMission(loc(caption), loc(subcaption), loc(goal), 0, 0)
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   543
	ShowMission(loc("CTF_BLIZZARD") .. " 0.5", loc("by mikade"), loc(" - Return the enemy flag to your base to score | - First team to 3 captures wins | - You may only score when your flag is in your base | - Hogs will drop the flag if killed, or drowned | - Dropped flags may be returned or recaptured | - Hogs respawn when killed"), 0, 0)
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   544
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   545
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   546
	-- initialize teleporters
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   547
	redTel = CreateZone(342,1316,42,449)	-- red teleporter
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   548
	orangeTel = CreateZone(3719,1330,45,449)	-- orange teleporter
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   549
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   550
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   551
	--new improved placement schematics aw yeah
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   552
	RebuildTeamInfo()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   553
	--ShowMission("Team Info Rebuilt", "Here you go:", "TeamCount: " .. TeamsCount .. "|" .. teamNameArr[0] .. ": " .. teamSize[0] .. " Hogs|" .. teamNameArr[1] .. ": " .. teamSize[1] .. " Hogs|" .. teamNameArr[2] .. ": " .. teamSize[2] .. " Hogs|", 0, 0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   554
	team1Placed = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   555
	team2Placed = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   556
	for i = 0, (TeamsCount-1) do
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   557
		for g = teamIndex[i], (teamIndex[i]+teamSize[i]-1) do
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   558
			if GetHogClan(hhs[g]) == 0 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   559
				SetGearPosition(hhs[g],1403+ ((team1Placed+1)*50),1570)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   560
				team1Placed = team1Placed +1
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   561
				if team1Placed > 6 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   562
					team1Placed = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   563
				end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   564
			elseif GetHogClan(hhs[g]) == 1 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   565
				SetGearPosition(hhs[g],2230+ ((team2Placed+1)*50),1570)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   566
				team2Placed = team2Placed +1
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   567
				if team2Placed > 6 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   568
					team2Placed = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   569
				end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   570
			end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   571
		end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   572
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   573
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   574
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   575
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   576
	--spawn starting ufos and or super weapons
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   577
	SpawnAmmoCrate(2048,1858,amJetpack)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   578
	--SpawnUtilityCrate(2048,1858,amExtraTime)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   579
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   580
	--set flag spawn points and spawn the flags
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   581
	fSpawnX[0] = 957
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   582
	fSpawnY[0] = 1747
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   583
	fSpawnX[1] = 3123
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   584
	fSpawnY[1] = 1747
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   585
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   586
	for i = 0, 1 do
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   587
		fGear[i] = SpawnAmmoCrate(fSpawnX[i],fSpawnY[i],amSkip)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   588
		fCirc[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true)
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   589
		fCol[i] = GetClanColor(i)	
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   590
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   591
		fSpawnC[i] = AddVisualGear(fSpawnX[i],fSpawnY[i],vgtCircle,0,true)
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   592
		SetVisualGearValues(fSpawnC[i], fSpawnX[i],fSpawnY[i], 10, 200, 1, 10, 0, 300, 5, fCol[i])		
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   593
		
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   594
	
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   595
		fIsMissing[i] = false
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   596
		fNeedsRespawn[i] = false
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   597
		fCaptures[i] = 0
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   598
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   599
		vCircMinA[i] = 20
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   600
		vCircMaxA[i] = 255
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   601
		vCircType[i] = 1
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   602
		vCircPulse[i] = 10
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   603
		vCircFuckAll[i] = 0
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   604
		vCircRadius[i] = 150
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   605
		vCircWidth[i] = 5
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   606
		vCircCol[i] = fCol[i]
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   607
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   608
		SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i])
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   609
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   610
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   611
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   612
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   613
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   614
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   615
function onNewTurn()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   616
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   617
	if lastTeam ~= GetHogTeamName(CurrentHedgehog) then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   618
		lastTeam = GetHogTeamName(CurrentHedgehog)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   619
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   620
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   621
	for i = 0, 1 do
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   622
		if fThief[i] ~= nil then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   623
			--adjust = 5 + GetHealth(fThief[i])
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   624
			--SetHealth(fThief[i], adjust)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   625
			--AddCaption('Helped out the flag poisoned flag thiefs')
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   626
		end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   627
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   628
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   629
	--AddCaption("Handling respawns")
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   630
	HandleRespawns()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   631
	HandleCrateDrops()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   632
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   633
	--myC = AddVisualGear(GetX(CurrentHedgehog),GetY(CurrentHedgehog),vgtCircle,0,true)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   634
	--SetVisualGearValues(myC, GetX(CurrentHedgehog),GetY(CurrentHedgehog), 20, 200, 0, 0, 100, 50, 3, GetClanColor(GetHogClan(CurrentHedgehog)))	
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   635
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   636
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   637
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   638
function onGameTick()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   639
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   640
	-- onRessurect calls AFTER you have resurrected,
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   641
	-- so keeping track of x,y a few milliseconds before
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   642
	-- is useful
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   643
	--FTTC = FTTC + 1
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   644
	--if FTTC == 100 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   645
	--	FTTC = 0
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   646
		for i = 0,1 do
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   647
			if fThief[i] ~= nil then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   648
				fThiefX[i] = GetX(fThief[i])
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   649
				fThiefY[i] = GetY(fThief[i])
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   650
			end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   651
		end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   652
	--end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   653
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   654
	-- things we wanna check often
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   655
	if (CurrentHedgehog ~= nil) then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   656
		--AddCaption(GetX(CurrentHedgehog) .. "; " .. GetY(CurrentHedgehog))
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   657
		--AddCaption("Checking Teleporters")
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   658
		CheckTeleporters()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   659
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   660
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   661
	HandleCircles()
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   662
	ManageTeleporterEffects()
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   663
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   664
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   665
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   666
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   667
function onAmmoStoreInit()
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   668
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   669
	SetAmmo(amDrill,9,0,0,0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   670
	SetAmmo(amMortar,9,0,0,0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   671
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   672
	SetAmmo(amGrenade,9,0,0,0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   673
	SetAmmo(amClusterBomb,4,0,0,0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   674
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   675
	--SetAmmo(amDEagle, 4, 0, 0, 0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   676
	SetAmmo(amShotgun, 9, 0, 0, 0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   677
	SetAmmo(amFlamethrower, 1, 0, 0, 1)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   679
	SetAmmo(amFirePunch, 9, 0, 0, 0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   680
	SetAmmo(amBaseballBat, 2, 0, 0, 0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   681
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   682
	SetAmmo(amDynamite,2,0,0,1)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   683
	SetAmmo(amSMine,4,0,0,0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   684
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   685
	SetAmmo(amBlowTorch, 9, 0, 0, 0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   686
	SetAmmo(amPickHammer, 9, 0, 0, 0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   687
	SetAmmo(amGirder, 2, 0, 0, 2)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   688
	SetAmmo(amPortalGun, 2, 0, 0, 2)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   689
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   690
	SetAmmo(amParachute, 9, 0, 0, 0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   691
	SetAmmo(amRope, 9, 0, 0, 0)
4698
6f14ef3e40ae Updated maps CTF, Control and new unscripted map Blizzard
mikade
parents: 4678
diff changeset
   692
	SetAmmo(amTeleport, 1, 0, 0, 1)
4678
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   693
	SetAmmo(amJetpack, 1, 0, 0, 1)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   694
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   695
	SetAmmo(amSwitch, 2, 0, 0, 1)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   696
	SetAmmo(amExtraTime,1,0,0,1)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   697
	SetAmmo(amLowGravity,1,0,0,0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   698
	SetAmmo(amSkip, 9, 0, 0, 0)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   699
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   700
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   701
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   702
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   703
function onGearResurrect(gear)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   704
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   705
	--AddCaption("A gear has been resurrected!")
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   706
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   707
	-- mark the flag thief as dead if he needed a respawn
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   708
	for i = 0,1 do
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   709
		if gear == fThief[i] then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   710
			FlagThiefDead(gear)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   711
		end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   712
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   713
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   714
	-- place hogs belonging to each clan either left or right side of map
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   715
	if GetHogClan(gear) == 0 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   716
		FindPlace(gear, false, 0, 2048)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   717
	elseif GetHogClan(gear) == 1 then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   718
		FindPlace(gear, false, 2048, LAND_WIDTH)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   719
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   720
	
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   721
	AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   722
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   723
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   724
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   725
function onGearDamage(gear, damage)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   726
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   727
	-- >_< damn, occurs too fast, before the hog has finished moving / updated his health	
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   728
	--if GetGearType(gear) == gtHedgehog then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   729
	--	if damage > GetHealth(gear) then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   730
	--		AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false)		
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   731
	--	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   732
	--end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   733
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   734
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   735
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   736
function onGearAdd(gear)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   737
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   738
	if GetGearType(gear) == gtHedgehog then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   739
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   740
		hhs[numhhs] = gear
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   741
		numhhs = numhhs + 1
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   742
		SetEffect(gear, heResurrectable, true)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   743
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   744
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   745
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   746
end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   747
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   748
function onGearDelete(gear)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   749
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   750
	if (gear == fGear[0]) or (gear == fGear[1]) then
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   751
		FlagDeleted(gear)
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   752
	end
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   753
50716b795a4e Capture the flag (Blizzard) Map
Palewolf
parents:
diff changeset
   754
end