Scrap Mechanic

Scrap Mechanic

Not enough ratings
Adding custom recipes to the game
By [IN-S] Cyllin
A how-to guide on adding recipes to your game. This will allow you to add, modify, or remove crafting recipes from pretty much all crafting stations in the game.
   
Award
Favorite
Favorited
Unfavorite
What does this guide allow you to do?
Let's hand it out first. Scrap Mechanic has a pretty neat Survival Mode. I love playing around making ridiculous cars (I'm looking at the invertable wheels one, Monks) and structures.

However, some of the crafting is pretty lackluste. Not only is it grindy to get enough fuel for your car (there are fixes for this - hehe), but crafting a lot of blocks to build something big requires SO much farming it's quite insane.

Probably a bigger missed gap is the crafting recipes. For example: an electric engine requires battery as fuel. You cannot craft batteries, making this a very unreliable power source. Do you want to make rusted blocks? Too bad. You can only find these in limited amounts, ruining the chance of a Mad Max kind of car.
I can think of a few more examples where crafting could use modification or additions...

Luckily, we are able to just do this.

In this guide, I will take you through the process of adding a new recipe to the crafting bots. This is pretty neat, and you can use this knowledge to modify existing recipes or - deity forbids - remove some entirely.

Enjoy, be creative, and let me know in the comments if you have questions!
Locating the right files
To locate the right files for the job, you have to browse to your base game folder. Usually you can find your folder at the following place:
C:\Program Files (x86)\Steam\steamapps\common\Scrap Mechanic\

Now that you've found this folder, let's head up to the right folder needed here. We are going to Survival and then CraftingRecipes, making your full path as follows:
C:\Program Files (x86)\Steam\steamapps\common\Scrap Mechanic\Survival\CraftingRecipes\

The folder looks pretty much like this:


Now the important files we need to focus on are the following two (for now):
item_names.json craftbot.json

For the following section, I suggest you open both files in a program like Notepad++.
You can open these files in normal Notepad, but it will be a bit more difficult.
Reading the recipe code - and learn to modify it
In order to start modifying the code of the game, we need to understand a little bit how it is built and what we can modify. To do this, we will learn from the existing code and utilise this information to synthesize our new code.

Understanding item_names

The game assigns each object/item in the game to a code, which is pretty unreadable for most of us. Luckily, there is one file which contains the translations between 'our language' and 'computer language'. So let us take a look at the following file first:
item_names.json

Now when opening the file, it'll look something like this:


So that's a big oof! But what all this basically means is that each item has a unique code assigned. And we will need these codes to make our own recipes.

So let's take some examples. Let's try to find the infamous "battery":


This image shows that if we want the game code to understand what we mean by a "battery" we have to make it refer to
910a7f2c-52b0-46eb-8873-ad13255539af

We can check the same examples for the objects "MetalBlock1" - basic metal, and for "Chemical" - the nice pink stuff.




So, now we know that if we want to refer to basic metal, we have to use the code:
8aedf6c2-94e1-4506-89d4-a0227c552f1e
And for the pink chemical, we have to use the code:
f74c2891-79a9-45e0-982e-4896651c2e25

Bottom line: if you want to work with items, look up their code in the item_names.json file!


Understanding crafting templates

So now that we know how to look up item names, let's take a look at how recipes are stored in our beloved crafting stations / craftbots. Let's open the file for the craftbot:
craftbot.json

It should look something like this:


So that's another YIKES! But let's focus on what's important. We can see that this garbage refers to some of the codes we have seen before. In fact, it does so quite clearly! So let's dissect a recipe.

Below, we see the recipe to craft a "Cone". This piece of code tells us that in order to make a crafting cone, we will need 10 metal and 1 ink ammo. Also, it will take us 12 sec to craft, and we will only get 1 cone as a result. Modifying any of these numbers means the recipe will be changed in the game! So if we change the "crafTime" to 6, it will only take 6 seconds to craft.





That means we can add any recipe we want!
Cool. We just need to copy this piece of code, change the item ID referers, quantity, and time, and we got a whole new recipe!

The basic template for adding a new recipe with two ingredients then becomes:
{ "itemId": "ItemToMake", "quantity": AmountToMake, "craftTime": TimeToMake, "ingredientList": [ { "quantity": Amount01, "itemId": "Ingredient01" }, { "quantity": Amount02, "itemId": "Ingredient02" } ] }


