Console/Commands

From Don't Starve Wiki
Jump to navigation Jump to search
Hound.png Attention: This page is for console commands from the Base Game (along with its dlcs). If you are trying to use console commands for Don't Starve Together then please use this Page.

.

The Command Console is enabled by default. If for whatever reason it is not, you first need to do some tweaking in your settings.ini of your save. This can be found in the "donotstarve" folder, located in the following paths :

Windows: %userprofile%\Documents\Klei\DoNotstarve\settings.ini
Mac:     <Documents>\Klei\DoNotstarve\settings.ini

Linux:         ~/.klei/DoNotStarve/settings.ini

Locate the settings.ini and open it with Notepad and where it says [MISC]ENABLECONSOLE = false and rewrite it as [MISC]ENABLECONSOLE = true then save the document.

Then to open the console while in game by pressing "~" by default on English keyboards. This can be changed at any time in the controls menu. Also you can hide the console menu again by pressing Ctrl + L.

You will need to run this command once to enable console commands:

RunS​cript("consolecommands")

Note: Like many other command-line interfaced programs, the user can press the upper arrow key to get access to previously entered commands, with no need to re-type them manually again. However, the player will still have to re-enter every command after re-entering a world.

Simple commands

  • Spawn prefab
c_spawn("prefab", amount)

Improved DebugSpawn("prefab"), spawns amount of selected "prefab" under the mouse cursor.

  • Give Item
c_give("prefab", amount)

Spawns amount of selected "prefab" in your inventory. Only works with Backpacks and Items that can be stored in the inventory.

  • Scenario (Not tested)
c_doscenario(scenario)

Apply a scenario script to the selection and run it.

  • Health
c_sethea​lth(percent)

Sets your health to selected percentage. Note: Use fractional numbers 0.90 = 90%.

  • Sanity
c_setsanit​y(percent)

Sets your sanity to selected percentage. Note: Use fractional numbers 0.90 = 90%.

  • Hunger
c_sethunger(pe​rcent)

Sets your hunger to selected percentage. Note: Use fractional numbers 0.90 = 90%.

  • God Mode
c_godmode()
c_supergodmode()

It won't drain SanityHunger or Health when attacked anymore. Note that you will need to turn it off and on again after passing through a Worm Hole, sleeping, Telepoofing, entering or exiting a cave system, eating mandrakes, dying/respawning, or using complicated commands too many times. (In the Hamlet DLC, entering/exiting interiors will not break it, but being transported by the BFB will.)

  • Save the game
c_save()
  • Rollback
c_reset()

Rollback to the last save / reloads frontend.

  • Reload
c_reload()
  • Regenerate world
c_regeneratecurrentworld()
c_regenerateallworlds()

Regenerates current or all worlds in the saveslot.

  • Regenerate cave
c_regeneratecave()

Hover the cave entrance to Regenerate cave.

  • Set running speed
c_speed(value)

