[Script] [Multiplayer] [Update] Added customization to The Specialists
This script is the same as The Specialists but allowing customization of weapons, names, hats and health. Similar as to how Highlander was updated to allow the player choose what weapons to play with.
The Nth hog receives all the weapons with N bullets in the scheme. Note that two grenade bullets does not mean two grenades but that the second hog receives a grenade.
The amount of ammo is fixed to 1 for everything except for seduction, rope, parachute and snowball, wich is infinite; and girder, portalgun and rubber which is 2.
Names, hats and health can be modified by script parameters, e.g.,
Names: n1=name1, ..., n8=name8
Hats: h1=hat1, ..., h8=hat8
Health (life): l1=123, ..., l8=321
Save this in Data/Script/Multiplayer as The_Specialists_0.8.lua
---------------------------------- -- THE SPECIALISTS MODE 0.8 -- by mikade ---------------------------------- -- version history ----------------- -- version 0.1 ----------------- -- concept test ---------------- -- version 0.2 ---------------- -- added gfRandomOrder to gameflags -- removed some deprecated variables/methods -- fixed lack of portal reset ---------------- -- version 0.3 ---------------- -- added switching on start -- removed switch from engineer weaponset ---------------- -- version 0.4 ---------------- -- Attempted to: -- fix potential switch explit -- improve user feedback on start ---------------- -- version 0.5 ---------------- -- provision for variable minetimer / demo mines set to 5000ms -- don't autoswitch if player only has 1 hog on his team ---------------- -- version 0.6 ---------------- -- for the meanwhile, don't drop any crates except health crates ---------------- -- version 0.7 ---------------- -- perhogadmsdf <img src="/images/smileys/biggrin.png" title="Big Grin" alt="Big Grin" /> :D <img src="/images/smileys/biggrin.png" title="Big Grin" alt="Big Grin" /> :D ---------------- -- version 0.8 ---------------- -- added customization -- parameters: n1, ..., n8 names; h1, ..., h8 hats; l1, ..., l8 health (life) -------------------- --TO DO -------------------- -- balance hog health, maybe -- add proper gameflag checking, maybe (so that we can throw in a .cfg and let the users break everything) HedgewarsScriptLoad("/Scripts/Locale.lua") HedgewarsScriptLoad("/Scripts/Tracker.lua") HedgewarsScriptLoad("/Scripts/Params.lua") local numhhs = 0 local hhs = {} local currName local lastName local started = false local switchStage = 0 local hogCounter local weapons = {} local hhindex = {} local turnsCounter = 0 function onParameters() parseParams() end function CountHog(gear) hogCounter = hogCounter +1 end function CreateTeam() currTeam = "" lastTeam = "" z = 0 for i = 0, (numhhs-1) do AddAmmo(hhs[i], amTeleport, 100) currTeam = GetHogTeamName(hhs[i]) if currTeam == lastTeam then z = z + 1 else z = 1 end if z == 1 then if params["n1"] then SetHogName(hhs[i], params["n1"]) else SetHogName(hhs[i],loc("Soldier")) end if params["h1"] then SetHogHat(hhs[i], params["h1"]) else SetHogHat(hhs[i], "sf_vega") end if params["l1"] then SetHealth(hhs[i], params["l1"]) else SetHealth(hhs[i],200) end hhindex[hhs[i]] = z elseif z == 2 then if params["n2"] then SetHogName(hhs[i], params["n2"]) else SetHogName(hhs[i],loc("Engineer")) end if params["h2"] then SetHogHat(hhs[i], params["h2"]) else SetHogHat(hhs[i], "Glasses") end if params["l2"] then SetHealth(hhs[i], params["l2"]) end hhindex[hhs[i]] = z elseif z == 3 then if params["n3"] then SetHogName(hhs[i], params["n3"]) else SetHogName(hhs[i],loc("Ninja")) end if params["h3"] then SetHogHat(hhs[i], params["h3"]) else SetHogHat(hhs[i], "NinjaFull") end if params["l3"] then SetHealth(hhs[i], params["l3"]) else SetHealth(hhs[i],80) end hhindex[hhs[i]] = z elseif z == 4 then if params["n4"] then SetHogName(hhs[i], params["n4"]) else SetHogName(hhs[i],loc("Demo")) end if params["h4"] then SetHogHat(hhs[i], params["h4"]) else SetHogHat(hhs[i], "Skull") end if params["l4"] then SetHealth(hhs[i], params["l4"]) else SetHealth(hhs[i],200) end hhindex[hhs[i]] = z elseif z == 5 then if params["n5"] then SetHogName(hhs[i], params["n5"]) else SetHogName(hhs[i],loc("Sniper")) end if params["h5"] then SetHogHat(hhs[i], params["h5"]) else SetHogHat(hhs[i], "Sniper") end if params["l5"] then SetHealth(hhs[i], params["l5"]) else SetHealth(hhs[i],120) end hhindex[hhs[i]] = z elseif z == 6 then if params["n6"] then SetHogName(hhs[i], params["n6"]) else SetHogName(hhs[i],loc("Saint")) end if params["h6"] then SetHogHat(hhs[i], params["h6"]) else SetHogHat(hhs[i], "angel") end if params["l6"] then SetHealth(hhs[i], params["l6"]) else SetHealth(hhs[i],300) end hhindex[hhs[i]] = z elseif z == 7 then if params["n7"] then SetHogName(hhs[i], params["n7"]) else SetHogName(hhs[i],loc("Pyro")) end if params["h7"] then SetHogHat(hhs[i], params["h7"]) else SetHogHat(hhs[i], "Gasmask") end if params["l7"] then SetHealth(hhs[i], params["l7"]) else SetHealth(hhs[i],150) end hhindex[hhs[i]] = z elseif z == 8 then if params["n8"] then SetHogName(hhs[i], params["n8"]) else SetHogName(hhs[i],loc("Loon")) end if params["h8"] then SetHogHat(hhs[i], params["h8"]) else SetHogHat(hhs[i], "clown") end if params["l8"] then SetHealth(hhs[i], params["l8"]) else SetHealth(hhs[i],100) end hhindex[hhs[i]] = z end lastTeam = GetHogTeamName(hhs[i]) end end function onGameInit() ClearGameFlags() EnableGameFlags(gfRandomOrder, gfInfAttack, gfPlaceHog, gfPerHogAmmo) Delay = 10 HealthCaseProb = 100 end function onGameStart() for i=1,6 do weapons[i] = GetAmmoCount(hhs[0], i) end -- amSkip = 7 for i=8,20 do weapons[i] = GetAmmoCount(hhs[0], i) end -- amSwitch = 21 for i=22,57 do weapons[i] = GetAmmoCount(hhs[0], i) end CreateTeam() ShowMission ( loc("THE SPECIALISTS"), loc("a Hedgewars mini-game"), loc("Eliminate the enemy specialists.") .. "|" .. " " .. "|" .. loc("Game Modifiers: ") .. "|" .. loc("Per-Hog Ammo") .. "|" .. loc("Weapons Reset") .. "|" .. loc("Unlimited Attacks") .. "|" .. "", 4, 4000 ) trackTeams() end function restoreWeapons(hog) for weapon,index in pairs(weapons) do if index == hhindex[hog] then if weapon == amRope then AddAmmo(hog, amRope, 100) elseif weapon == amParachute then AddAmmo(hog, amParachute, 100) elseif weapon == amSeduction then AddAmmo(hog, amSeduction, 100) elseif weapon == amSnowball then AddAmmo(hog, amSnowball, 100) elseif weapon == amGirder then AddAmmo(hog, amGirder, 2) elseif weapon == amPortalGun then AddAmmo(hog, amPortalGun, 2) elseif weapon == amRubber then AddAmmo(hog, amRubber, 2) elseif weapon == amTeleport and numhhs < turnsCounter then AddAmmo(hog, amTeleport, 1) else AddAmmo(hog, weapon, 1) end elseif weapon ~= amTeleport or numhhs < turnsCounter then AddAmmo(hog, weapon, 0) end end end function onNewTurn() turnsCounter = 1+turnsCounter for i = 0,(numhhs-1) do restoreWeapons(hhs[i]) end currName = GetHogName(CurrentHedgehog) lastName = GetHogName(CurrentHedgehog) started = true switchStage = 0 end function onGameTick20() if (CurrentHedgehog ~= nil) then currName = GetHogName(CurrentHedgehog) if (currName ~= lastName) and (switchStage > 5) then AddCaption(loc("Switched to ") .. currName .. "!") end if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and (switchStage < 5) then AddCaption(loc("Prepare yourself") .. ", " .. currName .. "!") hogCounter = 0 runOnHogsInTeam(CountHog, GetHogTeamName(CurrentHedgehog) ) if hogCounter > 1 then switchStage = switchStage + 1 if switchStage == 1 then AddAmmo(CurrentHedgehog, amSwitch, 1) elseif switchStage == 2 then SetWeapon(amSwitch) elseif switchStage == 3 then SetGearMessage(CurrentHedgehog,gmAttack) elseif switchStage == 4 then switchStage = 6 AddAmmo(CurrentHedgehog, amSwitch, 0) end else switchStage = 6 end end lastName = currName end end function onGearAdd(gear) if GetGearType(gear) == gtHedgehog then hhs[numhhs] = gear numhhs = numhhs + 1 elseif (GetGearType(gear) == gtMine) and (started == true) then SetTimer(gear,5000) end if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then trackGear(gear) end end function onGearDelete(gear) if (GetGearType(gear) == gtHedgehog) or (GetGearType(gear) == gtResurrector) then trackDeletion(gear) end end
And save this in Data/Script/Multiplayer as The_Specialists_0.8.cfg
* The_Specialists
Add this line to weapons.ini in your hedgewars directory to have the weapons of the original script:
The%20Specialists=101012934543083002200080600740000600050705080700600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Where is the hw folder?
- GNU/Linux: ~/.hedgewars
- OSX: ~/Library/Application Support/Hedgewars
- Windows: %USERPROFILE%\Hedgewars