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:
- ââŚ\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:
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:
"animation": "idle_hand.json",
** â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",
** â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.
** â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.):
Enjoy animating!
P.S. In case you cannot edit the Lua-files, head over to @Xavionâs thread and see if this helps.