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