share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
author nemo
Fri, 08 Mar 2013 08:17:11 -0500
changeset 8692 935960dbc60e
parent 8682 158d7b36b18e
child 8713 5611011e40b5
permissions -rw-r--r--
lock weapons since script doesn't support custom sets anyway (yet). Use bor on flags to allow other game flags.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
     1
--------------------------------
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
     2
-- HIGHLANDER / HOGS OF WAR
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
     3
-- version 0.4
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
     4
-- by mikade
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
     5
--------------------------------
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
     6
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
     7
-----------
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
     8
--0.1
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
     9
-----------
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    10
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    11
-- concept test
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    12
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    13
-----------
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    14
--0.2
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    15
-----------
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    16
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    17
-- remove tardis till Henek fixes his tracker
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    18
-- change wep crates to health crates
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    19
-- reset arb turntimevalue
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    20
-- include randomOrder
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    21
-- Until fixed .17 methods come out, remove switches and resurrector
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    22
-- on request, removed kamikaze and piano weapons
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    23
-- provisional fixing of bugs that can't actually be fixed yet
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    24
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    25
-----------
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    26
--0.3
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    27
-----------
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    28
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    29
-- meh, update incorrect display
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    30
-- may change this in the future to have switches
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    31
-- but for now people are used to it without, so~
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    32
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    33
-- mudball is now counted as a utility
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    34
6378
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    35
-----------
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    36
--0.3b
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    37
-----------
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    38
6378
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    39
-- cleaned up code and got rid of unneccessary vars
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    40
-- mudball is a weapon again
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    41
-- landgun is now a utility
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    42
-- extra time, vampirism utility removed
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    43
-- hammer wep removed
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    44
-- all hogs have kamikaze
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    45
6820
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    46
-----------
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    47
--0.3c
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    48
-----------
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    49
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    50
-- restructured some code
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    51
-- added napalm (whoops) to list of possible weapons you can get
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    52
-- hogs no longer recieve airstrike-related weps on border maps
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    53
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    54
-----------
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    55
--0.4
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    56
-----------
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    57
-- fix same name/blank weapon transfer bug (issue 541)
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    58
-- show next hog ammo set in full (issue 312)
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    59
-- allow mid-kill multi-shot weapon transfers (issue 503)
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    60
-- allow users to configure hog health
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    61
-- remove 'switched to' message
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    62
-- remove some extraeneous code
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    63
-- add more whitespace
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    64
-- break everything
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    65
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    66
-------------------------
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    67
-- ideas for the future
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    68
-------------------------
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    69
-- add ice gun, structure
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    70
-- allow switcher, resurrector
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    71
-- add abuse
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    72
-- nerf teleport
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    73
-- allow more customization
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    74
-- poison hogs using the default team? :/
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    75
-- balance weapon distribution across entire team / all teams
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    76
-- add other inequalities/bonuses like... ???
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    77
-- some hogs start off with an extra 25 health?
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    78
-- some hogs start off poisoned?
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    79
-- some hogs start off with a rope and 2 drills but die after their turn?
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    80
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    81
-------------------------------
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    82
-- derp, script follows
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    83
-------------------------------
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    84
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    85
loadfile(GetDataPath() .. "Scripts/Locale.lua")()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    86
loadfile(GetDataPath() .. "Scripts/Tracker.lua")()
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    87
6820
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    88
local airWeapons = 	{amAirAttack, amMineStrike, amNapalm, amDrillStrike --[[,amPiano]]}
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    89
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    90
local atkArray = 	{
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    91
					amBazooka, amBee, amMortar, amDrill, --[[amSnowball,]]
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    92
					amGrenade, amClusterBomb, amMolotov, amWatermelon, amHellishBomb, amGasBomb,
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    93
					amShotgun, amDEagle, amFlamethrower, amSniperRifle, amSineGun,
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    94
					amFirePunch, amWhip, amBaseballBat, --[[amKamikaze,]] amSeduction, --[[amHammer,]]
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    95
					amMine, amDynamite, amCake, amBallgun, amRCPlane, amSMine,
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    96
					amRCPlane, amSMine,
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    97
					amBirdy
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    98
					}
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    99
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   100
local utilArray = 	{
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   101
					amBlowTorch, amPickHammer, amGirder, amPortalGun,
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   102
					amRope, amParachute, amTeleport, amJetpack,
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   103
					amInvulnerable, amLaserSight, --[[amVampiric,]]
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   104
					amLowGravity, amExtraDamage, --[[amExtraTime,]]
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   105
					amLandGun
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   106
					--[[,amTardis, amResurrector, amSwitch]]
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   107
					}
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   108
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   109
local wepArray = 	{}
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   110
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   111
local currHog
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   112
local lastHog
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   113
local started = false
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   114
local switchStage = 0
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   115
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   116
local lastWep = amNothing
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   117
local shotsFired = 0
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   118
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   119
function CheckForWeaponSwap()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   120
	if GetCurAmmoType() ~= lastWep then
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   121
		shotsFired = 0
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   122
	end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   123
	lastWep = GetCurAmmoType()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   124
end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   125
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   126
function onSlot()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   127
	CheckForWeaponSwap()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   128
end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   129
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   130
function onSetWeapon()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   131
	CheckForWeaponSwap()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   132
