Scrap Mechanic

Scrap Mechanic

33 ratings
How to add your own tiles to the survival mode map
By MateoElevadoAlCubo
No modding experience required. This guide will teach you how to create a custom game that will generate your own tiles in the survival mode terrain.
2
   
Award
Favorite
Favorited
Unfavorite
How to get the Scrap Mechanic Mod Tool
This section is about downloading the Mod Tool. If you already know how to do it, you can skip to the next part.

If you don't know what is the Mod Tool, here I will show you how to get it.
  1. Go to your Steam library.
  2. Click on the dropdown under "home".
  3. Select "tools".

  4. Search for "Scrap Mechanic Mod Tool".

  5. Download the Mod Tool. The library page is the same as the Scrap Mechanic one, so this might confuse someone. The only difference is the button that says "Launch" instead of "Play".
Create a Custom Game and add terrain tiles to it
  1. Launch the Mod Tool.
  2. On the top left corner, click on "File" -> "New Mod" -> "Survival Template".
    Give it a name. Now you have created a new custom game.
  3. To add new terrain tiles to this custom game, you will need to open the mod tool tile editor.
    Click on "Editors" -> "Tile".
  4. Now you can start creating your own tile.
    The Tile Editor of the Mod Tool is very similar to the Tile Editor of creative mode, but you have access to every terrain asset and node of survival. You can also create prefabs and save them (prefabs are a group of assets that you can save together to bring them to other tile).
    This is the tile that I will be using as an example in this guide:
  5. Don't forget to save it and give it a name.
    The tile will automatically save in your mod files, in the "Tiles" folder.

Where are the mod files stored?
To access the files of your custom game you have to click on "File" -> "Open folder", on the top left corner of the Mod Tool.
The full path is:
C:\Users\[your user name]\AppData\Roaming\Axolot Games\Scrap Mechanic\User\User_[numbers here]\Mods\[your mod name]

Moving creative mode tiles to your custom game
You don't need to use the tile editor of the Mod Tool to create tiles, you can just use the tile editor of creative mode. Here's how to bring your creative tiles to your custom game:
  1. Go to this path:
    C:\Users\[your user name]\AppData\Roaming\Axolot Games\Scrap Mechanic\User\User_[numbers here]\Tiles
  2. Each folder that you see there contains a tile that you created using the tile editor of creative mode. Open the folder that contains the tile that you want to bring to the custom game. You might need to check every folder looking for the tile.
  3. The folder will contain 4 files: a png preview of the tile, a file called "description.json", a file that ends with ".tile" and another file that ends with ".tile.export". Copy the png, the ".tile" and the ".tile.export" files.
  4. Go to your custom game files, open the "Terrain" folder, and paste the copied files into the "Tiles" folder.
Make the tiles appear in a survival world
This is the most important part of the guide.
If you try to play the custom game that you have just created, you will play in a completely normal survival world. This happens because custom games created using the survival template use the code of survival mode by default. But we want to change that.
  1. In the library page of Scrap Mechanic, click on the gear icon -> "Manage" -> "Browse local files".

    This will open the game files folder, on this path:
    C:\Program Files (x86)\Steam\steamapps\common\Scrap Mechanic
  2. Go to the "Survival" -> "Scripts" folder.
  3. Now you will need to copy all the lua files listed in the diagram below to the "Scripts" folder in your custom game.
    I reccomend keeping the same structure of files and folders in your custom game, this will make finding those files easier later.
Now is time to edit those copied files. You can open them with any text editor like Notepad. I will be using Notepad++, because it makes the files look better and more readable.
  1. Make sure you are in the "Scripts" folder of your custom game, you dont want to accidentally edit the game files.
  2. Open the file called "Game.lua". In the first line you can see a path to "SurvivalGame.lua" of survival mode. Change this path to the file that you pasted in your mod file. If you kept the same structure of folders as in the game files, you just need to change the word "SURVIVAL" to "MOD", like this:
  3. Now you need to repeat the last step but with these files. On the left you can see the line number so it is easier for you to find what you have to edit. Don't change any other path (unless you know what are you doing), just change what is highlighted.
    • In "SurvivalGame.lua":
    • In "Overworld.lua":
    • In "terrain_overworld.lua":
    • In "generate_cells":
    • In "processing.lua" you need to change lines 2 to 11.
  4. Now you have to choose If you want your custom tile to be a POI or just a random tile from a biome.
    • If you want your tile to just be a common tile from a biome, you need to open the file corresponding to the biome you choosed. For example, I want my tile to generate in fields, so I am going to open "type_field.lua".
      On the top of the file there is a comment that says: "This file is generated! Don't edit here.", this probably means that Axolot has a tool to generate those files automatically. We don't have access to that tool, so we have to edit the file manually.
      It is a bit difficult to explain what is going on in this file, so I will just give an example.
      My tile has fields on the four corners, so I go to the line that says "toFieldIndex( 1, 1, 1, 1 )" (1 means that the corresponding corner is a field, 0 means that is a meadow) and I add this to the list of tiles: AddTile( 4001508, "$MOD_DATA/Terrain/Tiles/Crashed ship Field.tile", 4 )
      Don't forget the comma.


    • POI stands for Point Of Interest, and are special tiles like the ruins, the chemical lakes, the caged farmers camps, the roadside markets, etc. They are less common than the rest of random tiles.
      Open "poi.lua". Go to the function "initPoiTiles()", in line 48. Add this line inside the function:

      addPoiTileLegacy( [type op POI], [number], "$MOD_DATA/Terrain/Tiles/[your tile name]" )


      For example, this is how I can add my tile as a POI:
      As you can see in the previous screenshot, the third parameter of "addPoiTileLegacy()" is an integer that you need to increase by one for each tile of the same type of POI. In the game there are already 3 tiles of the type "POI_FIELD_RANDOM", so I wrote a 4.
      You can also delete existing "addPoiTileLegacy()" calls to stop other POIs from generating.
  5. Now you can just open the game, in the menu to choose your gamemode click on the "custom games" button on the top right, create a new world with the custom game you created and you can start enjoying your custom tiles in the survival mode map!
