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 .
We have to separate the required work into two steps this time:
- Creating the animation, e.g. in Blender.
- 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:
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:
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 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:
** “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”.
** “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:
** “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”:
** “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”):
In this file you want to change all references from “sway” to “hand”. Just pay attention that you do not miss one.
** “Adjust the Manifest”**
As “usual” we need to introduce our animation to Stonehearth using the manifest, which you can find here:
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.):