author | sheepluva |
Tue, 10 Nov 2015 17:45:14 +0100 | |
branch | sdl2transition |
changeset 11360 | 7a7611adf715 |
parent 9085 | 092051fda7e1 |
child 10036 | 3be36d2fdca6 |
permissions | -rw-r--r-- |
6349 | 1 |
-------------------------------- |
2 |
-- HIGHLANDER / HOGS OF WAR |
|
9085
092051fda7e1
As per request, add ice-gun (untested!)
mikade <redgrinner@gmail.com>
parents:
8713
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") |
|
6349 | 92 |
|
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
93 |
local airWeapons = {amAirAttack, amMineStrike, amNapalm, amDrillStrike --[[,amPiano]]} |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
94 |
|
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
95 |
local atkArray = { |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
96 |
amBazooka, amBee, amMortar, amDrill, --[[amSnowball,]] |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
97 |
amGrenade, amClusterBomb, amMolotov, amWatermelon, amHellishBomb, amGasBomb, |
9085
092051fda7e1
As per request, add ice-gun (untested!)
mikade <redgrinner@gmail.com>
parents:
8713
diff
changeset
|
98 |
amShotgun, amDEagle, amFlamethrower, amSniperRifle, amSineGun, amIceGun, |
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
99 |
amFirePunch, amWhip, amBaseballBat, --[[amKamikaze,]] amSeduction, --[[amHammer,]] |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
100 |
amMine, amDynamite, amCake, amBallgun, amRCPlane, amSMine, |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
101 |
amRCPlane, amSMine, |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
102 |
amBirdy |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
103 |
} |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
104 |
|
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
105 |
local utilArray = { |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
106 |
amBlowTorch, amPickHammer, amGirder, amPortalGun, |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
107 |
amRope, amParachute, amTeleport, amJetpack, |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
108 |
amInvulnerable, amLaserSight, --[[amVampiric,]] |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
109 |
amLowGravity, amExtraDamage, --[[amExtraTime,]] |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
110 |
amLandGun |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
111 |
--[[,amTardis, amResurrector, amSwitch]] |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
112 |
} |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
113 |
|
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
114 |
local wepArray = {} |
6349 | 115 |
|
8682 | 116 |
local currHog |
117 |
local lastHog |
|
6349 | 118 |
local started = false |
119 |
local switchStage = 0 |
|
120 |
||
8682 | 121 |
local lastWep = amNothing |
122 |
local shotsFired = 0 |
|
123 |
||
124 |
function CheckForWeaponSwap() |
|
125 |
if GetCurAmmoType() ~= lastWep then |
|
126 |
shotsFired = 0 |
|
127 |
end |
|
128 |
lastWep = GetCurAmmoType() |
|
129 |
end |
|
130 |
||
131 |
function onSlot() |
|
132 |
CheckForWeaponSwap() |
|
133 |
end |
|
134 |
||
135 |
function onSetWeapon() |
|
136 |
CheckForWeaponSwap() |
|
137 |
end |
|
138 |
||
139 |
function onHogAttack() |
|
140 |
CheckForWeaponSwap() |
|
141 |
shotsFired = shotsFired + 1 |
|
142 |
end |
|
143 |
||
6349 | 144 |
function StartingSetUp(gear) |
145 |
||
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
146 |
for i = 1, #wepArray do |
6349 | 147 |
setGearValue(gear,wepArray[i],0) |
148 |
end |
|
149 |
||
8682 | 150 |
setGearValue(gear,amKamikaze,100) |
151 |
setGearValue(gear,amSkip,100) |
|
6378 | 152 |
|
153 |
i = 1 + GetRandom(#atkArray) |
|
6349 | 154 |
setGearValue(gear,atkArray[i],1) |
155 |
||
6378 | 156 |
i = 1 + GetRandom(#utilArray) |
6349 | 157 |
setGearValue(gear,utilArray[i],1) |
158 |
||
159 |
end |
|
160 |
||
161 |
--[[function SaveWeapons(gear) |
|
8682 | 162 |
-- er, this has no 0 check so presumably if you use a weapon then when it saves you wont have it |
6349 | 163 |
|
6378 | 164 |
for i = 1, (#wepArray) do |
6349 | 165 |
setGearValue(gear, wepArray[i], GetAmmoCount(gear, wepArray[i]) ) |
166 |
--AddAmmo(gear, wepArray[i], getGearValue(gear,wepArray[i]) ) |
|
167 |
end |
|
168 |
||
169 |
end]] |
|
170 |
||
171 |
function ConvertValues(gear) |
|
172 |
||
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
173 |
for i = 1, #wepArray do |
6349 | 174 |
AddAmmo(gear, wepArray[i], getGearValue(gear,wepArray[i]) ) |
175 |
end |
|
176 |
||
177 |
end |
|
178 |
||
8682 | 179 |
-- this is called when a hog dies |
6349 | 180 |
function TransferWeps(gear) |
181 |
||
182 |
if CurrentHedgehog ~= nil then |
|
183 |
||
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
184 |
for i = 1, #wepArray do |
6349 | 185 |
val = getGearValue(gear,wepArray[i]) |
186 |
if val ~= 0 then |
|
8682 | 187 |
|
6349 | 188 |
setGearValue(CurrentHedgehog, wepArray[i], val) |
8682 | 189 |
|
190 |
-- if you are using multi-shot weapon, gimme one more |
|
191 |
if (GetCurAmmoType() == wepArray[i]) and (shotsFired ~= 0) then |
|
192 |
AddAmmo(CurrentHedgehog, wepArray[i], val+1) |
|
193 |
-- assign ammo as per normal |
|
194 |
else |
|
195 |
AddAmmo(CurrentHedgehog, wepArray[i], val) |
|
196 |
end |
|
197 |
||
6349 | 198 |
end |
199 |
end |
|
200 |
||
201 |
end |
|
202 |
||
203 |
end |
|
204 |
||
205 |
function onGameInit() |
|
8692
935960dbc60e
lock weapons since script doesn't support custom sets anyway (yet). Use bor on flags to allow other game flags.
nemo
parents:
8682
diff
changeset
|
206 |
GameFlags = bor(GameFlags,gfInfAttack + gfRandomOrder + gfPerHogAmmo) |
6349 | 207 |
HealthCaseProb = 100 |
208 |
end |
|
209 |
||
210 |
function onGameStart() |
|
211 |
||
212 |
ShowMission ( |
|
213 |
loc("HIGHLANDER"), |
|
214 |
loc("Not all hogs are born equal."), |
|
215 |
||
216 |
"- " .. loc("Eliminate enemy hogs and take their weapons.") .. "|" .. |
|
217 |
"- " .. loc("Per-Hog Ammo") .. "|" .. |
|
218 |
"- " .. loc("Weapons reset.") .. "|" .. |
|
219 |
"- " .. loc("Unlimited Attacks") .. "|" .. |
|
220 |
"", 4, 4000 |
|
221 |
) |
|
222 |
||
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
223 |
if MapHasBorder() == false then |
8682 | 224 |
for i, w in pairs(airWeapons) do |
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
225 |
table.insert(atkArray, w) |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
226 |
end |
8682 | 227 |
end |
6349 | 228 |
|
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
229 |
for i, w in pairs(atkArray) do |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
230 |
table.insert(wepArray, w) |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
231 |
end |
6349 | 232 |
|
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
233 |
for i, w in pairs(utilArray) do |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
234 |
table.insert(wepArray, w) |
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
235 |
end |
6349 | 236 |
|
8682 | 237 |
table.insert(wepArray, amSkip) |
238 |
table.insert(wepArray, amKamikaze) |
|
239 |
||
6349 | 240 |
runOnGears(StartingSetUp) |
241 |
runOnGears(ConvertValues) |
|
242 |
||
243 |
||
244 |
end |
|
245 |
||
8682 | 246 |
function CheckForHogSwitch() |
6349 | 247 |
|
248 |
if (CurrentHedgehog ~= nil) then |
|
249 |
||
8682 | 250 |
currHog = CurrentHedgehog |
251 |
||
252 |
if currHog ~= lastHog then |
|
6349 | 253 |
|
8682 | 254 |
-- re-assign ammo to this guy, so that his entire ammo set will |
255 |
-- be visible during another player's turn |
|
256 |
if lastHog ~= nil then |
|
257 |
ConvertValues(lastHog) |
|
258 |
end |
|
259 |
||
260 |
-- give the new hog what he is supposed to have, too |
|
6349 | 261 |
ConvertValues(CurrentHedgehog) |
8682 | 262 |
|
6349 | 263 |
end |
264 |
||
8682 | 265 |
lastHog = currHog |
266 |
||
6349 | 267 |
end |
268 |
||
269 |
end |
|
270 |
||
8682 | 271 |
function onNewTurn() |
272 |
CheckForHogSwitch() |
|
273 |
end |
|
274 |
||
275 |
--function onGameTick20() |
|
276 |
--CheckForHogSwitch() |
|
277 |
-- if we use gfPerHogAmmo is this even needed? Err, well, weapons reset, so... yes? |
|
278 |
-- orrrr, should we rather call the re-assignment of weapons onNewTurn()? probably not because |
|
279 |
-- then you cant switch hogs... unless we add a thing in onSwitch or whatever |
|
280 |
-- ye, that is probably better actually, but I'll add that when/if I add switch |
|
281 |
--end |
|
282 |
||
6349 | 283 |
--[[function onHogHide(gear) |
284 |
-- waiting for Henek |
|
285 |
end |
|
286 |
||
287 |
function onHogRestore(gear) |
|
288 |
-- waiting for Henek |
|
289 |
end]] |
|
290 |
||
291 |
function onGearAdd(gear) |
|
292 |
||
293 |
--if GetGearType(gear) == gtSwitcher then |
|
294 |
-- SaveWeapons(CurrentHedgehog) |
|
295 |
--end |
|
296 |
||
297 |
if (GetGearType(gear) == gtHedgehog) then |
|
298 |
trackGear(gear) |
|
299 |
end |
|
300 |
||
301 |
end |
|
302 |
||
303 |
function onGearDelete(gear) |
|
304 |
||
305 |
if (GetGearType(gear) == gtHedgehog) then --or (GetGearType(gear) == gtResurrector) then |
|
306 |
TransferWeps(gear) |
|
307 |
trackDeletion(gear) |
|
308 |
end |
|
309 |
||
310 |
end |
|
311 |
||
312 |
function onAmmoStoreInit() |
|
8682 | 313 |
-- no, you can't set your own ammo scheme |
6349 | 314 |
end |
315 |