Standard runspeed is 1. 10 makes the player a bit faster and with 40 they can walk through walls and "over" water.

  • Set running speed (Don't Starve Together)
c_speedmult(multiplier)

Does the same before but for Don't Starve Together.

There's some other commands, but they're hard to use and not very useful.

Player commands

  • Hide and show HUD
GetPlayer().HUD:Hide()
GetPlayer().HUD:Show()

Hide or show (after hiding) the full HUD of the game.


  • Creative mode
c_freecrafting()
GetPlayer().components.builder:GiveAllRecipes()

You can craft everything for free. This includes items you never crafted before. After switching levels, you will need to re-enter the command.


  • Maximum health
GetPlayer().components.health:SetMaxHealth(value)

Change the Maximum Health of your Characters


  • Maximum sanity
GetPlayer().components.sanity:SetMax(value)

Change the Maximum Sanity of your Characters


  • Maximum hunger
GetPlayer().components.hunger:SetMax(value)

Change the Maximum Hunger of your Characters


  • Pause hunger
GetPlayer().components.hunger:Pause(true)

Your Characters won't starve anymore.


  • Werebeaver
GetPlayer().components.beaverness:SetPercent(1)

Turn Woodie into the Werebeaver.

World commands

  • Teleport to Prefab
c_gonext("prefab")
c_warp("prefab")

After pressing enter, it teleports you to the first numerical instance of the named prefab. If multiple iterations of the prefab exist, a list of the entity numbers will be displayed in the console log, and each subsequent execution of the same command will transport the player from entity to entity in the order they were generated in the world.

  • Delete Entity Under Mouse
TheInput:GetWorldEntityUnderMouse():Remove()

After pressing enter, it deletes the item under your mouse

  • Remove all of one prefab
c_removeall("prefab")
  • Count prefabs
c_countprefabs("prefab")
  • Count all prefabs
c_countallprefabs("prefab")
  • Reveal Map
GetWorld().minimap.MiniMap:ShowArea(0,0,0,10000)


c_revealmap() 

Note: the map will return to normal after exiting the game or changing maps, but any new areas will remain explored.

  • Skip day
​GetClock():MakeNextDay()


  • Reset the clock back to day 1
GetClock():Reset()

Skips the current day.

  • Skip more days
 c_skipdays(x)

Skips x days.

WARNING: Too big values may freeze the game. (Depending on computer speed)

  • Skip time units and update
LongUpdate(X)

Skips X time units and performs the "LongUpdate" function on world objects

Note: There are 30 time units per segment. To skip a whole day one can either use LongUpdate(480) or use multiplicative values such as LongUpdate(X*16*30) or LongUpdate(X*TUNING.TOTAL_DAY_TIME), with X=days to skip.


  • Set segments

Usage:

​GetClock():SetSegs(day,dusk,night)

Sets amount of segments. Errors if adds up to over 16. Example:

​GetClock():SetSegs(14,1,1)

Very long day, very short dusk and night (one segment for dusk and one for night)


  • Skip phase
GetClock():NextPhase()

Skips the current phase.

  • Start Summer
GetSeasonManager():StartSummer()

Start summer

  • Start Winter
GetSeasonManager():StartWinter()

Start winter

  • Start Autumn Reign of Giants icon.png
GetSeasonManager():StartAutumn()

Start autumn

  • Start Spring Reign of Giants icon.png
GetSeasonManager():StartSpring()

Start spring

  • Start Mild Season Shipwrecked icon.png
GetSeasonManager():StartMild()

Start mild season

  • Start Hurricane Season Shipwrecked icon.png
GetSeasonManager():StartWet()

Start hurricane season

  • Start Monsoon Season Shipwrecked icon.png
GetSeasonManager():StartGreen()

Start monsoon season

  • Start Dry Season Shipwrecked icon.png
GetSeasonManager():StartDry()

Start dry season

  • Start Temperate Season Hamlet icon.png
GetSeasonManager():StartTemperate()

Start Temperate season

  • Start Humid Season Hamlet icon.png
GetSeasonManager():StartHumid()

Start Humid season

  • Start Lush Season Hamlet icon.png
GetSeasonManager():StartLush()

Start Lush season

  • Start Aporkalypse Hamlet icon.png
GetSeasonManager():StartAporkalypse()
GetAporkalypse():BeginAporkalypse()

Start Aporkalypse

  • Stop Aporkalypse Hamlet icon.png
GetAporkalypse():EndAporkalypse()

Stop Aporkalypse

  • Start Pig Fiesta Hamlet icon.png
GetAporkalypse():BeginFiesta()

Start Pig Fiesta

  • Stop Pig Fiesta Hamlet icon.png
GetAporkalypse():EndFiesta()

Stop Pig Fiesta

  • Start Rain
GetSeasonManager():StartPrecip()

Start rain

  • Stop Rain
GetSeasonManager():StopPrecip()

Stop rain

  • Do Lightning Strike
GetSeasonManager():DoLightningStrike(Vector3(GetPlayer().Transform:GetWorldPosition()))

Lightning strike on player. Will hit lightning rod instead if there is one near

  • Do Volcano Eruption Shipwrecked icon.png
GetVolcanoManager():StartEruption(smokeduration,ashduration,firerainduration,firerockspersecond)

Do a volcano eruption. Note that the fire rain duration is measured in seconds.

  • Measure Distance
print(math.sqrt(GetPlayer():GetDistanceSqToInst(TheInput:GetWorldEntityUnderMouse())))

Prints the distance between player and object under mouse to the console log (displayed with Ctrl + L by default).

Profile Commands

While profile commands are permanent and do not need to be done each time, they do need to be performed while in a game.  You can unlock multiple characters at a time without requiring the line including the save until the very last step.

  • Change Character
c_swapcharacter(character)

Changes the current Character to the one entered in the command (prefab name, i.e. for Maxwell it's waxwell). It's required to save and quit the game for the change to take effect.

Profile:UnlockCharacter("willow")
Profile:Save()

Unlocks Willow.  Does not need to be re-entered after the first time unless you lose your profile settings.

Profile:UnlockCharacter("wolfgang")
Profile:Save()

Unlocks Wolfgang.  Does not need to be re-entered after the first time unless you lose your profile settings.

Profile:UnlockCharacter("wendy")
Profile:Save()

Unlocks Wendy.  Does not need to be re-entered after the first time unless you lose your profile settings.

Profile:UnlockCharacter("wx78")
Profile:Save()

Unlocks WX-78.  Does not need to be re-entered after the first time unless you lose your profile settings.

Profile:UnlockCharacter("wickerbottom")
Profile:Save()

Unlocks Wickerbottom.  Does not need to be re-entered after the first time unless you lose your profile settings.

Profile:UnlockCharacter("woodie")
Profile:Save()

Unlocks Woodie.  Does not need to be re-entered after the first time unless you lose your profile settings.

Profile:UnlockCharacter("wes")
Profile:Save()

Unlocks Wes.  Does not need to be re-entered after the first time unless you lose your profile settings.

Profile:UnlockCharacter("waxwell")
Profile:Save()

Unlocks Maxwell.  Does not need to be re-entered after the first time unless you lose your profile settings.

Profile:UnlockCharacter("wagstaff")
Profile:Save()

Unlocks Wagstaff.  Does not need to be re-entered after the first time unless you lose your profile settings. Additionally, does not need to be used unless manually locked, as Wagstaff is automatically unlocked.

Profile:UnlockCharacter("wathgrithr")
Profile:Save()

Unlocks Wigfrid.  Does not need to be re-entered after the first time unless you lose your profile settings.

Profile:UnlockCharacter("webber")
Profile:Save()

Unlocks Webber.  Does not need to be re-entered after the first time unless you lose your profile settings.

Profile:UnlockCharacter("walani")
Profile:Save()

Unlocks Walani.  Does not need to be re-entered after the first time unless you lose your profile settings.

Profile:UnlockCharacter("warly")
Profile:Save()

Unlocks Warly.  Does not need to be re-entered after the first time unless you lose your profile settings.

Profile:UnlockCharacter("wilbur")
Profile:Save()

Unlocks Wilbur.  Does not need to be re-entered after the first time unless you lose your profile settings.

Profile:UnlockCharacter("woodlegs")
Profile:Save()

Unlocks Woodlegs.  Does not need to be re-entered after the first time unless you lose your profile settings.

Profile:UnlockCharacter("warbucks")
Profile:Save()

Unlocks Warbucks.  Does not need to be re-entered after the first time unless you lose your profile settings; however, he will need to be removed from the retired character list every time you want to make a new world with him.

Profile:UnlockCharacter("wilba")
Profile:Save()

Unlocks Wilba.  Does not need to be re-entered after the first time unless you lose your profile settings.

Profile:UnlockCharacter("wormwood")
Profile:Save()

Unlocks Wormwood.  Does not need to be re-entered after the first time unless you lose your profile settings. Additionally, does not need to be used unless manually locked, as Wormwood is automatically unlocked with the Hamlet DLC installed.

Profile:UnlockCharacter("wheeler")
Profile:Save()

Unlocks Wheeler.  Does not need to be re-entered after the first time unless you lose your profile settings.

  • Unlock Everything (Currently all characters)
Profile:UnlockEverything()

Miscellaneous Commands

  • Clear the morgue
ErasePersistentString("morgue")

Clears the morgue. Requires closing and reopening the game for changes to be seen.

  • Re-lock any unlockable character
Profile.persistdata.unlocked_characters["character"] = false
Profile:Save()

Re-locks any unlockable character that was entered in the command (prefab name, i.e. for Maxwell it's waxwell). Cannot lock Wilson, but will lock Wagstaff and Wormwood. Replacing "false" with "true" will unlock characters, however the above section provides a simpler command.

  • Re-lock all unlockable characters
ErasePersistentString("profile")

Re-locks all unlockable players, such as Willow, Wes, Webber, Walani, etc. Requires closing and reopening the game for changes to be seen.

  • Empty retired character list
RETIRED_CHARACTERLIST = {}

Unless the list has already been edited, this will only make Warbucks available; if the list has been edited, then the characters in the retired character list will become available again. Note that when the game is closed, all edits to the retired character list will be lost, and the command must be used again to repeat the prior results.

  • Edit the retired character list
RETIRED_CHARACTERLIST = {"willow"}

This will remove Willow from the character selection, and due to not being listed will make Warbucks available. This command cannot be used to hide Wilson, but can hide Wagstaff and Wormwood. Note that when the game is closed, all edits to the retired character list will be lost, and the command must be used again to repeat the prior results.

RETIRED_CHARACTERLIST = {"willow", "warbucks"}

This will remove Willow from the character selection, while leaving Warbucks still hidden. This can also be used for other pairs, triples, etc. of characters, regardless of whether Warbucks is included or not. This command cannot be used to hide Wilson, but can hide Wagstaff and Wormwood. Note that when the game is closed, all edits to the retired character list will be lost, and the command must be used again to repeat the prior results.