Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HedgewarsScriptLoad("/Scripts/Locale.lua")
- local hhs = {}
- local weapons = {}
- local amount = {}
- local hogammo = {}
- local hoghealth = {}
- local classes = {
- [amGrenade] = {loc("Veteran"), "Rambo"},
- [amClusterBomb] = {loc("Bomber"), "ushanka"},
- [amMortar] = {loc("Terminator"), "Terminator_Glasses"},
- [amBee] = {loc("Researcher"), "scif_2001Y"},
- [amShotgun] = {loc("Hunter"), "RobinHood"},
- [amPickHammer] = {loc("Worker"), "constructor"},
- [amRope] = {loc("Ninja"), "NinjaTriangle"},
- [amMine] = {loc("Terrorist"), "Skull"},
- [amDEagle] = {loc("Taxi driver"), "punkman"},
- [amDynamite] = {loc("Pirate"), "pirate_jack"},
- [amFirePunch] = {loc("Fighter"), "StrawHatFacial"},
- [amWhip] = {loc("Adventurer"), "anzac"},
- [amBaseballBat] = {loc("Gangster"), "cap_blue"},
- [amParachute] = {loc("Infiltrator"), "Disguise"},
- [amAirAttack] = {loc("Colonel"), "war_trenchfrench01"},
- [amMineStrike] = {loc("Air General"), "war_desertofficer"},
- [amBlowTorch] = {loc("Miner"), "dwarf"},
- [amGirder] = {loc("Engineer"), "Glasses"},
- [amTeleport] = {loc("Wizard"), "WizardHat"},
- [amSwitch] = {loc("The trickster"), "sf_balrog"},
- [amBazooka] = {loc("Soldier"), "war_americanww2helmet"},
- [amKamikaze] = {loc("Fanatic"), "Mummy"},
- [amCake] = {loc("Santa"), "Santa"},
- [amSeduction] = {loc("Siren"), "hair_red"},
- [amWatermelon] = {loc("Greengrocer"), "fr_banana"},
- [amHellishBomb] = {loc("Devil"), "Evil"},
- [amNapalm] = {loc("Commander"), "leprechaun"},
- [amDrill] = {loc("Oilman"), "flag_usa"},
- [amBallgun] = {loc("Joker"), "WhySoSerious"},
- [amRCPlane] = {loc("Pilot"), "tf_scout"},
- [amLowGravity] = {loc("Alien"), "mv_Venom"},
- [amExtraDamage] = {loc("Spartan"), "spartan"},
- [amInvulnerable] = {loc("Shaman"), "AkuAku"},
- [amExtraTime] = {loc("Turtle"), "zoo_turtle"},
- [amLaserSight] = {loc("Cyborg"), "cyborg2"},
- [amVampiric] = {loc("Vampire"), "vampirichog"},
- [amSniperRifle] = {loc("Sniper"), "hair_green"},
- [amJetpack] = {loc("Astronaut"), "Meteorhelmet"},
- [amMolotov] = {loc("Thug"), "thugclean"},
- [amBirdy] = {loc("Birdman"), "OldMan"},
- [amPortalGun] = {loc("Scientist"), "Einstein"},
- [amPiano] = {loc("Musician"), "fr_lemon"},
- [amGasBomb] = {loc("Infector"), "Gasmask"},
- [amSineGun] = {loc("Tesla"), "Moustache"},
- [amFlamethrower] = {loc("Pyromaniac"), "poke_charmander"},
- [amSMine] = {loc("Trapper"), "rasta"},
- [amHammer] = {loc("Chief Broom"), "IndianChief"},
- [amResurrector] = {loc("Angel"), "angel"},
- [amDrillStrike] = {loc("King"), "crown"},
- [amSnowball] = {loc("Kid"), "cap_junior"},
- [amTardis] = {loc("Time traveler"), "ShaggyYeti"},
- [amLandGun] = {loc("Gardener"), "bushhider"},
- [amIceGun] = {loc("Ice Lord"), "snowhog"},
- [amKnife] = {loc("Chef"), "chef"},
- [amRubber] = {loc("Bouncer"), "bubble"},
- [amAirMine] = {loc("Coward"), "barrelhider"},
- [amMinigun] = {loc("Clone"), "scif_swStormtrooper"},
- -- UMK: The class if no weapons are set:
- [amNothing] = {loc("Zombie"), "Zombie"};
- }
- function onNewAmmoStore(groupIndex, hogIndex)
- if #weapons == 0 then
- for ammotype = 1, AmmoTypeMax do
- local count = GetAmmo(ammotype)
- if count > 0 and ammotype ~= amSkip then -- UMK: "0 < count" changed to "count > 0"
- table.insert(weapons, ammotype)
- amount[ammotype] = count
- end
- end
- end
- if not hogammo[hogIndex] then
- hogammo[hogIndex] = {}
- end
- -- UMK: You can change the number 3 below to any number (>0) for as many weapons that you want.
- while #hogammo[hogIndex] < 3 do
- -- UMK: This will end the match if no weapons are set, which will hard-lock the game. Do not enable.
- --if #weapons == 0 then EndGame() end
- local randomx = 1
- --{ UMK: Added a condition barrier so it won't cause errors.
- if #weapons > 0 then
- randomx = randomx + GetRandom(#weapons)
- table.insert(hogammo[hogIndex], weapons[randomx])
- table.remove(weapons, randomx)
- else
- table.insert(hogammo[hogIndex], 0) -- Set weapon to amNothing so it has an index.
- end -- }
- end
- for i, ammo in ipairs(hogammo[hogIndex]) do
- SetAmmo(ammo, amount[ammo], 0, 0, 0)
- end
- SetAmmo(amSkip, 9, 0, 0, 0)
- end
- function onGameInit()
- DisableGameFlags(gfSharedAmmo, gfKing)
- EnableGameFlags(gfPerHogAmmo, gfResetWeps)
- HealthCaseProb = 100
- end
- function onGameStart()
- currTeam = ""
- lastTeam = ""
- team = 0 -- UMK: Team index
- mission = {}
- for i in ipairs(hhs) do
- currTeam = GetHogTeamName(hhs[i])
- if currTeam == lastTeam then
- team = team + 1
- else
- team = 0
- end
- if not hoghealth[team] then hoghealth[team] = 80 + GetRandom(13) * 10 end
- SetHealth(hhs[i], hoghealth[team])
- SetHogName(hhs[i], classes[hogammo[team][1]][1])
- SetHogHat(hhs[i], classes[hogammo[team][1]][2])
- --[ UMK: You can revert this, aka delete all my edits below, and it still be okay.
- local NoWeapon, wea = "Empty Hands", {}
- for i=1,#hogammo[team] do
- wea[i] = hogammo[team][i] ~= 0 and GetAmmoName(hogammo[team][i]) or ""
- wea[i] = i > 1 and wea[i] ~= "" and ", "..wea[i] or wea[i]
- wea[i] = i == #hogammo[team] and wea[1] == "" and "No weapons" or wea[i]
- end
- mission[1 + team] = tostring(classes[hogammo[team][1]][1]..": ".. table.concat(wea))
- mission[1 + team] = mission[1 + team] ~= mission[team] and mission[1 + team] or ""
- --]]
- -- This is the old line. It also works.
- --mission[1 + team] = string.format("%s: %s, %s, %s", classes[hogammo[team][1]][1], GetAmmoName(hogammo[team][1]), GetAmmoName(hogammo[team][2]), GetAmmoName(hogammo[team][3]))
- lastTeam = GetHogTeamName(hhs[i])
- end
- ShowMission(loc("Random Specialists"), loc("Minigame"), table.concat(mission, "|"), 0, 0) -- UMK: Changed "minigame" to "Minigame"
- end
- function onNewTurn()
- AddCaption(string.format(loc("Prepare yourself, %s!"), GetHogName(CurrentHedgehog)))
- end
- function onGearAdd(gear)
- if GetGearType(gear) == gtHedgehog then
- table.insert(hhs, gear)
- elseif GetGearType(gear) == gtRCPlane then
- SetHealth(gear, 1)
- elseif GetGearType(gear) == gtAirAttack then
- SetHealth(gear, 1)
- elseif GetGearType(gear) == gtDrill and band(GetState(gear), gsttmpFlag) == 0 then
- SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 35)
- elseif GetGearType(gear) == gtCake then
- SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 35)
- elseif GetGearType(gear) == gtBallGun then
- SetTimer(gear, 1001)
- elseif GetGearType(gear) == gtHellishBomb then
- SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 45)
- SetTimer(gear, 3000)
- elseif GetGearType(gear) == gtMinigunBullet then
- SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 1)
- elseif GetGearType(gear) == gtWatermelon then
- SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 35)
- elseif GetGearType(gear) == gtMelonPiece then
- SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 35)
- elseif GetGearType(gear) == gtBall then
- SetTimer(gear, 1200)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement