author | Wuzzy <almikes@aol.com> |
Tue, 25 Apr 2017 02:50:28 +0200 | |
changeset 12321 | 1be56fa243c8 |
parent 12320 | a85212a8d0e0 |
child 12340 | f706ca71aa86 |
permissions | -rw-r--r-- |
6349 | 1 |
-------------------------------- |
2 |
-- HIGHLANDER / HOGS OF WAR |
|
11848
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
3 |
-- version 0.4b+ |
6349 | 4 |
-- by mikade |
5 |
-------------------------------- |
|
6 |
||
7 |
----------- |
|
8 |
--0.1 |
|
9 |
----------- |
|
10 |
||
11 |
-- concept test |
|
12 |
||
13 |
----------- |
|
14 |
--0.2 |
|
15 |
----------- |
|
16 |
||
17 |
-- remove tardis till Henek fixes his tracker |
|
18 |
-- change wep crates to health crates |
|
19 |
-- reset arb turntimevalue |
|
20 |
-- include randomOrder |
|
21 |
-- Until fixed .17 methods come out, remove switches and resurrector |
|
22 |
-- on request, removed kamikaze and piano weapons |
|
23 |
-- provisional fixing of bugs that can't actually be fixed yet |
|
24 |
||
25 |
----------- |
|
26 |
--0.3 |
|
27 |
----------- |
|
28 |
||
29 |
-- meh, update incorrect display |
|
30 |
-- may change this in the future to have switches |
|
31 |
-- but for now people are used to it without, so~ |
|
32 |
||
33 |
-- mudball is now counted as a utility |
|
34 |
||
6378 | 35 |
----------- |
36 |
--0.3b |
|
37 |
----------- |
|
6349 | 38 |
|
6378 | 39 |
-- cleaned up code and got rid of unneccessary vars |
40 |
-- mudball is a weapon again |
|
41 |
-- landgun is now a utility |
|
42 |
-- extra time, vampirism utility removed |
|
43 |
-- hammer wep removed |
|
44 |
-- all hogs have kamikaze |
|
6349 | 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 | 54 |
----------- |
55 |
--0.4 |
|
56 |
----------- |
|
57 |
-- fix same name/blank weapon transfer bug (issue 541) |
|
58 |
-- show next hog ammo set in full (issue 312) |
|
59 |
-- allow mid-kill multi-shot weapon transfers (issue 503) |
|
60 |
-- allow users to configure hog health |
|
61 |
-- remove 'switched to' message |
|
62 |
-- remove some extraeneous code |
|
63 |
-- add more whitespace |
|
64 |
-- break everything |
|
65 |
||
9085
092051fda7e1
As per request, add ice-gun (untested!)
mikade <redgrinner@gmail.com>
parents:
8713
diff
changeset
|
66 |
----------- |
092051fda7e1
As per request, add ice-gun (untested!)
mikade <redgrinner@gmail.com>
parents:
8713
diff
changeset
|
67 |
--0.4b |
092051fda7e1
As per request, add ice-gun (untested!)
mikade <redgrinner@gmail.com>
parents:
8713
diff
changeset
|
68 |
----------- |
092051fda7e1
As per request, add ice-gun (untested!)
mikade <redgrinner@gmail.com>
parents:
8713
diff
changeset
|
69 |
-- as per request, add ice-gun |
092051fda7e1
As per request, add ice-gun (untested!)
mikade <redgrinner@gmail.com>
parents:
8713
diff
changeset
|
70 |
|
8682 | 71 |
------------------------- |
72 |
-- ideas for the future |
|
73 |
------------------------- |
|
9085
092051fda7e1
As per request, add ice-gun (untested!)
mikade <redgrinner@gmail.com>
parents:
8713
diff
changeset
|
74 |
-- add structure |
8682 | 75 |
-- allow switcher, resurrector |
76 |
-- add abuse |
|
77 |
-- nerf teleport |
|
78 |
-- allow more customization |
|
79 |
-- poison hogs using the default team? :/ |
|
80 |
-- balance weapon distribution across entire team / all teams |
|
81 |
-- add other inequalities/bonuses like... ??? |
|
82 |
-- some hogs start off with an extra 25 health? |
|
83 |
-- some hogs start off poisoned? |
|
84 |
-- some hogs start off with a rope and 2 drills but die after their turn? |
|
85 |
||
86 |
------------------------------- |
|
87 |
-- derp, script follows |
|
88 |
------------------------------- |
|
89 |
||
8713 | 90 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
91 |
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
|
92 |
HedgewarsScriptLoad("/Scripts/Params.lua") |
6349 | 93 |
|
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
94 |
-- These define weps allowed by the script. At present Tardis and Resurrection is banned for example |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
95 |
-- 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
|
96 |
-- in a moderately odd syntax. |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
97 |
local atkWeps = { |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
98 |
[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
|
99 |
[amGrenade]=true, [amClusterBomb]=true, [amMolotov]=true, [amWatermelon]=true, |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
100 |
[amHellishBomb]=true, [amGasBomb]=true, [amShotgun]=true, [amDEagle]=true, |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
101 |
[amFlamethrower]=true, [amSniperRifle]=true, [amSineGun]=true, |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
102 |
[amFirePunch]=true, [amWhip]=true, [amBaseballBat]=true, [amKamikaze]=true, |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
103 |
[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
|
104 |
[amBallgun]=true, [amSMine]=true, [amRCPlane]=true, [amBirdy]=true, [amKnife]=true, |
10997 | 105 |
[amAirAttack]=true, [amMineStrike]=true, [amNapalm]=true, [amDrillStrike]=true, [amPiano]=true, [amAirMine] = true, |
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
106 |
} |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
107 |
|
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
108 |
local utilWeps = { |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
109 |
[amBlowTorch]=true, [amPickHammer]=true, [amGirder]=true, [amPortalGun]=true, |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
110 |
[amRope]=true, [amParachute]=true, [amTeleport]=true, [amJetpack]=true, |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
111 |
[amInvulnerable]=true, [amLaserSight]=true, [amVampiric]=true, |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
112 |
[amLowGravity]=true, [amExtraDamage]=true, [amExtraTime]=true, |
10865
a587145ced34
remove switch from allowed utilities. 14:57 <@unC0Rr> way too OP
nemo
parents:
10250
diff
changeset
|
113 |
[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
|
114 |
} |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
115 |
|
10088 | 116 |
local wepArray = {} |
6349 | 117 |
|
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
118 |
local atkChoices = {} |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
119 |
local utilChoices = {} |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
120 |
|
12320
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
121 |
local currHog |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
122 |
local lastHog |
6349 | 123 |
local started = false |
124 |
local switchStage = 0 |
|
125 |
||
8682 | 126 |
local lastWep = amNothing |
127 |
local shotsFired = 0 |
|
128 |
||
10088 | 129 |
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
|
130 |
local atktot = 0 |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
131 |
local utiltot = 0 |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
132 |
|
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
133 |
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
|
134 |
|
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
|
135 |
local mode = nil |
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
|
136 |
|
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
|
137 |
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
|
138 |
parseParams() |
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
|
139 |
mode = params["mode"] |
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
|
140 |
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
|
141 |
|
8682 | 142 |
function CheckForWeaponSwap() |
143 |
if GetCurAmmoType() ~= lastWep then |
|
144 |
shotsFired = 0 |
|
145 |
end |
|
146 |
lastWep = GetCurAmmoType() |
|
147 |
end |
|
148 |
||
149 |
function onSlot() |
|
150 |
CheckForWeaponSwap() |
|
151 |
end |
|
152 |
||
153 |
function onSetWeapon() |
|
154 |
CheckForWeaponSwap() |
|
155 |
end |
|
156 |
||
157 |
function onHogAttack() |
|
158 |
CheckForWeaponSwap() |
|
159 |
shotsFired = shotsFired + 1 |
|
160 |
end |
|
161 |
||
6349 | 162 |
function StartingSetUp(gear) |
12302
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
163 |
for i = 0, AmmoTypeMax do |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
164 |
if i ~= amNothing then |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
165 |
setGearValue(gear,i,0) |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
166 |
end |
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
167 |
end |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
168 |
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
|
169 |
if c == 9 and (atkWeps[w] or utilWeps[w]) then |
10088 | 170 |
setGearValue(gear,w,1) |
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
171 |
end |
6349 | 172 |
end |
173 |
||
8682 | 174 |
setGearValue(gear,amSkip,100) |
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
175 |
|
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
176 |
local r = 0 |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
177 |
if atktot > 0 then |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
178 |
r = GetRandom(atktot)+1 |
12302
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
179 |
for i = 0, AmmoTypeMax do |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
180 |
if i ~= amNothing then |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
181 |
if atkChoices[i] >= r then |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
182 |
setGearValue(gear,i,1) |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
183 |
break |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
184 |
end |
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
185 |
end |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
186 |
end |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
187 |
end |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
188 |
if utiltot > 0 then |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
189 |
r = GetRandom(utiltot)+1 |
12302
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
190 |
for i = 0, AmmoTypeMax do |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
191 |
if i ~= amNothing then |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
192 |
if utilChoices[i] >= r then |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
193 |
setGearValue(gear,i,1) |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
194 |
break |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
195 |
end |
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
196 |
end |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
197 |
end |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
198 |
end |
6349 | 199 |
end |
200 |
||
201 |
--[[function SaveWeapons(gear) |
|
8682 | 202 |
-- er, this has no 0 check so presumably if you use a weapon then when it saves you wont have it |
6349 | 203 |
|
6378 | 204 |
for i = 1, (#wepArray) do |
6349 | 205 |
setGearValue(gear, wepArray[i], GetAmmoCount(gear, wepArray[i]) ) |
206 |
--AddAmmo(gear, wepArray[i], getGearValue(gear,wepArray[i]) ) |
|
207 |
end |
|
208 |
||
209 |
end]] |
|
210 |
||
211 |
function ConvertValues(gear) |
|
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
212 |
for w,c in pairs(wepArray) do |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
213 |
AddAmmo(gear, w, getGearValue(gear,w) ) |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
214 |
end |
6349 | 215 |
end |
216 |
||
8682 | 217 |
-- this is called when a hog dies |
6349 | 218 |
function TransferWeps(gear) |
219 |
||
11848
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
220 |
if CurrentHedgehog ~= nil and CurrentHedgehog ~= gear then |
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
221 |
|
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
222 |
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:
11494
diff
changeset
|
223 |
local vgear |
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
224 |
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:
11494
diff
changeset
|
225 |
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:
11494
diff
changeset
|
226 |
local ammolist = '' |
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
227 |
|
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
228 |
if dspl then |
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
229 |
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:
11494
diff
changeset
|
230 |
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:
11494
diff
changeset
|
231 |
end |
6349 | 232 |
|
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
233 |
for w,c in pairs(wepArray) do |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
234 |
val = getGearValue(gear,w) |
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
|
235 |
if val ~= 0 and (mode == "orig" 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
|
236 |
setGearValue(CurrentHedgehog, w, val) |
8682 | 237 |
|
238 |
-- 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
|
239 |
if (GetCurAmmoType() == w) and (shotsFired ~= 0) then |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
240 |
AddAmmo(CurrentHedgehog, w, val+1) |
8682 | 241 |
-- assign ammo as per normal |
242 |
else |
|
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
243 |
AddAmmo(CurrentHedgehog, w, val) |
8682 | 244 |
end |
11848
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
245 |
if dspl then |
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
246 |
if ammolist == '' then |
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
247 |
ammolist = GetAmmoName(w) |
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
248 |
else |
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
249 |
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:
11494
diff
changeset
|
250 |
end |
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
251 |
x = x + 2 |
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
252 |
y = y + 32 |
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
253 |
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:
11494
diff
changeset
|
254 |
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:
11494
diff
changeset
|
255 |
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:
11494
diff
changeset
|
256 |
vgtFrame = w |
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
257 |
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:
11494
diff
changeset
|
258 |
end |
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
259 |
end |
8682 | 260 |
|
6349 | 261 |
end |
262 |
end |
|
263 |
||
11848
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
264 |
PlaySound(sndShotgunReload); |
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
265 |
if dspl and ammolist ~= '' then |
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
266 |
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:
11494
diff
changeset
|
267 |
end |
6349 | 268 |
end |
269 |
||
270 |
end |
|
271 |
||
272 |
function onGameInit() |
|
10036 | 273 |
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
|
274 |
DisableGameFlags(gfResetWeps, gfSharedAmmo) |
6349 | 275 |
HealthCaseProb = 100 |
12321
1be56fa243c8
Clarify how the weapons restocking works in Highlander
Wuzzy <almikes@aol.com>
parents:
12320
diff
changeset
|
276 |
Goals = loc("Highlander: Eliminate enemy hogs to take their weapons") .. "|" .. |
1be56fa243c8
Clarify how the weapons restocking works in Highlander
Wuzzy <almikes@aol.com>
parents:
12320
diff
changeset
|
277 |
loc("Replenishment: Weapons are restocked on turn start of a new hog") |
6349 | 278 |
end |
279 |
||
280 |
function onGameStart() |
|
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
281 |
utilChoices[amSkip] = 0 |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
282 |
local c = 0 |
12302
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
283 |
for i = 0, AmmoTypeMax do |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
284 |
if i ~= amNothing then |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
285 |
atkChoices[i] = 0 |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
286 |
utilChoices[i] = 0 |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
287 |
if i ~= 7 then |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
288 |
wepArray[i] = 0 |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
289 |
c = GetAmmoCount(someHog, i) |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
290 |
if c > 8 then c = 9 end |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
291 |
wepArray[i] = c |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
292 |
if c < 9 and c > 0 then |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
293 |
if atkWeps[i] then |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
294 |
--WriteLnToConsole('a c: '..c..' w:'..i) |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
295 |
atktot = atktot + probability[c] |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
296 |
atkChoices[i] = atktot |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
297 |
elseif utilWeps[i] then |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
298 |
--WriteLnToConsole('u c: '..c..' w:'..i) |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
299 |
utiltot = utiltot + probability[c] |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
300 |
utilChoices[i] = utiltot |
f7919a4df898
Replace hardcoded max. ammo index in Highlander with AmmoTypeMax
Wuzzy <almikes@aol.com>
parents:
12206
diff
changeset
|
301 |
end |
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
302 |
end |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
303 |
end |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
304 |
end |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
305 |
end |
6349 | 306 |
|
10088 | 307 |
--WriteLnToConsole('utiltot:'..utiltot..' atktot:'..atktot) |
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
308 |
|
6349 | 309 |
|
310 |
runOnGears(StartingSetUp) |
|
311 |
runOnGears(ConvertValues) |
|
312 |
end |
|
313 |
||
12320
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
314 |
function CheckForHogSwitch() |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
315 |
|
12321
1be56fa243c8
Clarify how the weapons restocking works in Highlander
Wuzzy <almikes@aol.com>
parents:
12320
diff
changeset
|
316 |
--[[ 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:
12320
diff
changeset
|
317 |
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:
12320
diff
changeset
|
318 |
hog and takes consecutive turns. ]] |
1be56fa243c8
Clarify how the weapons restocking works in Highlander
Wuzzy <almikes@aol.com>
parents:
12320
diff
changeset
|
319 |
|
12309
6b34067a6344
Fix broken ammo preview caused by previous commit
Wuzzy <almikes@aol.com>
parents:
12308
diff
changeset
|
320 |
if (CurrentHedgehog ~= nil) then |
12320
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
321 |
|
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
322 |
currHog = CurrentHedgehog |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
323 |
|
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
324 |
if currHog ~= lastHog then |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
325 |
|
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
326 |
-- re-assign ammo to this guy, so that his entire ammo set will |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
327 |
-- be visible during another player's turn |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
328 |
if lastHog ~= nil then |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
329 |
ConvertValues(lastHog) |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
330 |
end |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
331 |
|
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
332 |
-- give the new hog what he is supposed to have, too |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
333 |
ConvertValues(CurrentHedgehog) |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
334 |
|
12309
6b34067a6344
Fix broken ammo preview caused by previous commit
Wuzzy <almikes@aol.com>
parents:
12308
diff
changeset
|
335 |
end |
6b34067a6344
Fix broken ammo preview caused by previous commit
Wuzzy <almikes@aol.com>
parents:
12308
diff
changeset
|
336 |
|
12320
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
337 |
lastHog = currHog |
12309
6b34067a6344
Fix broken ammo preview caused by previous commit
Wuzzy <almikes@aol.com>
parents:
12308
diff
changeset
|
338 |
|
6349 | 339 |
end |
12320
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
340 |
|
6349 | 341 |
end |
342 |
||
8682 | 343 |
function onNewTurn() |
12320
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
344 |
CheckForHogSwitch() |
8682 | 345 |
end |
346 |
||
347 |
--function onGameTick20() |
|
348 |
--CheckForHogSwitch() |
|
349 |
-- if we use gfPerHogAmmo is this even needed? Err, well, weapons reset, so... yes? |
|
350 |
-- orrrr, should we rather call the re-assignment of weapons onNewTurn()? probably not because |
|
351 |
-- then you cant switch hogs... unless we add a thing in onSwitch or whatever |
|
352 |
-- ye, that is probably better actually, but I'll add that when/if I add switch |
|
353 |
--end |
|
354 |
||
6349 | 355 |
--[[function onHogHide(gear) |
356 |
-- waiting for Henek |
|
357 |
end |
|
358 |
||
359 |
function onHogRestore(gear) |
|
360 |
-- waiting for Henek |
|
361 |
end]] |
|
362 |
||
363 |
function onGearAdd(gear) |
|
364 |
||
365 |
--if GetGearType(gear) == gtSwitcher then |
|
366 |
-- SaveWeapons(CurrentHedgehog) |
|
367 |
--end |
|
368 |
||
369 |
if (GetGearType(gear) == gtHedgehog) then |
|
370 |
trackGear(gear) |
|
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
371 |
if someHog == nil then someHog = gear end |
6349 | 372 |
end |
373 |
||
374 |
end |
|
375 |
||
376 |
function onGearDelete(gear) |
|
377 |
||
378 |
if (GetGearType(gear) == gtHedgehog) then --or (GetGearType(gear) == gtResurrector) then |
|
379 |
TransferWeps(gear) |
|
380 |
trackDeletion(gear) |
|
381 |
end |
|
382 |
||
383 |
end |