share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
author Wuzzy <Wuzzy2@mail.ru>
Thu, 03 May 2018 22:12:13 +0200
changeset 13377 57e15407804d
parent 13280 7ed4ab32f351
child 13455 f38b72d64157
permissions -rw-r--r--
Continental supplies: Fix continent ammo tooltip containing annoying "use of this weapon does not end turn"
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
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
     3
-- by mikade
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
     4
--------------------------------
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
     5
12708
6726d5edfdfb Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents: 12345
diff changeset
     6
-- Ancient changelog:
6726d5edfdfb Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents: 12345
diff changeset
     7
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
     8
-----------
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
     9
--0.1
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    10
-----------
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    11
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    12
-- concept test
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    13
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    14
-----------
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    15
--0.2
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    16
-----------
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    17
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    18
-- remove tardis till Henek fixes his tracker
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    19
-- change wep crates to health crates
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    20
-- reset arb turntimevalue
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    21
-- include randomOrder
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    22
-- Until fixed .17 methods come out, remove switches and resurrector
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    23
-- on request, removed kamikaze and piano weapons
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    24
-- provisional fixing of bugs that can't actually be fixed yet
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    25
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    26
-----------
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    27
--0.3
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    28
-----------
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    29
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    30
-- meh, update incorrect display
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    31
-- may change this in the future to have switches
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    32
-- but for now people are used to it without, so~
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    33
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    34
-- mudball is now counted as a utility
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    35
6378
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    36
-----------
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    37
--0.3b
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    38
-----------
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    39
6378
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    40
-- cleaned up code and got rid of unneccessary vars
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    41
-- mudball is a weapon again
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    42
-- landgun is now a utility
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    43
-- extra time, vampirism utility removed
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    44
-- hammer wep removed
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
    45
-- all hogs have kamikaze
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    46
6820
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    47
-----------
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    48
--0.3c
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
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    51
-- restructured some code
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
    52
-- 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
    53
-- 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
    54
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    55
-----------
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    56
--0.4
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    57
-----------
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    58
-- fix same name/blank weapon transfer bug (issue 541)
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    59
-- show next hog ammo set in full (issue 312)
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    60
-- allow mid-kill multi-shot weapon transfers (issue 503)
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    61
-- allow users to configure hog health
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    62
-- remove 'switched to' message
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    63
-- remove some extraeneous code
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    64
-- add more whitespace
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    65
-- break everything
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    66
9085
092051fda7e1 As per request, add ice-gun (untested!)
mikade <redgrinner@gmail.com>
parents: 8713
diff changeset
    67
-----------
092051fda7e1 As per request, add ice-gun (untested!)
mikade <redgrinner@gmail.com>
parents: 8713
diff changeset
    68
--0.4b
092051fda7e1 As per request, add ice-gun (untested!)
mikade <redgrinner@gmail.com>
parents: 8713
diff changeset
    69
-----------
092051fda7e1 As per request, add ice-gun (untested!)
mikade <redgrinner@gmail.com>
parents: 8713
diff changeset
    70
-- as per request, add ice-gun
092051fda7e1 As per request, add ice-gun (untested!)
mikade <redgrinner@gmail.com>
parents: 8713
diff changeset
    71
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    72
-------------------------
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    73
-- ideas for the future
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    74
-------------------------
9085
092051fda7e1 As per request, add ice-gun (untested!)
mikade <redgrinner@gmail.com>
parents: 8713
diff changeset
    75
-- add structure
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    76
-- allow switcher, resurrector
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    77
-- add abuse
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    78
-- nerf teleport
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    79
-- allow more customization
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    80
-- poison hogs using the default team? :/
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    81
-- balance weapon distribution across entire team / all teams
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    82
-- add other inequalities/bonuses like... ???
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    83
-- some hogs start off with an extra 25 health?
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    84
-- some hogs start off poisoned?
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    85
-- 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
    86
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    87
-------------------------------
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    88
-- derp, script follows
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    89
-------------------------------
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
    90
8713
5611011e40b5 fix highlander - needed new script load function
nemo
parents: 8692
diff changeset
    91
