# Applying buffs to custom classes

**URL:** <https://discourse.stonehearth.net/t/applying-buffs-to-custom-classes/38514>\
**Category:** Modding\
**Created:** [November 11, 2018, 12:20pm UTC](https://discourse.stonehearth.net/t/applying-buffs-to-custom-classes/38514 "2018-11-11T12:20:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amnaa](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/amnaa/32/60874_2.png) [@Amnaa](https://discourse.stonehearth.net/u/Amnaa)\
**Post date:** [November 11, 2018, 12:20pm UTC](https://discourse.stonehearth.net/t/applying-buffs-to-custom-classes/38514/1 "2018-11-11T12:20:18Z")

</div>

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 😂

---

<div class="post-metadata">

**Author:** ![BrunoSupremo](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/brunosupremo/32/54819_2.png) [@BrunoSupremo](https://discourse.stonehearth.net/u/BrunoSupremo)\
**Post date:** [November 11, 2018, 12:47pm UTC](https://discourse.stonehearth.net/t/applying-buffs-to-custom-classes/38514/2 "2018-11-11T12:47:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Amnaa](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/amnaa/32/60874_2.png) [@Amnaa](https://discourse.stonehearth.net/u/Amnaa)\
**Post date:** [November 11, 2018, 12:48pm UTC](https://discourse.stonehearth.net/t/applying-buffs-to-custom-classes/38514/3 "2018-11-11T12:48:06Z")

</div>

Sure, here it is.

[royal.rar](https://discourse.stonehearth.net/uploads/short-url/6x8aHKrFjVG9CEGsK3D9WW6X2pQ.rar) (49.3 KB)

---

<div class="post-metadata">

**Author:** ![BrunoSupremo](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/brunosupremo/32/54819_2.png) [@BrunoSupremo](https://discourse.stonehearth.net/u/BrunoSupremo)\
**Post date:** [November 11, 2018, 1:08pm UTC](https://discourse.stonehearth.net/t/applying-buffs-to-custom-classes/38514/4 "2018-11-11T13:08:51Z")

</div>

In the king.lua, replace everything with this:

```auto
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

 ![image](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/e/8/e81569c86c462f864f3bf61befa8fc7699cd1504.png)

---

<div class="post-metadata">

**Author:** ![Amnaa](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/amnaa/32/60874_2.png) [@Amnaa](https://discourse.stonehearth.net/u/Amnaa)\
**Post date:** [November 11, 2018, 1:13pm UTC](https://discourse.stonehearth.net/t/applying-buffs-to-custom-classes/38514/5 "2018-11-11T13:13:33Z")

</div>

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 😂

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:
