Garry's Mod

Garry's Mod

Not enough ratings
Horde Gamemode: Creating Custom Subclass Addons
By Gorlami
A full tutorial on how to make a custom subclass addon for HORDE gamemode!
   
Award
Favorite
Favorited
Unfavorite
1. Create Subclass Addon Folders
What it should look like:
my_subclass/
--lua/horde/gamemode/
----perks/
----subclasses/

--materials/
----subclasses/

Enter your addons/ folder, and make those directories. You can name your addon whatever you want, I'm using my_subclass for now.

Create those directories as well.
2. Add Materials
Put your subclass icon in the materials/ folder. I choose to put it in materials/subclass/.
3. Add Subclass Lua File
Create your subclass lua file here.

Add the following code. Switch out some sections as you like.
SUBCLASS.PrintName = "CEO" -- Required SUBCLASS.UnlockCost = 0 -- How many skull tokens are required to unlock this class SUBCLASS.ParentClass = HORDE.Class_Assault -- Required for any new classes SUBCLASS.Icon = "subclasses/ceo.png" -- Required, Subclass Icon SUBCLASS.Description = [[ CEO Mindset.]] -- Required SUBCLASS.BasePerk = "specops_base" SUBCLASS.Perks = { [1] = {title = "1", choices = {"assault_drain", "assault_drain"}}, [2] = {title = "2", choices = {"assault_drain", "assault_drain"}}, [3] = {title = "3", choices = {"assault_drain", "assault_drain"}}, [4] = {title = "4", choices = {"assault_drain", "assault_drain"}}, } -- Required

We don't have any custom perks for now, so we can just use the
assault_drain
perk as an example.
4. View Your Subclass In-game!
5. (Optional) Creating a Base Perk
Goto the perks/ folder and create your base perk. I call it ceo_base.lua.

Open it and use the following code for reference:
PERK.PrintName = "CEO Base" PERK.Description = [[ I am the CEO. {1} increased damage. ({2} + {3} per level, up to {4})]] -- These are used to fill out the {1}, {2}, {3}, {4} above. -- Mainly useful for translation, it is optional. PERK.Params = { [1] = {percent = true, base = 0.5, level = 0.01, max = 1.0, classname = "CEO"}, [2] = {value = 0.5, percent = true}, [3] = {value = 0.01, percent = true}, [4] = {value = 1.0, percent = true}, } PERK.Hooks = {} -- This is a required function if you are planning to use bonuses based on levels. PERK.Hooks.Horde_PrecomputePerkLevelBonus = function (ply) if SERVER then ply:Horde_SetPerkLevelBonus("ceo_base", 0.5 + math.min(1, 0.01 * ply:Horde_GetLevel("CEO"))) end end -- Apply the dammage bonus. PERK.Hooks.Horde_OnPlayerDamage = function (ply, npc, bonus, hitgroup, dmginfo) if ply:Horde_GetPerk("ceo_base") then bonus.increase = bonus.increase + ply:Horde_GetPerkLevelBonus("ceo_base") end end

Then go back to ceo.lua and change the base perk:
SUBCLASS.BasePerk = "ceo_base"

Then we're done!
6. Misc
1. You can upload your subclass addon to the workshop! I recommend using the Crowbar tool.
2. To see more sample perks you can check them out in the github files: https://github.com/tpan496/Horde/tree/main/gamemode/perks
2 Comments
The1337Gh0st 5 Aug, 2022 @ 10:51pm 
Good guide, but I think it would help to explain better how to use parameters and how level bonuses are calculated. In the future, it would also be nice to explain how to set up custom buffs / debuffs.
Mabolob 5 Aug, 2022 @ 2:39am 
WARNING! Carry on reading! Or you will die, even if you only looked at the word warning! Once there was a little girl called Clarissa, she was ten-years-old and she lived in a mental hospital, because she killed her mom and her dad. She got so bad she went to kill all the staff in the hospital so the More- government decided that best idea was to get rid of her so they set up a special room to kill her, as humane as possible but it went wrong the machine they were using went wrong. And she sat there in agony for hours until she died. Now every week on the day of her death she returns to the person that reads this letter, on a monday night at 12:00a.m. She creeps into your room and kills you slowly, by cutting you and watching you bleed to death. Now send this to ten other profiles on this one site, and she will haunt someone else who doesn't. This isn't fake. apparently, if u copy and paste this to ten comments in the next ten minutes u will have the best of your life