Today I learned (and other modding tricks)

This tread is to share the more unorthodox tricks that most everyday modders (read: basic json manipulators)
might not know about. Sometimes you spend lots of time trying to figure things out, before finding a solution. This thread is for these kinds of solutions. This way, we all get better at modding (hopefully), we get some practical modding documentation and are able to make more awesome things.

Please explain how things work if that is necessary for your trick.

Multiple items per recipe

Option 1: Crafting Batches

Jist: Here, you make use of pile mehcanics, where you still craft one item (the batch), and then use pile harvesting to get all the items you want out out of the pile. This might be what you want, and it might also not be what you want, depending on your case (think about gameplay, and whether players will understand what they need to do.)

Practical application: You make an item as usual. Then you need the stonehearth:resource_node component inside the your_item.json under components. This component is also used for the vanilla piles, found under stonehearth/entities/containers.

stonehearth:resource_node

all text after these are comments, but .json will not recognise that as such, so remove it when copying.

your_mod/entities/your_item/your_item.json:
"components" {
  "stonehearth:resource_node": {
     "resource": "stonehearth:resources:wood:oak_log",  #The resource that the pile will produce 
     "harvest_overlay_effect": "stonehearth:effects:chop_overlay_effect", # The little icon that hovers above a to-be-harvested pile
     "harvester_effect": "mine", # I think this is what animation they use, your other option is '"chop".
     "description": "chop_tree", # Self-explanatory
     "durability": 18 # How many items your pile creates.
    }
 }

If you pursue this path and want multiple different items, I’d recommend using loot tables, which is worth learning about. You’d add the loot table directly to stoneheart:resource_node if you do this. Some variables in the component will be worthless if you do this, namely “durability” and “resource”, as these pieces of data are already mentioned in the loot_table

OPtion 2: Directly crafting multiple items.

Here you mess with the recipe.json.

       "produces": [ { "item":"Peg_Planning_mod:large_wooden_peg" },
	                 { "item":"Peg_Planning_mod:large_wooden_peg" },
	                 { "item":"Peg_Planning_mod:large_wooden_peg" } ]

This produces three large wooden pegs. It has the advantage that it can easily be used for multiple different items.

3 Likes

maybe someone can teach me and others something: in Qubicle,
how do i save a file as .qb without the game exploding if it tries to use it.
currently my axe is selectable in the debug tool, and, because the non iconic version still looks like the default iron sword, i can select it. but as soon as i hit iconic (which i did edit in qubicle)
it throws up an error.

Export with compression turned off. The game can’t read qb files if they have compression checked in the export settings (mentioned many times at the forums). Also Z-Axis has to be right handed to avoid misaligments.

2 Likes

exactly the info i was looking for! thanks
EDIT:

it woooorked, i wooooorked!
https://steamcommunity.com/sharedfiles/filedetails/?id=1369543573

now to make some more small stuff like this to get up to speed, figure out how to do steam workshop, and then its actually time for my herbalist potion idea :stuck_out_tongue:

1 Like

maybe someone knows the following: where in the stonehearth .smod -
(which is just a fancy zip, for aspiring modders, you can even rename it .zip so you can look inside!)

  • are the normal “recipes” stored? (that tell the craftsmen what they can build) i want to give something to my carpenter so im guessing i needs to put down: “workshop”: “stonehearth:carpenter:workbench”

but i’d like to double check.

EDIT: found it, they are stored under the classes, under the jobs. so in something like:
stonehearth.zip\stonehearth\jobs\carpenter\recipes
(where stonehearth.zip is the stonehearth.smod, renamed)