1-------------------------------- 2-- HIGHLANDER / HOGS OF WAR 3-- version 0.3c 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 35----------- 36--0.3b 37----------- 38 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 45 46----------- 47--0.3c 48----------- 49 50-- restructured some code 51-- added napalm (whoops) to list of possible weapons you can get 52-- hogs no longer recieve airstrike-related weps on border maps 53 54loadfile(GetDataPath() .. "Scripts/Locale.lua")() 55loadfile(GetDataPath() .. "Scripts/Tracker.lua")() 56 57local airWeapons = {amAirAttack, amMineStrike, amNapalm, amDrillStrike --[[,amPiano]]} 58 59local atkArray = { 60 amBazooka, amBee, amMortar, amDrill, --[[amSnowball,]] 61 amGrenade, amClusterBomb, amMolotov, amWatermelon, amHellishBomb, amGasBomb, 62 amShotgun, amDEagle, amFlamethrower, amSniperRifle, amSineGun, 63 amFirePunch, amWhip, amBaseballBat, --[[amKamikaze,]] amSeduction, --[[amHammer,]] 64 amMine, amDynamite, amCake, amBallgun, amRCPlane, amSMine, 65 amRCPlane, amSMine, 66 amBirdy 67 } 68 69local utilArray = { 70 amBlowTorch, amPickHammer, amGirder, amPortalGun, 71 amRope, amParachute, amTeleport, amJetpack, 72 amInvulnerable, amLaserSight, --[[amVampiric,]] 73 amLowGravity, amExtraDamage, --[[amExtraTime,]] 74 amLandGun 75 --[[,amTardis, amResurrector, amSwitch]] 76 } 77 78local wepArray = {} 79 80local currName 81local lastName 82local started = false 83local switchStage = 0 84 85function StartingSetUp(gear) 86 87 for i = 1, #wepArray do 88 setGearValue(gear,wepArray[i],0) 89 end 90 91 setGearValue(gear,amKamikaze,1) 92 93 i = 1 + GetRandom(#atkArray) 94 setGearValue(gear,atkArray[i],1) 95 96 i = 1 + GetRandom(#utilArray) 97 setGearValue(gear,utilArray[i],1) 98 99 SetHealth(gear, 100) 100 101end 102 103--[[function SaveWeapons(gear) 104 105 - 106 for i = 1, (#wepArray) do 107 setGearValue(gear, wepArray[i], GetAmmoCount(gear, wepArray[i]) ) 108 --AddAmmo(gear, wepArray[i], getGearValue(gear,wepArray[i]) ) 109 end 110 111end]] 112 113function ConvertValues(gear) 114 115 for i = 1, #wepArray do 116 AddAmmo(gear, wepArray[i], getGearValue(gear,wepArray[i]) ) 117 end 118 119 120end 121 122 123function TransferWeps(gear) 124 125 if CurrentHedgehog ~= nil then 126 127 for i = 1, #wepArray do 128 val = getGearValue(gear,wepArray[i]) 129 if val ~= 0 then 130 setGearValue(CurrentHedgehog, wepArray[i], val) 131 AddAmmo(CurrentHedgehog, wepArray[i], val) 132 end 133 end 134 135 end 136 137end 138 139function onGameInit() 140 GameFlags = gfInfAttack + gfRandomOrder 141 HealthCaseProb = 100 142end 143 144function onGameStart() 145 146 147 ShowMission ( 148 loc("HIGHLANDER"), 149 loc("Not all hogs are born equal."), 150 151 "- " .. loc("Eliminate enemy hogs and take their weapons.") .. "|" .. 152 "- " .. loc("Per-Hog Ammo") .. "|" .. 153 "- " .. loc("Weapons reset.") .. "|" .. 154 "- " .. loc("Unlimited Attacks") .. "|" .. 155 "", 4, 4000 156 ) 157 158 if MapHasBorder() == false then 159 for i, w in pairs(airWeapons) do 160 table.insert(atkArray, w) 161 end 162 end 163 164 for i, w in pairs(atkArray) do 165 table.insert(wepArray, w) 166 end 167 168 for i, w in pairs(utilArray) do 169 table.insert(wepArray, w) 170 end 171 172 runOnGears(StartingSetUp) 173 runOnGears(ConvertValues) 174 175 176end 177 178function onNewTurn() 179-- 180end 181 182 183function onGameTick20() 184 185 if (CurrentHedgehog ~= nil) then 186 187 currName = GetHogName(CurrentHedgehog) 188 189 if (currName ~= lastName) then 190 AddCaption(loc("Switched to ") .. currName .. "!") 191 ConvertValues(CurrentHedgehog) 192 end 193 194 lastName = currName 195 end 196 197end 198 199--[[function onHogHide(gear) 200 -- waiting for Henek 201end 202 203function onHogRestore(gear) 204 -- waiting for Henek 205end]] 206 207function onGearAdd(gear) 208 209 --if GetGearType(gear) == gtSwitcher then 210 -- SaveWeapons(CurrentHedgehog) 211 --end 212 213 if (GetGearType(gear) == gtHedgehog) then 214 trackGear(gear) 215 end 216 217end 218 219function onGearDelete(gear) 220 221 if (GetGearType(gear) == gtHedgehog) then --or (GetGearType(gear) == gtResurrector) then 222 TransferWeps(gear) 223 trackDeletion(gear) 224 end 225 226end 227 228function onAmmoStoreInit() 229 SetAmmo(amSkip, 9, 0, 0, 0) 230 SetAmmo(amKamikaze, 9, 0, 0, 0) 231 --SetAmmo(amSwitch, 9, 0, 0, 0) -------1 232end 233 234