I want Help with Modding – How to Add a New Buff Effect?

Hey everyone,

I have been messing around with modding in Stonehearth & I am trying to create a custom buff effect for my units. The idea is to have a buff that increases movement speed for a short duration, kind of like a temporary “Sprint” ability. I have looked through some of the existing buffs in the game files but I am struggling to figure out exactly where to tweak things to make it work properly.

Also i have Created a basic buff JSON file. Tried adding the “speed” stat modifier. Hooked it up to an ability trigger.

But for some reason, the effect does not seem to apply correctly. Do I need to add a custom LUA script for it to work properly or am I missing something simple? I have taken a Python course before but working with LUA in this context feels a bit different. If anyone has experience with buffs & stat modifications, I want some pointers.

Also i have check New mod idea: Hearthlings want to leave my town? witch is good

Thank you…:blush:

First, the modding guide page about buffs: Buffs

Then we need to know the code you used. Maybe it has typos, maybe there is no error but it is not reachable, etc…

To test your buff in an easier way, open console (Ctrl+C) and type,
add_buff my_mod:buffs:my_buff
while a citizen is selected. That citizen should now gain the buff.

If it fails, your buff is not correct. if it works, it is just whatever you set to trigger it.
You probably not need any lua at all.

There are many buffs that change speed (searching the game files, there are 33 buffs changing speed in one way or another), you can check those as examples, but a barebone it is this:

   "type": "buff",
   "axis": "buff",
   "display_name": "some name",
   "description": "some desc",
   "icon": "file(buff.png)",
   "modifiers": {
      "speed": {
         "multiply": 1.5
      }
   }
}
1 Like