Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------
- -- THE SPECIALISTS 2 HOGS OF LIBERTY
- ----------------------------------
- -- SCRIPT PARAMETER SYNTAX
- --[[
- With the script parameter, you can change the order of specialists per team.
- == Changing the specialists for all teams ==
- In the script parameter, put:
- t=XXXXXXXX
- Where 'X' is a “specialist letter” (see below). Each letter stands for
- the role of a hedgehog in the team (in that order).
- If you leave out a letter, that hedgehog will be the default.
- == Changing the specialists for on a per-team basis ==
- Same as above, but instead of “t”, you use “t1”, “t2”, ... “t8” for
- each of the teams (team 1 to team 8).
- == Specialist letters ==
- C = Coward
- T = Trimmer
- E = Expert
- M = Medic
- G = Guard
- H = Hunter
- A = Aviator
- S = Sportsman
- == Examples ==
- Example 1:
- t=EEEEHHHH
- 4 experts and 4 hunters for all teams.
- Example 2:
- t1=CHTEMGAS,t2=HHHHHHHH
- Team 1: coward, hunter, trimmer, expert, medic, guard, aviator, sportsman.
- Team 2: All-hunters team.
- All other teams use the default settings.
- ]]
- --------------------
- -- TODO
- --------------------
- -- 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")
- -- default team values
- local currTeamIdx = 0;
- local teamRoles = {
- {'C','T','E','M','G','H','A','S'},
- {'C','T','E','M','G','H','A','S'},
- {'C','T','E','M','G','H','A','S'},
- {'C','T','E','M','G','H','A','S'},
- {'C','T','E','M','G','H','A','S'},
- {'C','T','E','M','G','H','A','S'},
- {'C','T','E','M','G','H','A','S'},
- {'C','T','E','M','G','H','A','S'}
- };
- local numhhs = 0
- local hhs = {}
- local started = false
- function onParameters()
- parseParams()
- -- All teams
- if params['t'] ~= nil then
- for i = 1, 8 do
- for j = 1, 8 do
- if string.len(params['t']) >= j then
- teamRoles[i][j] = string.upper(string.sub(params['t'],j,j));
- end
- end
- end
- end
- -- Specific team
- for i = 1, 8 do
- if params['t'..i] ~= nil then
- for j = 1, 8 do
- if string.len(params['t'..i]) >= j then
- teamRoles[i][j] = string.upper(string.sub(params['t'..i],j,j));
- end
- end
- end
- end
- end
- function onNewAmmoStore(groupIndex, hogIndex)
- SetAmmo(amSkip, 9, 0, 0, 0)
- groupIndex = groupIndex + 1
- hogIndex = hogIndex + 1
- if teamRoles[groupIndex][hogIndex] == 'C' then
- SetAmmo(amIceGun, 1, 0, 0, 0)
- SetAmmo(amSeduction, 1, 0, 0, 0)
- SetAmmo(amKamikaze, 1, 0, 0, 0)
- elseif teamRoles[groupIndex][hogIndex] == 'T' then
- SetAmmo(amBlowTorch, 1, 0, 0, 0)
- SetAmmo(amCake, 1, 0, 0, 0)
- SetAmmo(amMolotov, 1, 0, 0, 0)
- elseif teamRoles[groupIndex][hogIndex] == 'E' then
- SetAmmo(amPortalGun, 1, 0, 0, 0)
- SetAmmo(amDrill, 1, 0, 0, 0)
- SetAmmo(amLaserSight, 1, 0, 0, 0)
- elseif teamRoles[groupIndex][hogIndex] == 'M' then
- SetAmmo(amRope, 3, 0, 0, 0)
- SetAmmo(amSwitch, 1, 0, 0, 0)
- SetAmmo(amResurrector, 1, 0, 0, 0)
- elseif teamRoles[groupIndex][hogIndex] == 'G' then
- SetAmmo(amAirMine, 2, 0, 0, 0)
- SetAmmo(amGirder, 1, 0, 0, 0)
- SetAmmo(amInvulnerable, 1, 0, 0, 0)
- elseif teamRoles[groupIndex][hogIndex] == 'H' then
- SetAmmo(amJetpack, 1, 0, 0, 0)
- SetAmmo(amExtraDamage, 1, 0, 0, 0)
- SetAmmo(amSniperRifle, 1, 0, 0, 0)
- elseif teamRoles[groupIndex][hogIndex] == 'A' then
- SetAmmo(amPickHammer, 1, 0, 0, 0)
- SetAmmo(amBirdy, 1, 0, 0, 0)
- SetAmmo(amParachute, 9, 0, 0, 0)
- elseif teamRoles[groupIndex][hogIndex] == 'S' then
- SetAmmo(amBaseballBat, 2, 0, 0, 0)
- SetAmmo(amLowGravity, 1, 0, 0, 0)
- SetAmmo(amExtraTime, 1, 0, 0, 0)
- end
- end
- function CreateTeam()
- currTeam = ""
- lastTeam = ""
- z = 0
- for i = 0, (numhhs-1) do
- currTeam = GetHogTeamName(hhs[i])
- if currTeam == lastTeam then
- z = z + 1
- else
- z = 1
- currTeamIdx = currTeamIdx + 1;
- end
- -- Scale health of each hog with “initial health” setting from game scheme.
- -- 100 = default health
- -- 200 = double health for all hogs
- -- 50 = half health for all hogs
- local function scaleHealth(health)
- local newHealth = div(health * InitHealth, 100)
- -- At least 1 health
- if newHealth <= 0 then
- newHealth = 1
- end
- return newHealth
- end
- if teamRoles[currTeamIdx][z] == 'C' then
- SetHogName(hhs[i],loc("Coward"))
- SetHogHat(hhs[i], "barrelhider")
- SetHealth(hhs[i], scaleHealth(130))
- elseif teamRoles[currTeamIdx][z] == 'T' then
- SetHogHat(hhs[i], "chef")
- SetHogName(hhs[i],loc("Trimmer"))
- SetHealth(hhs[i], scaleHealth(80))
- elseif teamRoles[currTeamIdx][z] == 'E' then
- SetHogName(hhs[i],loc("Expert"))
- SetHogHat(hhs[i], "pirate_eyepatch")
- SetHealth(hhs[i], scaleHealth(110))
- elseif teamRoles[currTeamIdx][z] == 'M' then
- SetHogName(hhs[i],loc("Medic"))
- SetHogHat(hhs[i], "fr_apple")
- SetHealth(hhs[i], scaleHealth(250))
- elseif teamRoles[currTeamIdx][z] == 'G' then
- SetHogName(hhs[i],loc("Guard"))
- SetHogHat(hhs[i], "policecap")
- SetHealth(hhs[i], scaleHealth(160))
- elseif teamRoles[currTeamIdx][z] == 'H' then
- SetHogName(hhs[i],loc("Hunter"))
- SetHogHat(hhs[i], "RobinHood")
- SetHealth(hhs[i], scaleHealth(140))
- elseif teamRoles[currTeamIdx][z] == 'A' then
- SetHogName(hhs[i],loc("Aviator"))
- SetHogHat(hhs[i], "tf_scout")
- SetHealth(hhs[i], scaleHealth(90))
- elseif teamRoles[currTeamIdx][z] == 'S' then
- SetHogName(hhs[i],loc("Sportsman"))
- SetHogHat(hhs[i], "footballhelmet")
- SetHealth(hhs[i], scaleHealth(120))
- end
- lastTeam = GetHogTeamName(hhs[i])
- end
- end
- function onGameInit()
- -- Force-disable harmful game flags
- DisableGameFlags(gfSharedAmmo, gfKing)
- -- Force-enable game-critical game flags
- EnableGameFlags(gfPerHogAmmo, gfResetWeps)
- -- NOTE: For your game scheme, these game flags are recommended: gfResetWeps, gfPlaceHog, gfSwitchHog, gfInfAttack
- -- No weapon crates
- HealthCaseProb = 100
- -- Instructions
- Goals = loc("The Other Specialists: Each hedgehog starts with its own weapon set")
- end
- function onGameStart()
- CreateTeam()
- trackTeams()
- end
- function onNewTurn()
- started = true
- AddCaption(string.format(loc("Prepare yourself, %s!"), GetHogName(CurrentHedgehog)))
- end
- function onGearAdd(gear)
- if GetGearType(gear) == gtHedgehog then
- hhs[numhhs] = gear
- numhhs = numhhs + 1
- elseif (GetGearType(gear) == gtCake) and (started == true) then
- SetGearValues (gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 55)
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement