Scrap Mechanic

Scrap Mechanic

34 个评价
How to enable and use dev commands
由 RcCookie 制作
This guide will explain to you how to activate dev commands and what you can do with them
2
   
奖励
收藏
已收藏
取消收藏
Introduction
In the following I will explain to you, how to enable dev commands for any survival game. It works for any savegame, no matter if it's a new game ore one that already exists. Dev commands allow you a handful of cool things like using creative inventory, enabling god mode or disabling day/night cycle. Have fun!
Find the file
Enabling dev commands works by editing the source code of your game. Make a backup of your savegames if you think you need it, I will not be responsive for any problems with them. However, any changes to the source code will be removed whenever you update the game, and I did not have any issues with this either.

The file you need to edit is called "SurvivalGame.lua". Lua is the coding language SM is programmed in, but you can open this file with any text editor.
The file is located in the game files, wich you can access by going to your steam library, right clicking onto Scrap Mechanic and selecting "Browse local files". Alternativly, you can open the folder straight through the explorer. It is usually located at "C:/programs/Steam/steamapps/common/Scrap Mechanic".
Once you are in the SM-folder, go to "Survival/Scripts/game". Here you will find the file. Like I said, you can open it with any text editor.
Editing the file
To enable dev comments comment out the lines 55 and 59 (the "if" and "end" lines). To do so, prepend "-- " to the lines, for example "-- if ...". That's all, it simply removes any requirements and always enables dev mode.
If you are like me and wrong formatting bothers you, you may also un-indent the lines in between, but that's optional and does not at all affect the result.
How to use dev commands ingame
To use dev commands in your game, you first need to open a world (who expected). Rememper that these commands only work in a survival game, they won't help you to get the gatling gun in creative.

Once your in the game open the chat by pressing enter. The structure of a command is generally like this:

"/[commandName] [additionalInput] [moreAdditionalInput]"

ALWAYS type / at the beginning of the command or it yon't be evaluated as one. Also, don't use any spaces after the slash (I didn't check if you can but just don't) and exactly one between additional input. Additional input is usually a number to specify something but sometimes not needed/allowed.

For your first command you can open the chat and type "/god". This will make you invincible and stop hunger and thurst draining. If there is no "answer" to youir command you know you made somthing wrong.
Helpful commands
Here is a list of the most useful commands and what they do:

/god
Enables invincibility

/spudgun, /shotgun, /gatling
Gives you the desired spudgun

/unlimited, /limited
Enables or disables creative inventory

/decrypt, /encrypt
Decrypting allowes you to destroy any part you want, also inside of a warehouse. It also enables the drawing of all the connections when using the connection tool. Encrypting sets this stuff back to the default standings.

/timeofday + number between 0 and 1
Example: "/timeofday 0.5" --> noon
Sets the time of day to the given fraction of the day. 0 is midnight, 0.5 is noon and 1 midnight again.

/timeprogress + true of false
Example: "/timeprogress false" --> time progress will stop
Enables or disables the day/night cycle and stops/starts the clock

/goto + name
Example: "/goto hideout" --> spawns you between the trader and a packing station
/Teleports you to a location on the map. You can add your own locations by editing the SurvivalGame.lua file from line 402 on. By default, there are only 3 locations:
here: does nothing
start: teleports you to start
hideout: teleports you (close) to the trader

/spawn + name + number
Example: "/spawn woc 5" --> spawnes 5 wocs in front of the player
Using this command you can spawn "nature" at the point that you look at. Available commands:
woc
tapebot or tb
redtapebot or rtb
totebot or green or t
haybot or h
worm
farmbot or f

/die
Kills the player (if god mode is disabled)

/import + name
Example: "/import Car" --> imports my custom blueprint
Allowes you to import any blueprint from the folder "Scrap Mechanic/Survival/Local Blueprints". To add a creation from creative mode, go to "AppData/Roaming/Axelot Games/User/User_[your ID]/Blueprints". The best way to find your creation is to sort by date and pick the latest one. Open that folder. You can check weather you got the right blueprint by opening the icon file.
Copy the blueprint.json file and paste it into the Local Blueprints folder. Edit the name, give it an easy to remember name and the ending (suffix) ".BLUEPRINT".
Example: "Car.BLUEPRINT"
Press enter. If windows shows a message that you might destroy the file press continue.
Back in the game you can now import the blueprint like shown in the example above.

NOTE: The creation will fly at first. To apply physics to the creation you need to place a block on each welded segment (and remove it again if you don't want a block on there). I cannot recomment things like trophy trucks or similar with a lot of bearings because it just takes much to long. Trust me.

SECOND NOTE: You CAN import creations with mod parts, and they will work fine, but only if you have the mods enabled. In my other guide I explain how to do so. You find the link in the next chapter.
Disabling Dev Commands
If at any point you decide you don't want dev mode anymore, you can simply open the survivalgame.lua file again and uncomment the two lines. (Thanks to @Beef_Technology for the idea!)
Last words
Thanks for reading all the way until down here! I hope I have helped you despite my bad english:-). Like already mentioned I have also made a guide showing how to enable mods in any survival savegame: https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=2113468671
Have fun!

RcCookie
48 条留言
scoober 2024 年 7 月 18 日 下午 5:30 
in survivalgame.lua at the bottom add g_survivalDev = true and that should work
GENERAL 2023 年 2 月 17 日 下午 5:45 
i dont see survival.game.iua
Mimi 2022 年 6 月 30 日 上午 4:40 
Hi all.
Here is the solution:
Still in the same file, go to line 188 and replace the line "if addCheats then" by "if true then".
Good game.
Beef_Technology 2022 年 6 月 8 日 上午 5:28 
Maybe it changed with the latest patch
RcCookie  [作者] 2022 年 6 月 8 日 上午 3:12 
Both fixed. However, it's lines 55 and 59
Beef_Technology 2022 年 6 月 6 日 下午 4:50 
@RcCookie with the new update the lines 45 and 51 need to be commented out. You should update this guide.
Beef_Technology 2022 年 5 月 14 日 上午 4:16 
sorry if the comment in which I said you can comment lines out was written 3 times, there was an error that sent 3 instead of only one.
Beef_Technology 2022 年 5 月 14 日 上午 4:14 
@RcCookie you misspelled my name in the Disabling dev commands paragraph.
RcCookie  [作者] 2022 年 5 月 14 日 上午 2:58 
@Beef_Technology The commenting out is a great idea! I've adjusted the guide
Beef_Technology 2022 年 5 月 13 日 下午 2:59 
此留言正在等待我们的自动内容检查系统分析。在我们证实其内容无害之前(例如试图窃取信息的钓鱼站点链接),留言将暂时隐藏。