unc0rr 8014: HedgewarsScriptLoad("/Scripts/Locale.lua") unc0rr 8014: HedgewarsScriptLoad("/Scripts/Tracker.lua") claymore 5118: -loadfile(GetDataPath() .. "Scripts/Locale.lua")() Henek 5128: -loadfile(GetDataPath() .. "Scripts/Tracker.lua")() claymore 5118: Wuzzy2 13173: local weapons = { amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amMine, amDEagle, amDynamite, amFirePunch, amWhip, amPickHammer, amBaseballBat, amMortar, amCake, amSeduction, amWatermelon, amHellishBomb, amDrill, amBallgun, amRCPlane, amSniperRifle, amMolotov, amBirdy, amBlowTorch, amGasBomb, amFlamethrower, amSMine, amKamikaze, amMinigun, amAirMine, amKnife } Wuzzy2 12956: -local weapons = { amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amMine, amDEagle, amDynamite, amFirePunch, amWhip, amPickHammer, amBaseballBat, amMortar, amCake, amSeduction, amWatermelon, amHellishBomb, amDrill, amBallgun, amRCPlane, amSniperRifle, amMolotov, amBirdy, amBlowTorch, amGasBomb, amFlamethrower, amSMine, amKamikaze, amDuck, amMinigun, amAirMine, amKnife } almikes 12207: -local weapons = { amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amMine, amDEagle, amDynamite, amFirePunch, amWhip, amPickHammer, amBaseballBat, amMortar, amCake, amSeduction, amWatermelon, amHellishBomb, amDrill, amBallgun, amRCPlane, amSniperRifle, amMolotov, amBirdy, amBlowTorch, amGasBomb, amFlamethrower, amSMine, amKamikaze, amDuck } claymore 5118: -local weapons = { amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amMine, amDEagle, amDynamite, amFirePunch, amWhip, amPickHammer, amBaseballBat, amMortar, amCake, amSeduction, amWatermelon, amHellishBomb, amDrill, amBallgun, amRCPlane, amSniperRifle, amMolotov, amBirdy, amBlowTorch, amGasBomb, amFlamethrower, amSMine, amKamikaze } claymore 5118: Wuzzy2 13173: -- G,C,B,B,S,M,D,D,F,W,P,B,M,C,S,W,H,D,B,R,S,M,B,B,G,F,S,K,M,A,K Wuzzy2 13173: local weapons_values = {1,1,1,2,1,1,1,2,1,1,1,2,1,3,1,3,3,2,3,3,1,1,2,1,1,2,2,1,3,1,2} Wuzzy2 12956: --- G,C,B,B,S,M,D,D,F,W,P,B,M,C,S,W,H,D,B,R,S,M,B,B,G,F,S,K,D,M,A,K Wuzzy2 12956: -local weapons_values = {1,1,1,2,1,1,1,2,1,1,1,2,1,3,1,3,3,2,3,3,1,1,2,1,1,2,2,1,1,3,1,2} almikes 12207: --- G,C,B,B,S,M,D,D,F,W,P,B,M,C,S,W,H,D,B,R,S,M,B,B,G,F,S,K,D almikes 12207: -local weapons_values = {1,1,1,2,1,1,1,2,1,1,1,2,1,3,1,3,3,2,3,3,1,1,2,1,1,2,2,1,1} claymore 5118: --- G,C,B,B,S,M,D,D,F,W,P,B,M,C,S,W,H,D,B,R,S,M,B,B,G,F,S,K claymore 5118: -local weapons_values = {1,1,1,2,1,1,1,2,1,1,1,2,1,3,1,3,3,2,3,3,1,1,2,1,1,2,2,1} claymore 5118: claymore 5118: local airweapons = { amAirAttack, amMineStrike, amNapalm, amDrillStrike } claymore 5118: claymore 5118: -- A,M,N,D claymore 5118: local airweapons_values = {2,2,2,2} claymore 5118: claymore 5118: local utilities = { amTeleport, amGirder, amSwitch, amLowGravity, amResurrector, amRope, amParachute, amJetpack, amPortalGun, amSnowball } claymore 5118: claymore 5118: -- T,G,S,L,R,R,P,J,P,S claymore 5118: local utilities_values = {1,2,2,1,2,2,1,2,2,2} claymore 5118: Henek 5128: function randomAmmo() Henek 5128: local n = 3 --"points" to be allocated on weapons Henek 5128: Henek 5128: --pick random weapon and subtract cost Henek 5128: local r = GetRandom(table.maxn(weapons_values)) + 1 Henek 5128: local picked_items = {} Henek 5128: table.insert(picked_items, weapons[r]) Henek 5128: n = n - weapons_values[r] Henek 5128: Henek 5128: Henek 5128: --choose any weapons or utilities to use up remaining n Henek 5128: Henek 5128: while n > 0 do Henek 5128: local items = {} Henek 5128: local items_values = {} Henek 5128: Henek 5128: for i, w in pairs(weapons_values) do Henek 5128: local used = false Henek 5128: if w <= n then Henek 5128: --check that this weapon hasn't been given already Henek 5128: for j, k in pairs(picked_items) do Henek 5128: if weapons[i] == k then Henek 5128: used = true Henek 5128: end Henek 5128: end Henek 5128: if not used then Henek 5128: table.insert(items_values, w) Henek 5128: table.insert(items, weapons[i]) Henek 5128: end Henek 5128: end Henek 5128: end Henek 5128: Henek 5128: for i, w in pairs(utilities_values) do Henek 5128: local used = false Henek 5128: if w <= n then Henek 5128: --check that this weapon hasn't been given already Henek 5128: for j, k in pairs(picked_items) do Henek 5128: if utilities[i] == k then Henek 5128: used = true Henek 5128: end Henek 5128: end Henek 5128: if not used then Henek 5128: table.insert(items_values, w) Henek 5128: table.insert(items, utilities[i]) Henek 5128: end Henek 5128: end Henek 5128: end Henek 5128: Henek 5128: local r = GetRandom(table.maxn(items_values)) + 1 Henek 5128: table.insert(picked_items, items[r]) Henek 5128: n = n - items_values[r] Henek 5128: end Henek 5128: Henek 5128: return picked_items Henek 5128: end Henek 5128: Henek 5128: function assignAmmo(hog) Henek 5128: local name = GetHogTeamName(hog) Henek 5128: local processed = getTeamValue(name, "processed") Henek 5128: if processed == nil or not processed then Henek 5128: local ammo = getTeamValue(name, "ammo") Henek 5128: if ammo == nil then Henek 5128: ammo = randomAmmo() Henek 5128: setTeamValue(name, "ammo", ammo) Henek 5128: end Henek 5128: for i, w in pairs(ammo) do Henek 5128: AddAmmo(hog, w) Henek 5128: end Henek 5128: setTeamValue(name, "processed", true) Henek 5128: end Henek 5128: end Henek 5128: Henek 5128: function reset(hog) Henek 5128: setTeamValue(GetHogTeamName(hog), "processed", false) Henek 5128: end Henek 5128: claymore 5118: function onGameInit() sheepluva 10032: DisableGameFlags(gfPerHogAmmo) sheepluva 10032: EnableGameFlags(gfResetWeps) claymore 5118: - GameFlags = band(bor(GameFlags, gfResetWeps), bnot(gfPerHogAmmo)) Henek 5128: Goals = loc("Each turn you get 1-3 random weapons") claymore 5118: - Goals = loc("Each turn you get 1-3 random weapons|The stronger they are, the fewer you get") claymore 5118: end claymore 5118: claymore 5118: function onGameStart() Henek 5128: trackTeams() claymore 5118: if MapHasBorder() == false then claymore 5118: for i, w in pairs(airweapons) do claymore 5118: table.insert(weapons, w) claymore 5118: end claymore 5118: for i, w in pairs(airweapons_values) do claymore 5118: table.insert(weapons_values, w) claymore 5118: end claymore 5118: end claymore 5118: - claymore 5118: - --ShowMission(loc("Balanced Random Weapons"), loc("A game of luck"), loc("Each turn you'll get a weapon, and if it sucks you'll get some more!"), -amSkip, 0) claymore 5118: end claymore 5118: claymore 5118: function onAmmoStoreInit() claymore 5118: SetAmmo(amSkip, 9, 0, 0, 0) claymore 5118: claymore 5118: SetAmmo(amExtraDamage, 0, 1, 0, 1) claymore 5118: SetAmmo(amInvulnerable, 0, 1, 0, 1) claymore 5118: SetAmmo(amExtraTime, 0, 1, 0, 1) claymore 5118: SetAmmo(amLaserSight, 0, 1, 0, 1) claymore 5118: SetAmmo(amVampiric, 0, 1, 0, 1) claymore 5118: claymore 5118: for i, w in pairs(utilities) do claymore 5118: SetAmmo(w, 0, 0, 0, 1) claymore 5118: end claymore 5118: claymore 5118: for i, w in pairs(weapons) do claymore 5118: SetAmmo(w, 0, 0, 0, 1) claymore 5118: end claymore 5118: claymore 5118: for i, w in pairs(airweapons) do claymore 5118: SetAmmo(w, 0, 0, 0, 1) claymore 5118: end claymore 5118: end claymore 5118: claymore 5118: function onNewTurn() Henek 5128: runOnGears(assignAmmo) Henek 5128: runOnGears(reset) Henek 5128: setTeamValue(GetHogTeamName(CurrentHedgehog), "ammo", nil) Henek 5128: end claymore 5118: - local n = 3 --"points" to be allocated on weapons claymore 5118: - claymore 5118: - --pick random weapon and subtract cost claymore 5118: - local r = GetRandom(table.maxn(weapons_values)) + 1 claymore 5118: - AddAmmo(CurrentHedgehog, weapons[r]) claymore 5118: - local items_used = {} claymore 5118: - items_used[1] = weapons[r] claymore 5118: - n = n - weapons_values[r] claymore 5118: - claymore 5118: - claymore 5118: - --choose any weapons or utilities to use up remaining n claymore 5118: Henek 5128: function onGearAdd(gear) Henek 5128: if GetGearType(gear) == gtHedgehog then Henek 5128: trackGear(gear) claymore 5118: - while n > 0 do claymore 5118: - local items = {} claymore 5118: - local items_values = {} claymore 5118: - claymore 5118: - for i, w in pairs(weapons_values) do claymore 5118: - local used = false claymore 5118: - if w <= n then claymore 5118: - --check that this weapon hasn't been given already claymore 5118: - for j = 1, table.maxn(items_used) do claymore 5118: - if weapons[i] == items_used[j] then claymore 5118: - used = true claymore 5118: - end claymore 5118: - end claymore 5118: - if not used then claymore 5118: - table.insert(items_values, w) claymore 5118: - table.insert(items, weapons[i]) claymore 5118: - end claymore 5118: end claymore 5118: end claymore 5118: Henek 5128: function onGearDelete(gear) Henek 5128: trackDeletion(gear) claymore 5118: - for i, w in pairs(utilities_values) do claymore 5118: - local used = false claymore 5118: - if w <= n then claymore 5118: - --check that this weapon hasn't been given already claymore 5118: - for j = 1, table.maxn(items_used) do claymore 5118: - if utilities[i] == items_used[j] then claymore 5118: - used = true claymore 5118: - end claymore 5118: end claymore 5118: - if not used then claymore 5118: - table.insert(items_values, w) claymore 5118: - table.insert(items, utilities[i]) claymore 5118: - end claymore 5118: - end claymore 5118: - end claymore 5118: - claymore 5118: - local r = GetRandom(table.maxn(items_values)) + 1 claymore 5118: - AddAmmo(CurrentHedgehog, items[r]) claymore 5118: - table.insert(items_used, items[r]) claymore 5118: - n = n - items_values[r] claymore 5118: - end claymore 5118: -end