So let us take this information into a real world example, where we add a recipe to craft a battery!

Adding your own recipes with example given
So, now we got the basics down of making your own recipe. Let's walk you through adding your own recipe to the game.

We are going to make a battery from 1 chemical and 5 metal blocks.
Let's take this step by step

Gathering the nessecary information & preparing the code

First step in any process is getting the information we need to proceed.

    [1] Decide which items you want to craft, and which items will be needed in which amount to make it. Also, think about a crafting time. Do you want it to be fast, or short? Do you want to craft in bulk? In this case, I've already decided on a few parameters you can lean on:
    crafted item = battery amount(battery) = 1 time(battery) = 10 ingredient 1 = metal block 1 amount(metal block): 5 ingredient 2 = chemical amount(chemical) = 1
    [2] Find the correct item ID's for all items needed in the file "item_names.json". In this case, we need the ID's for battery, chemical, and metal block 1.
    battery ID = "910a7f2c-52b0-46eb-8873-ad13255539af" chemical ID = "f74c2891-79a9-45e0-982e-4896651c2e25" metal block 1 ID = "8aedf6c2-94e1-4506-89d4-a0227c552f1e"

Next, we will use this information we gathered to adjust the code to the format we need. We will use the template of the code for this, and we will fill in it and adjust it to our needs.

    [3] Fill in below template with the codes and information we have gathered from Step 1 and Step 2.
    { "itemId": "ItemToMake", "quantity": AmountToMake, "craftTime": TimeToMake, "ingredientList": [ { "quantity": Amount01, "itemId": "Ingredient01" }, { "quantity": Amount02, "itemId": "Ingredient02" } ] }
    [4] After filling in, it should look like this. Don't forget the quotes around the item ID's!
    { "itemId": "910a7f2c-52b0-46eb-8873-ad13255539af", "quantity": 1, "craftTime": 10, "ingredientList": [ { "quantity": 10, "itemId": "8aedf6c2-94e1-4506-89d4-a0227c552f1e" }, { "quantity": 1, "itemId": "f74c2891-79a9-45e0-982e-4896651c2e25" } ] }
    Inserting the code into your base game
    Now, we are going to open the file
    craftingbot.json
    BACK UP THIS FILE NOW
    (seriously, do this). ... ---
    • Locate the final bracket in the code, and add a single ENTER before it. Move your selection to the newly generated line. See images below.
    • Copy and paste our generated code into this space. It should add in and flow nicely. The code should now pretty much look like this:
    • ADD THIS COMMA . You need to add a comma after the final } of the previous recipe. Without it, the game will bug and not function. See image!
    If you followed all steps and did everything correctly, you should now have a shiny, functional, new recipe! Congratulations!
The result
28 Comments
Kierteiyu May 13, 2022 @ 8:03am 
item_names.json still exist but it is in C:\Program Files (x86)\Steam\steamapps\common\Scrap Mechanic\Survival\Gui\Language\English
JBea Jun 11, 2021 @ 2:54am 
@Quin97 the file is now called survival_items.Lua

Scrap Mechanic\Survival\Scripts\game\survival_items.lua is where its found now
Quin97 May 9, 2021 @ 9:45am 
the item_names.json is no longer in the files, would anyone have a downloadable copy?
idioticEd Mar 7, 2021 @ 4:56pm 
custom npcs guide next?
MrYeast Oct 3, 2020 @ 11:24am 
sorry. although i do agree glow is very tedious to get.
Bread_709 Sep 1, 2020 @ 4:36am 
how about wedges?
Czechoslovakia The Pencil King Aug 12, 2020 @ 9:10am 
Faina I

You've Written Some Code Wrong.
faina Jul 4, 2020 @ 4:29am 
when i try to play with new recipies the craftbot menu is not there and its just yellow
[IN-S] Cyllin  [author] Jun 28, 2020 @ 12:08pm 
Hi cacroachhead. They recently changed that. This guide was written before batteries could be crafted and before the electric engine overhaul. I still think the price for batteries is ridiculous, especially requiring glow which is just a pain in the ass to collect. :)
MrYeast Jun 28, 2020 @ 7:49am 
and batteries arent consumed that fast by electric engines