# \[Tutorial\] Adding Custom Animations

**URL:** <https://discourse.stonehearth.net/t/tutorial-adding-custom-animations/5186>\
**Category:** Modding\
**Created:** [February 4, 2014, 6:52pm UTC](https://discourse.stonehearth.net/t/tutorial-adding-custom-animations/5186 "2014-02-04T18:52:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![voxel\_pirate](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/voxel_pirate/32/2309_2.png) [@voxel\_pirate](https://discourse.stonehearth.net/u/voxel_pirate)\
**Post date:** [February 4, 2014, 6:52pm UTC](https://discourse.stonehearth.net/t/tutorial-adding-custom-animations/5186/1 "2014-02-04T18:52:02Z")

</div>

This tutorial will require more creative than coding skills 😉. We are going to add an additional animation to the male worker model. This animation will not overwrite an existing one but will add to the list of random animations which will be trigged in case your workers are bored. Why male only? Because it would require 2 animation-files to be politically correct and I am lazy 😞.

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

We have to separate the required work into two steps this time:

1. Creating the animation, e.g. in Blender.
2. Modding the animation into Stonehearth.

🅰 \*\* Let’s start with a few words on the first step (creating an animation)…\*\*

To create an animation for Stonehearth you have to generate an .obj-file out of the .qb-files which you can find in Stonehearth. In our case you will find the male human model e.g. in the following folder:

- “…\Stonehearth\mods\stonehearth\entities\humans\male\_1”.

You can use Qubicle Constructor to create an .obj-file. However, this will require you to have the Home or Master edition. It seems like QC2 will allow the export also in the “play editions” (of which I guess the “Stonehearth Edition” is one of).

Once you have the exported .obj-file, start Blender and load the Stonehearth Add-On for Blender:

> [@Stonehearth Add-On for Blender (Animation)](http://discourse.stonehearth.net/t/stonehearth-add-on-for-blender-download-available/3561):
>
> As mentioned in the thread “[Modding Stonehearth’s Graphics Test Program](http://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/46)”, I have been working on an Stonehearth Add-On for Blender. The idea is to support modders who want to including their own animations into Stonehearth. Disclaimer: This Add-On is still work in progress and might get broken or change its functionality over time. Latest Version: “[Stonehearth Add-On for Blender v0.9.1](http://www.stonehearth.de/downloads/Blender/io_stonehearth_091.zip)” A [manual can be found on the official homepage](http://www.stonehearth.de/weblog/blender/manual-english) of the Add-On. Available meta-files: Settler / Worker ([m…](http://www.stonehearth.de/downloads/Blender/meta_human.json)

This way you should be able to start working on your animations rather fast and it is not really complicated. For the second step let’s assume that you have succeeded. If not just [download the animation](http://www.stonehearth.de/downloads/Blender/human_animation_idle_hand.json) I have prepared (as you can see it in the video below).

🅱 \*\* Second we need to work our way through the different files in the Stonehearth folders…\*\*

This time we have 5 items to work on:

1️⃣ \*\* “Save the Animation”\*\*

Save your animation in the folder “…\Stonehearth\mods\stonehearth\data\rigs\humans\animations\male” and give it a name which you will remember, e.g. “idle\_hand.json”.

2️⃣ \*\* “Adding the Effect”\*\*

Go to the folder “…\Stonehearth\mods\stonehearth\data\rigs\humans\effects” and copy and paste an existing file, e.g. “idle\_sway.json”. Rename the file to reflect the name of your animation (e.g. “idle\_hand.json”) and change the sixth line in the code to:

```
 "animation": "idle_hand.json",

```

3️⃣ \*\* “Adding the Action 1”\*\*

Open the file: “…\Stonehearth\mods\stonehearth\mixins\base\_human\base\_human.json” and add a line in between the existing entries under “actions”:

```
        "stonehearth:actions:idle:hand",

```

4️⃣ \*\* “Adding the Action 2 (Lua)”\*\*

Unfortunately we will have to edit again a Lua-file. Go to the following folder and copy and paste an existing file, e.g. “idle\_sway\_action.lua”. Rename it to reflect the name of your animation (e.g. “idle\_hand\_action.lua”):

“…\Stonehearth\mods\stonehearth\ai\actions”

In this file you want to change all references from “sway” to “hand”. Just pay attention that you do not miss one.

5️⃣ \*\* “Adjust the Manifest”\*\*

As “usual” we need to introduce our animation to Stonehearth using the manifest, which you can find here:

“…\Stonehearth\mods\stonehearth\ai\actions\manifest.json”

The easiest way might be again to look for something we know. Search for the word “sway” and add the following line just below the entry you will find:

```
 "actions:idle:hand" : "file(ai/actions/idle_hand_action.lua)",

```

If everything went well, you can now restart the game and wait until one of your male workers will get bored. Randomly the added animation should be triggered now.

**In case you prefer to see the related tutorial-video (12 Min.):**

[![](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/8/3/83875a08834d34bad9111cf5ecea81fa8e8c33c3.jpeg "Modding Stonehearth's Alpha - Adding Animations") ](https://www.youtube.com/watch?v=2rcweiY0QF0)

Enjoy animating!

P.S. In case you cannot edit the Lua-files, head over to @Xavion’s thread and [see if this helps](http://discourse.stonehearth.net/t/unsmod-stonehearth-mod-decompiler/4699).

---

<div class="post-metadata">

**Author:** ![The\_M](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/the_m/32/1918_2.png) [@The\_M](https://discourse.stonehearth.net/u/The_M)\
**Post date:** [February 4, 2014, 7:01pm UTC](https://discourse.stonehearth.net/t/tutorial-adding-custom-animations/5186/2 "2014-02-04T19:01:36Z")

</div>

More fantastic work not done much in blender for a while but that will probably change now. I was wondering have you tried anything yet with animation that involves interaction with other entities like chairs or beds?

---

<div class="post-metadata">

**Author:** ![voxel\_pirate](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/voxel_pirate/32/2309_2.png) [@voxel\_pirate](https://discourse.stonehearth.net/u/voxel_pirate)\
**Post date:** [February 4, 2014, 7:05pm UTC](https://discourse.stonehearth.net/t/tutorial-adding-custom-animations/5186/3 "2014-02-04T19:05:05Z")

</div>

> [@The\_M](#):
>
> I was wondering have you tried anything yet with animation that involves interaction with other entities like chairs or beds?

Not yet. That might be a bit tricky and I have not thought through it yet. With the Add-On you can import animations now so you can see which additional “objects” are involved from the point of view of Stonehearth. You will have to take this into account… but as mentioned, I did not take a look into this yet. Probalby I will take a look into male / female animations next… but it is on the list.

---

<div class="post-metadata">

**Author:** ![SteveAdamo](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/steveadamo/32/13955_2.png) [@SteveAdamo](https://discourse.stonehearth.net/u/SteveAdamo)\
**Post date:** [February 4, 2014, 9:09pm UTC](https://discourse.stonehearth.net/t/tutorial-adding-custom-animations/5186/4 "2014-02-04T21:09:41Z")

</div>

> [@voxel\_pirate](#):
>
> Enjoy animating!

i never enjoyed animating, back when i was going through my 3D modeling phase… but you, being the energetic Helping Hand that you are, make the process look like “fun” again… 😄

you need to stop being such a positive influence… you’re starting to make @Geoffers747 look bad worse…

---

<div class="post-metadata">

**Author:** ![voxel\_pirate](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/voxel_pirate/32/2309_2.png) [@voxel\_pirate](https://discourse.stonehearth.net/u/voxel_pirate)\
**Post date:** [February 5, 2014, 8:12am UTC](https://discourse.stonehearth.net/t/tutorial-adding-custom-animations/5186/5 "2014-02-05T08:12:31Z")

</div>

To be honest… it is quite some fun, once you have spent a few minutes to understand how Blender and the Add-On works. I guess the biggest obstacle is to lose the respect from the tool. With the Add-On it is really easy in most of the cases to get everything prepared for your animations. Need to congratulate myself for that one… even if this sounds like self-adulation 😉.

P.S. Once QC2 hits the ground and the Stonehearth Edition offers the option to export as an .obj-file (crossing fingers), I hope another obstacle will be removed.

---

<div class="post-metadata">

**Author:** ![eatpoliticians](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/eatpoliticians/32/4044_2.png) [@eatpoliticians](https://discourse.stonehearth.net/u/eatpoliticians)\
**Post date:** [February 6, 2014, 6:44am UTC](https://discourse.stonehearth.net/t/tutorial-adding-custom-animations/5186/6 "2014-02-06T06:44:44Z")

</div>

Hey voxel, have you considered doing a tutorial on coloring? I’m having issues picking good color palettes, I was wondering is there are some secrets for this?

---

<div class="post-metadata">

**Author:** ![voxel\_pirate](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/voxel_pirate/32/2309_2.png) [@voxel\_pirate](https://discourse.stonehearth.net/u/voxel_pirate)\
**Post date:** [February 6, 2014, 7:39am UTC](https://discourse.stonehearth.net/t/tutorial-adding-custom-animations/5186/7 "2014-02-06T07:39:08Z")

</div>

Now that we can load Stonehearth’s .qb-files you can simply use the colors from original models… that might be the easiest way.
