Custom Class Tutorial

Hello! My name is Spoolicus, and in this tutorial we will be looking at adding a custom class to Stonehearth, complete with UI elements and the beginnings of a recipe list, based on my own mod, Arcanism.

Before we start, there are a few things that you need to know. If you have Stonehearth installed on Steam, your mods folder is located in C:\Program Files (x86)\Steam\steamapps\common\Stonehearth\mods. If you do not have Steam, it is located at C:\Program Files (x86)\Stonehearth\mods. A mod in Stonehearth is appended with .smod. This file is only a renamed .zip file. If you need to figure out how to change file extentions, look here. Now that that is settled, lets look at things we will need for this tutorial.

For your convenience, I have uploaded all of the model files and a few other files into a .zip file here. Do not hesitate to edit the models to your liking for your own mod.

A Voxel Modeler, such as Quibicle 1 or 2, Home or Master Edition. I will be using Qubicle 2 Home Edition. There are also other free programs, the most popular is StoneVox 3D.

A Text Editor, such as Sublime Text 2 or Notepad++. Both are free, with Sublime Text 2 being an unlimited free trial. I will be using Sublime Text 2.

An image editing program, such as GIMP or Paint.NET. I will be using Paint.NET.

A program to interact with .zip files, such as 7-Zip, which is what I will be using.

A Stonehearth mod called Microworld. This allows us to rapidly generate a small world and test our mod. With these in hand, lets get to work!

---

Part One - File Setup

First off, we need a base for our mod. Navigate to your mods directory and rename stonehearth.smod into stonehearth.zip. Now, extract the file and put it somewhere on your desktop, or anywhere you can access it easily.

Go ahead and create a new folder on your desktop and name "arcanism". We'll be operating out of this for most of the tutorial.



Figure 1-1: The Two Folders All of our mod files will go into this one folder, so be careful of that. In this folder, we will create the world. Well, not really. But close!

Open up the stonehearth folder, find manifest.json, and open it in your text editor of choice. If everything went right, you should see a really long list of code. Don't be scared! Go ahead and copy that file over to the arcanism folder. Don't close the manifest from the stonehearth folder. It's important!

Next, delete everything. Yep, that's right. Everything.We're gonna be building this from the ground up. Now, we're going to set up the foundation for our mod. Go ahead and type the following into the manifest, pressing Tab to indent and replacing "arcanism" with whatever you named your mod.

Fig 1-2: Coding is "fun"

Congratulataions! You're a game developer! Now that you're done patting yourself on the back, lets set up some other folders that we'll need! In the mod folder, create a folder named jobs and entities. Also, copy the "data" folder from the tutorial files I provided into the "arcanism" folder as well. For Part Two, we're going to be focusing mostly on the jobs folder.

Part Two - The Job Folder

Now we can focus on the meat of our mod! Go ahead and create a folder inside of the jboos folder you just created called "arcanist". This is where we define what our new class does. There are several different components to a job in Stonehearth. First is the job's description. This file defines everything about the class, from it's promotion talisman to its animations. As such, it's kind of big. Navigate in your stonehearth folder to stonehearth\jobs\carpenter and copy over everything into arcanism\jobs\arcanist. We'll be changing all of these files to fit our purposes with this mod.



Fig 1-3: The Arcanist Folder

Let's start with changing the carpenter_abilities folder. Rename it to "arcanist_abilities", and do the same for the .json file inside of it. Now we're getting somewhere! Open up arcanist_abilities.json. You'll see a big list of text. Scroll down to the bottom under "injected commands", at line 44, and change the following:

"file(/data/commands/build_workshop)" to: "arcanism/data/commands/build_workshop"