HedgewarsScriptLoad("/Scripts/Locale.lua")
5611011e40b5 fix highlander - needed new script load function
nemo
parents: 8692
diff changeset
    92
HedgewarsScriptLoad("/Scripts/Tracker.lua")
10219
bbeb1e9aaa65 param for original highlander mode - right now just allows getting another copy of a weapon you already had, but had used that turn.
nemo
parents: 10096
diff changeset
    93
HedgewarsScriptLoad("/Scripts/Params.lua")
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
    94
12711
b5e2834cd7b3 Fix rubber duck not being used in Highlander
Wuzzy <almikes@aol.com>
parents: 12709
diff changeset
    95
-- These define weps allowed by the script.
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
    96
-- These were arbitrarily defined out-of-order in initial script, so that was preserved here, resulting 
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
    97
-- in a moderately odd syntax.
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
    98
local atkWeps = 	{
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
    99
					[amBazooka]=true, [amBee]=true, [amMortar]=true, [amDrill]=true, [amSnowball]=true,
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   100
                    [amGrenade]=true, [amClusterBomb]=true, [amMolotov]=true, [amWatermelon]=true,
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   101
                    [amHellishBomb]=true, [amGasBomb]=true, [amShotgun]=true, [amDEagle]=true,
12961
89930daecaab Add minigun to scripts. Also add a few missing ammos to BRW and RW
Wuzzy <Wuzzy2@mail.ru>
parents: 12711
diff changeset
   102
                    [amFlamethrower]=true, [amSniperRifle]=true, [amSineGun]=true, [amMinigun]=true,
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   103
					[amFirePunch]=true, [amWhip]=true, [amBaseballBat]=true, [amKamikaze]=true,
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   104
                    [amSeduction]=true, [amHammer]=true, [amMine]=true, [amDynamite]=true, [amCake]=true,
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   105
                    [amBallgun]=true, [amSMine]=true, [amRCPlane]=true, [amBirdy]=true, [amKnife]=true,
10997
af84b2411f27 update hl for .22 airmines
nemo
parents: 10865
diff changeset
   106
                    [amAirAttack]=true, [amMineStrike]=true, [amNapalm]=true, [amDrillStrike]=true, [amPiano]=true, [amAirMine] = true,
12711
b5e2834cd7b3 Fix rubber duck not being used in Highlander
Wuzzy <almikes@aol.com>
parents: 12709
diff changeset
   107
                    [amDuck]=true,
6820
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
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   110
local utilWeps =  {
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   111
					[amBlowTorch]=true, [amPickHammer]=true, [amGirder]=true, [amPortalGun]=true,
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   112
					[amRope]=true, [amParachute]=true, [amTeleport]=true, [amJetpack]=true,
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   113
					[amInvulnerable]=true, [amLaserSight]=true, [amVampiric]=true,
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   114
					[amLowGravity]=true, [amExtraDamage]=true, [amExtraTime]=true,
10865
a587145ced34 remove switch from allowed utilities. 14:57 <@unC0Rr> way too OP
nemo
parents: 10250
diff changeset
   115
					[amLandGun]=true, [amRubber]=true, [amIceGun]=true,
6820
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   116
					}
7db9e89b3f80 - don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents: 6378
diff changeset
   117
12711
b5e2834cd7b3 Fix rubber duck not being used in Highlander
Wuzzy <almikes@aol.com>
parents: 12709
diff changeset
   118
-- Intentionally left out:
b5e2834cd7b3 Fix rubber duck not being used in Highlander
Wuzzy <almikes@aol.com>
parents: 12709
diff changeset
   119
-- * Resurrector (guaranteed to screw up the game)
b5e2834cd7b3 Fix rubber duck not being used in Highlander
Wuzzy <almikes@aol.com>
parents: 12709
diff changeset
   120
-- * Time Box
b5e2834cd7b3 Fix rubber duck not being used in Highlander
Wuzzy <almikes@aol.com>
parents: 12709
diff changeset
   121
-- * Switch Hedgehog (not sure why)
b5e2834cd7b3 Fix rubber duck not being used in Highlander
Wuzzy <almikes@aol.com>
parents: 12709
diff changeset
   122
10088
nemo
parents: 10083
diff changeset
   123
local wepArray = {}
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   124
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   125
local atkChoices = {}
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   126
local utilChoices = {}
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   127
12325
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   128
local currHog
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   129
local lastHog
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   130
local started = false
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   131
local switchStage = 0
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   132
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   133
local lastWep = amNothing
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   134
local shotsFired = 0
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   135
10088
nemo
parents: 10083
diff changeset
   136
local probability = {1,2,5,10,20,50,200,500,1000000};
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   137
local atktot = 0
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   138
local utiltot = 0
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   139
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   140
local someHog = nil -- just for looking up the weps
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   141
12708
6726d5edfdfb Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents: 12345
diff changeset
   142
-- Script parameter stuff
13280
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   143
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   144
--[[ Loyal Highlander.
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   145
If true, killing hogs of your own clan doesn't give you their weapons.
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   146
Otherwise, killing any hog gives you their weapons. ]]
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   147
local loyal = false
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   148
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   149
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   150
--[[ Multiple weapon usages.
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   151
This is a bit tricky to explain.
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   152
First, remind yourselves that hogs can never hold more than 1 of the same ammo type.
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   153
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   154
This param changes how ammo will be restocked after killing a hog if you
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   155
already owned this ammo.
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   156
Basically this is about if you can use the same weapon multiple times in a
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   157
turn by killing enemies in a clever way.
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   158
We need to distinguish between your current inventory and the “reset inventory”,
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   159
that is, the state to which your inventory will get reset in the next turn.
10219
bbeb1e9aaa65 param for original highlander mode - right now just allows getting another copy of a weapon you already had, but had used that turn.
nemo
parents: 10096
diff changeset
   160
13280
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   161
No Multi-Use (default):
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   162
    If you kill a hog who owns a weapon you currently have in your reset inventory,
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   163
    but not your inventory, you DO NOT get this weapon again.
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   164
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   165
Multi-Use:
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   166
    If you kill a hog who owns a weapon you currently have in your reset inventory,
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   167
    but not your inventory, you DO get this weapon.
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   168
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   169
Example 1:
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   170
    You have a ballgun, and use it to kill a hog who also owns a ballgun.
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   171
    No Multi-Use: You will NOT get another ballgun, since it's in your
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   172
                  reset inventory.
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   173
    Multi-Use: You get another ballgun.
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   174
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   175
Example 2:
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   176
    You have a grenade and a bazooka in your inventory. You use the bazooka
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   177
    to kill a hedgehog who owns a grenade.
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   178
    In both ammo limit modes, you do NOT win any ammo since you already have
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   179
    a grenade in your inventory (not just your reset inventory), and the
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   180
    rule “no more than 1 ammo per type” applies.
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   181
]]
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   182
local multiUse = false
12708
6726d5edfdfb Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents: 12345
diff changeset
   183
10219
bbeb1e9aaa65 param for original highlander mode - right now just allows getting another copy of a weapon you already had, but had used that turn.
nemo
parents: 10096
diff changeset
   184
function onParameters()
bbeb1e9aaa65 param for original highlander mode - right now just allows getting another copy of a weapon you already had, but had used that turn.
nemo
parents: 10096
diff changeset
   185
    parseParams()
13280
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   186
    multiUse = params["multiuse"] == "true"
12708
6726d5edfdfb Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents: 12345
diff changeset
   187
    loyal = params["loyal"] == "true"
10219
bbeb1e9aaa65 param for original highlander mode - right now just allows getting another copy of a weapon you already had, but had used that turn.
nemo
parents: 10096
diff changeset
   188
end
bbeb1e9aaa65 param for original highlander mode - right now just allows getting another copy of a weapon you already had, but had used that turn.
nemo
parents: 10096
diff changeset
   189
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   190
function CheckForWeaponSwap()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   191
	if GetCurAmmoType() ~= lastWep then
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   192
		shotsFired = 0
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   193
	end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   194
	lastWep = GetCurAmmoType()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   195
end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   196
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   197
function onSlot()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   198
	CheckForWeaponSwap()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   199
end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   200
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   201
function onSetWeapon()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   202
	CheckForWeaponSwap()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   203
end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   204
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   205
function onHogAttack()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   206
	CheckForWeaponSwap()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   207
	shotsFired = shotsFired + 1
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   208
end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   209
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   210
function StartingSetUp(gear)
12307
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   211
    for i = 0, AmmoTypeMax do
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   212
        if i ~= amNothing then
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   213
            setGearValue(gear,i,0)
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   214
        end
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   215
    end
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   216
    for w,c in pairs(wepArray) do
10096
51d6b80ba43c don't allow getting 2nd copy of wep you already have, prevent gaining banned weps even if set to infinite in scheme.
nemo
parents: 10088
diff changeset
   217
        if c == 9 and (atkWeps[w] or utilWeps[w])  then
10088
nemo
parents: 10083
diff changeset
   218
            setGearValue(gear,w,1)
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   219
        end
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   220
	end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   221
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   222
	setGearValue(gear,amSkip,100)
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   223
   
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   224
    local r = 0
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   225
    if atktot > 0 then
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   226
        r = GetRandom(atktot)+1
12307
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   227
        for i = 0, AmmoTypeMax do
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   228
            if i ~= amNothing then
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   229
                if atkChoices[i] >= r then
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   230
                    setGearValue(gear,i,1)
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   231
                    break
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   232
                end
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   233
            end
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   234
        end
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   235
    end
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   236
    if utiltot > 0 then
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   237
        r = GetRandom(utiltot)+1
12307
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   238
        for i = 0, AmmoTypeMax do
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   239
            if i ~= amNothing then
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   240
                if utilChoices[i] >= r then
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   241
                    setGearValue(gear,i,1)
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   242
                    break
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   243
                end
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   244
            end
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   245
        end
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   246
    end
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   247
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   248
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   249
--[[function SaveWeapons(gear)
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   250
-- 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
   251
6378
b812bfcfeb49 Make Highlander moar awesome.
mikade
parents: 6349
diff changeset
   252
	for i = 1, (#wepArray) do
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   253
		setGearValue(gear, wepArray[i], GetAmmoCount(gear, wepArray[i]) )
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   254
		 --AddAmmo(gear, wepArray[i], getGearValue(gear,wepArray[i]) )
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   255
	end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   256
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   257
end]]
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   258
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   259
function ConvertValues(gear)
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   260
    for w,c in pairs(wepArray) do
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   261
		AddAmmo(gear, w, getGearValue(gear,w) )
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   262
    end
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   263
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   264
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   265
-- this is called when a hog dies
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   266
function TransferWeps(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   267
12708
6726d5edfdfb Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents: 12345
diff changeset
   268
	if CurrentHedgehog ~= nil and CurrentHedgehog ~= gear and (not loyal or (GetHogClan(CurrentHedgehog) ~= GetHogClan(gear))) then
11853
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   269
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   270
        local x,y,color
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   271
        local vgear
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   272
        local vgtX, vgtY, vgtdX, vgtdY, vgtAngle, vgtFrame, vgtFrameTicks, vgtState, vgtTimer, vgtTint
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   273
        local dspl = IsHogLocal(CurrentHedgehog)
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   274
        local ammolist = ''
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   275
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   276
        if dspl then
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   277
            x,y = GetGearPosition(CurrentHedgehog)
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   278
            color = GetClanColor(GetHogClan(CurrentHedgehog))
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   279
        end
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   280
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   281
        for w,c in pairs(wepArray) do
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   282
			val = getGearValue(gear,w)
13280
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   283
			if val ~= 0 and (multiUse or (wepArray[w] ~= 9 and getGearValue(CurrentHedgehog, w) == 0))  then
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   284
				setGearValue(CurrentHedgehog, w, val)
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   285
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   286
				-- if you are using multi-shot weapon, gimme one more
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   287
				if (GetCurAmmoType() == w) and (shotsFired ~= 0) then
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   288
					AddAmmo(CurrentHedgehog, w, val+1)
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   289
				-- assign ammo as per normal
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   290
				else
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   291
					AddAmmo(CurrentHedgehog, w, val)
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   292
				end
11853
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   293
                if dspl then
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   294
                    if ammolist == '' then
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   295
                        ammolist = GetAmmoName(w)
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   296
                    else
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   297
                        ammolist = ammolist .. ' • ' .. GetAmmoName(w)
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   298
                    end
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   299
                    x = x + 2
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   300
                    y = y + 32
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   301
                    vgear = AddVisualGear(x, y, vgtAmmo, 0, true)
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   302
                    if vgear ~= nil then
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   303
                        vgtX,vgtY,vgtdX,vgtdY,vgtAngle,vgtFrame,vgtFrameTicks,vgtState,vgtTimer,vgtTint = GetVisualGearValues(vgear)
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   304
                        vgtFrame = w
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   305
                        SetVisualGearValues(vgear,vgtX,vgtY,vgtdX,vgtdY,vgtAngle,vgtFrame,vgtFrameTicks,vgtState,vgtTimer,vgtTint)
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   306
                    end
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   307
                end
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   308
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   309
			end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   310
		end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   311
11853
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   312
        if dspl and ammolist ~= '' then
12345
f706ca71aa86 Highlander: Fix crate collect sound playing when hog didn't get anything
Wuzzy <almikes@aol.com>
parents: 12326
diff changeset
   313
            PlaySound(sndShotgunReload);
11853
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   314
            AddCaption(ammolist, color, capgrpAmmoinfo)
6a0d6b00dac8 Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents: 11499
diff changeset
   315
        end
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   316
	end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   317
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   318
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   319
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   320
function onGameInit()
10036
3be36d2fdca6 use new API for changing GameFlags
sheepluva
parents: 9085
diff changeset
   321
	EnableGameFlags(gfInfAttack, gfRandomOrder, gfPerHogAmmo)
10250
887610b44848 disable these weaponset flags. they bug up highlander and otherwise have no useful impact on the script.
nemo
parents: 10219
diff changeset
   322
	DisableGameFlags(gfResetWeps, gfSharedAmmo)
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   323
	HealthCaseProb = 100
12708
6726d5edfdfb Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents: 12345
diff changeset
   324
	if loyal then
6726d5edfdfb Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents: 12345
diff changeset
   325
		Goals = loc("Loyal Highlander: Eliminate enemy hogs to take their weapons") .. "|"
6726d5edfdfb Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents: 12345
diff changeset
   326
	else
6726d5edfdfb Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents: 12345
diff changeset
   327
		Goals = loc("Highlander: Eliminate hogs to take their weapons") .. "|"
6726d5edfdfb Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents: 12345
diff changeset
   328
	end
12709
c4ea9f8fb483 Highlander: Mention the "max. 1 ammo per type" rule in mission panel
Wuzzy <almikes@aol.com>
parents: 12708
diff changeset
   329
	Goals = Goals .. loc("Replenishment: Weapons are restocked on turn start of a new hog") .. "|" ..
13280
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   330
	loc("Ammo Limit: Hogs can’t have more than 1 ammo per type") .. "|"
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   331
	if multiUse then
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   332
		Goals = Goals .. loc("Multi-Use: You can take and use the same ammo type multiple times in a turn")
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   333
	else
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   334
		Goals = Goals .. loc("No Multi-Use: Once you used an ammo, you can’t take it again in this turn")
7ed4ab32f351 Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents: 12961
diff changeset
   335
	end
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   336
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   337
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   338
function onGameStart()
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   339
    utilChoices[amSkip] = 0
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   340
    local c = 0
12307
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   341
    for i = 0, AmmoTypeMax do
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   342
        if i ~= amNothing then
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   343
            atkChoices[i] = 0
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   344
            utilChoices[i] = 0
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   345
            if i ~= 7 then
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   346
                wepArray[i] = 0
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   347
                c = GetAmmoCount(someHog, i)
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   348
                if c > 8 then c = 9 end
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   349
                wepArray[i] = c
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   350
                if c < 9 and c > 0 then
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   351
                    if atkWeps[i] then
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   352
                        --WriteLnToConsole('a    c: '..c..' w:'..i)
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   353
                        atktot = atktot + probability[c]
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   354
                        atkChoices[i] = atktot
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   355
                    elseif utilWeps[i] then
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   356
                        --WriteLnToConsole('u    c: '..c..' w:'..i)
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   357
                            utiltot = utiltot + probability[c]
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   358
                        utilChoices[i] = utiltot
f7919a4df898 Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents: 12211
diff changeset
   359
                    end
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   360
                end
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   361
            end
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   362
        end
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   363
    end
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   364
10088
nemo
parents: 10083
diff changeset
   365
    --WriteLnToConsole('utiltot:'..utiltot..' atktot:'..atktot)
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   366
        
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   367
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   368
	runOnGears(StartingSetUp)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   369
	runOnGears(ConvertValues)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   370
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   371
12325
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   372
function CheckForHogSwitch()
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   373
12326
1be56fa243c8 Clarify how the weapons restocking works in Highlander
Wuzzy <almikes@aol.com>
parents: 12325
diff changeset
   374
	--[[ Restock the weapons of the hog on turn start, provided it is not the same hog as before.
1be56fa243c8 Clarify how the weapons restocking works in Highlander
Wuzzy <almikes@aol.com>
parents: 12325
diff changeset
   375
	This exception is done do avoid a single hog receiving tons of weapons when it is the only unfrozen
1be56fa243c8 Clarify how the weapons restocking works in Highlander
Wuzzy <almikes@aol.com>
parents: 12325
diff changeset
   376
	hog and takes consecutive turns. ]]
1be56fa243c8 Clarify how the weapons restocking works in Highlander
Wuzzy <almikes@aol.com>
parents: 12325
diff changeset
   377
12314
6b34067a6344 Fix broken ammo preview caused by previous commit
Wuzzy <almikes@aol.com>
parents: 12313
diff changeset
   378
	if (CurrentHedgehog ~= nil) then
12325
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   379
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   380
		currHog = CurrentHedgehog
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   381
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   382
		if currHog ~= lastHog then
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   383
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   384
			-- re-assign ammo to this guy, so that his entire ammo set will
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   385
			-- be visible during another player's turn
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   386
			if lastHog ~= nil then
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   387
				ConvertValues(lastHog)
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   388
			end
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   389
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   390
			-- give the new hog what he is supposed to have, too
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   391
			ConvertValues(CurrentHedgehog)
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   392
12314
6b34067a6344 Fix broken ammo preview caused by previous commit
Wuzzy <almikes@aol.com>
parents: 12313
diff changeset
   393
		end
6b34067a6344 Fix broken ammo preview caused by previous commit
Wuzzy <almikes@aol.com>
parents: 12313
diff changeset
   394
12325
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   395
		lastHog = currHog
12314
6b34067a6344 Fix broken ammo preview caused by previous commit
Wuzzy <almikes@aol.com>
parents: 12313
diff changeset
   396
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   397
	end
12325
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   398
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   399
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   400
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   401
function onNewTurn()
12325
a85212a8d0e0 Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents: 12314
diff changeset
   402
	CheckForHogSwitch()
8682
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   403
end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   404
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   405
--function onGameTick20()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   406
--CheckForHogSwitch()
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   407
-- 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
   408
-- 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
   409
-- 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
   410
-- 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
   411
--end
158d7b36b18e hopefully closes issues 541, 312 and 503
mikade
parents: 8043
diff changeset
   412
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   413
--[[function onHogHide(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   414
	-- waiting for Henek
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   415
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   416
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   417
function onHogRestore(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   418
	-- waiting for Henek
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   419
end]]
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   420
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   421
function onGearAdd(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   422
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   423
	--if GetGearType(gear) == gtSwitcher then
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   424
	--	SaveWeapons(CurrentHedgehog)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   425
	--end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   426
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   427
	if (GetGearType(gear) == gtHedgehog) then
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   428
		trackGear(gear)
10083
b20f9481e5cb Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents: 10036
diff changeset
   429
        if someHog == nil then someHog = gear end
6349
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   430
	end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   431
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   432
end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   433
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   434
function onGearDelete(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   435
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   436
	if (GetGearType(gear) == gtHedgehog) then --or (GetGearType(gear) == gtResurrector) then
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   437
		TransferWeps(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   438
		trackDeletion(gear)
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   439
	end
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   440
b10715d6b986 Correct outdated feedback.
mikade
parents:
diff changeset
   441
end