end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   133
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   134
function onHogAttack()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   135
	CheckForWeaponSwap()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   136
	shotsFired = shotsFired + 1
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   137
end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   138
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   139
function StartingSetUp(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   140
6820
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   141
	for i = 1, #wepArray do
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   142
		setGearValue(gear,wepArray[i],0)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   143
	end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   144
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   145
	setGearValue(gear,amKamikaze,100)
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   146
	setGearValue(gear,amSkip,100)
6378
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
   147
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
   148
	i = 1 + GetRandom(#atkArray)
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   149
	setGearValue(gear,atkArray[i],1)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   150
6378
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
   151
	i = 1 + GetRandom(#utilArray)
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   152
	setGearValue(gear,utilArray[i],1)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   153
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   154
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   155
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   156
--[[function SaveWeapons(gear)
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   157
-- er, this has no 0 check so presumably if you use a weapon then when it saves  you wont have it
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   158
6378
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
   159
	for i = 1, (#wepArray) do
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   160
		setGearValue(gear, wepArray[i], GetAmmoCount(gear, wepArray[i]) )
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   161
		 --AddAmmo(gear, wepArray[i], getGearValue(gear,wepArray[i]) )
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   162
	end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   163
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   164
end]]
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   165
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   166
function ConvertValues(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   167
6820
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   168
	for i = 1, #wepArray do
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   169
		AddAmmo(gear, wepArray[i], getGearValue(gear,wepArray[i]) )
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   170
	end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   171
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   172
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   173
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   174
-- this is called when a hog dies
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   175
function TransferWeps(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   176
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   177
	if CurrentHedgehog ~= nil then
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   178
6820
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   179
		for i = 1, #wepArray do
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   180
			val = getGearValue(gear,wepArray[i])
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   181
			if val ~= 0 then
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   182
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   183
				setGearValue(CurrentHedgehog, wepArray[i], val)
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   184
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   185
				-- if you are using multi-shot weapon, gimme one more
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   186
				if (GetCurAmmoType()  == wepArray[i]) and (shotsFired ~= 0) then
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   187
					AddAmmo(CurrentHedgehog, wepArray[i], val+1)
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   188
				-- assign ammo as per normal
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   189
				else
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   190
					AddAmmo(CurrentHedgehog, wepArray[i], val)
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   191
				end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   192
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   193
			end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   194
		end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   195
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   196
	end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   197
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   198
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   199
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   200
function onGameInit()
8692
935960dbc60e lock weapons since script doesn't support custom sets anyway (yet). Use bor on flags to allow other game flags.
nemo
parents: 8682
diff changeset
   201
	GameFlags = bor(GameFlags,gfInfAttack + gfRandomOrder + gfPerHogAmmo)
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   202
	HealthCaseProb = 100
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   203
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   204
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   205
function onGameStart()
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   206
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   207
	ShowMission	(
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   208
				loc("HIGHLANDER"),
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   209
				loc("Not all hogs are born equal."),
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   210
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   211
				"- " .. loc("Eliminate enemy hogs and take their weapons.") .. "|" ..
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   212
				"- " .. loc("Per-Hog Ammo") .. "|" ..
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   213
				"- " .. loc("Weapons reset.") .. "|" ..
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   214
				"- " .. loc("Unlimited Attacks") .. "|" ..
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   215
				"", 4, 4000
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   216
				)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   217
6820
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   218
	if MapHasBorder() == false then
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   219
       	for i, w in pairs(airWeapons) do
6820
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   220
            table.insert(atkArray, w)
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   221
        end
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   222
	end
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   223
6820
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   224
	for i, w in pairs(atkArray) do
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   225
        table.insert(wepArray, w)
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   226
	end
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   227
6820
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   228
	for i, w in pairs(utilArray) do
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   229
        table.insert(wepArray, w)
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   230
	end
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   231
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   232
	table.insert(wepArray, amSkip)
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   233
	table.insert(wepArray, amKamikaze)
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   234
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   235
	runOnGears(StartingSetUp)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   236
	runOnGears(ConvertValues)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   237
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   238
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   239
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   240
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   241
function CheckForHogSwitch()
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   242
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   243
	if (CurrentHedgehog ~= nil) then
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   244
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   245
		currHog = CurrentHedgehog
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   246
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   247
		if currHog ~= lastHog then
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   248
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   249
			-- re-assign ammo to this guy, so that his entire ammo set will
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   250
			-- be visible during another player's turn
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   251
			if lastHog ~= nil then
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   252
				ConvertValues(lastHog)
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   253
			end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   254
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   255
			-- give the new hog what he is supposed to have, too
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   256
			ConvertValues(CurrentHedgehog)
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   257
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   258
		end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   259
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   260
		lastHog = currHog
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   261
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   262
	end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   263
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   264
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   265
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   266
function onNewTurn()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   267
	CheckForHogSwitch()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   268
end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   269
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   270
--function onGameTick20()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   271
--CheckForHogSwitch()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   272
-- if we use gfPerHogAmmo is this even needed? Err, well, weapons reset, so... yes?
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   273
-- orrrr, should we rather call the re-assignment of weapons onNewTurn()? probably not because
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   274
-- then you cant switch hogs... unless we add a thing in onSwitch or whatever
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   275
-- ye, that is probably better actually, but I'll add that when/if I add switch
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   276
--end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   277
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   278
--[[function onHogHide(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   279
	-- waiting for Henek
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   280
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   281
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   282
function onHogRestore(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   283
	-- waiting for Henek
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   284
end]]
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   285
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   286
function onGearAdd(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   287
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   288
	--if GetGearType(gear) == gtSwitcher then
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   289
	--	SaveWeapons(CurrentHedgehog)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   290
	--end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   291
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   292
	if (GetGearType(gear) == gtHedgehog) then
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   293
		trackGear(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   294
	end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   295
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   296
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   297
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   298
function onGearDelete(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   299
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   300
	if (GetGearType(gear) == gtHedgehog) then --or (GetGearType(gear) == gtResurrector) then
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   301
		TransferWeps(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   302
		trackDeletion(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   303
	end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   304
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   305
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   306
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   307
function onAmmoStoreInit()
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   308
	-- no, you can't set your own ammo scheme
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   309
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   310