Applying buffs to custom classes

Hey!

I’ve been fighting with this for two days now. How do I make a custom class have active perks?

I have it in the job description JSON, it is showing in the abilities tab in game, but I can’t get it to apply. I’ve tried stealing pieces of the cleric and the knight (where I completely copied over the inspiring presence perk, which does exactly what I need it to do). I tried to copy the buff JSONs and renamed them to tie them to my manifest, I also just tried out the buff name “stonehearth:buffs:knight:courage_aura” from SH itself, without any luck.

Looking at the Knight files, there seems to be nothing present what would make the perk manifest itself. So I’m wondering what could I be missing.

{
   "type": "job",
   "enabled": true,
   "job_id": "king",
   "display_order": 0.01,
   "alias": "royal:jobs:king",
   "display_name": "King",
   "controller": "royal:class:king",
   "description": "A leader of your people.",
   "requirements": "Crafted by level 6 Blacksmith.",
   "talisman_uri": "royal:king:talisman",
   "default_stance": "passive",
   "abilities": "file(king_abilities)",
   "equipment": {
     "torso": "stonehearth/jobs/cleric/cleric_outfit/cleric_outfit.json",
	 "helmet": "royal:king:crown",
   },
   "roles": "king_job",
   "promotion_activity_name": "promote_king",
   
   "task_groups": [
      "stonehearth:task_groups:town_alert",
      "stonehearth:task_groups:rescue"
   ],
   "icon": "file(images/icon.png)",
   "parent_job": "stonehearth:jobs:worker",
   "level_data": {
      "1": {
         "perks": [
            {
               "type": "apply_buff",
               "name": "For the King!",
               "id": "king_courage_aura",
               "icon": "file(images/icon.png)",
               "buff_name": "stonehearth:buffs:knight:courage_aura",
               "description": "The hearthlings are willing to defend their King.",
               "level": 1,
               "demote_fn": "remove_buff"
            }
         ]
      }
   },
}

Also, if this seems familiar, I’m trying to fix and upgrade Bruno’s Royal mod and I’m failing horribly :joy:

1 Like

Can you upload the whole mod for me to check? You are on the right path, so it should be just a small detail

Sure, here it is.

royal.rar (49.3 KB)

In the king.lua, replace everything with this:

local KingClass = class()
local BaseJob = radiant.mods.require 'stonehearth.jobs.base_job'
radiant.mixin(KingClass, BaseJob)

return KingClass

That old one was copy and pasted from the worker based on my lazyness, and it would reject buffs

Cool! Thanks a lot!!

Actually, when I loaded up the mod, it gave me some errors… Something about setting time and xpgain? I can’t remember. So I lazily stole the whole worker over again and it worked :joy:

Now I can continue working my devilish plan >:D

And if it turns out any good, I’ll let you know before I decide to distribute it in any way :merry:

1 Like