Some useful tips
Enable dev commands to test the custom game
Since you are adding new tiles to the map, you might want to check if the mod is working, so you need to go around the map looking for your tiles.
Go to "SurvivalGame.lua", in your mod files. In the line 188 you can see an if statement. Change "addCheats" to "true". Now you have dev commands enabled in your custom game.
Some useful commands:
  • /god
    It makes the player invincible.
  • /unlimited
    Turns on the creative mode inventory.
  • /day
    Disables time progression and sets time to daytime.
Terrain hillyness
The survival terrain deforms the tiles to create hills and valleys. When making a tile, take into account that it probably will be deformed. If you don't want your tile to be deformed, you can place a flatten node in your tile. All of the terrain of the tile under the purple circle won't be deformed by the terrain.
Change the coordinates of fixed POIs
On the file called "generate_cells.lua", from line 100 to line 120, you can find the coordinates of the POIs that always generate in a fixed location. You can change those coordinates to make the survival world more interesting. Or you can try to add your own fixed POI.
Adding blueprints to your tile
The bueprints that you save in your lift are stored on this path:
C:\Users\[your user]\AppData\Roaming\Axolot Games\Scrap Mechanic\User\User_[numbers here]\Blueprints
Each folder that you see there contains a file called "blueprint.json", another called "description.json" and a png icon. You need to copy the "blueprint.json" file, then, go to your mod files and create a folder called "Blueprints". Paste the file there. Now you need to change the file extension from ".json" to ".blueprint".
Now open the mod tool tile editor. Your blueprint will appear in the Asset Library in the "blueprints" section.
You can change the restrictions of each individual body of your blueprint in the "Properties" section.
I don't know how to name this section.
I created this guide for the version 0.6.5. If the game updates, some things might change. I don't know if i will update this guide for future versions.
If you know how to improve this guide, tell me in the comments.
19 Comments
RedMissile 19 Dec, 2024 @ 3:18am 
I have heard of SURVIVAL_DATA, but GAME_DATA and MOD_DATA, what in the world are those?
jh 1987 houstoman 17 Dec, 2024 @ 1:41pm 
nvm i fixed it-
jh 1987 houstoman 17 Dec, 2024 @ 12:29pm 
it just gives me this error in the console :15:30:43 (621/1280) ERROR: ASSERT: '!vecEvents.empty()' : WorldManager.cpp:190
jh 1987 houstoman 17 Dec, 2024 @ 2:30am 
great guide but my game will just straight up not leave the loading stage when i try to test if it worked-
#0060FF landa09 21 Jun, 2024 @ 3:11am 
I realized what was wrong. Only Medium tiles can be added to the game. But, I figured out how to add absolutely anything, I’ll create a guide later, let’s just say it will be an addition to your guide)
#0060FF landa09 20 Jun, 2024 @ 12:47am 
I did absolutely everything as in the guide, but there is a catch: My tile just doesn’t appear
_kilgamer_ 7 Feb, 2024 @ 7:06am 
people, I need help, I need a mod that has the ability to press buttons while sitting in a chair from the first flight and not connect them to the chair, just hover over them and activate
Pixelmaker 5 Nov, 2023 @ 3:35pm 
Oh, turns out I bruteforced it acutally pretty similarly. Good guide!
sujka22 23 Oct, 2023 @ 10:24am 
Any idea on how to add POIs bigger than Small tile size? I wanted to make medium desert tile, added new medium type in celldata.lua but it doesn't work.
Bagietka_orzechowa 10 Oct, 2023 @ 10:39am 
OH BOY THANKS VERY MUCH
YOU HELP ME A LOT :steamhappy: