Don't Starve Together

Don't Starve Together Console Commands for Players and Servers

Don't Starve Together·March 4, 2024·33 min read

Console commands in Don't Starve Together can fix problems, test builds, manage servers, or skip a grind when The Constant is being especially rude. Use them carefully, especially on multiplayer worlds where admin access and server context matter.

Using Console Commands in Don't Starve Together

The console is enabled by default. Press the tilde key (~) to open it in game. Some commands may fail in online multiplayer unless you are the server administrator.

If the console will not open, find the `settings.ini` file inside the system's `DoNotStarveTogether` folder. Look for `console_enabled` and set it to `true` if it is currently `false`. Exit the game before saving the file, or the change may not apply. Avoid changing unrelated settings unless you know what they do, because a broken config can make the game misbehave badly enough to require a clean reinstall.

Console Command Notes

Many commands use placeholders such as `prefab`, `amount`, `number`, or `value`. Replace those placeholders with the target item, player index, or numeric setting before running the command. For example, prefab commands need the internal prefab name rather than a display name. Player commands that use `AllPlayers[number]` work best after printing the player list first, since the number is what identifies the target.

Commands can also behave differently depending on whether they are run locally, remotely, or from a dedicated server console. The source commands below call out those cases where they matter. If a command affects every player, deletes entities, regenerates a world, or changes server access, treat it as an admin tool rather than a convenience shortcut. A typo in a spawn command is annoying. A typo in a rollback or despawn command is how a quiet evening becomes paperwork.

Before testing risky world commands, force a save or use a nonessential world. Several commands can crash the game, freeze the simulation, erase inventory, or remove objects permanently. The safest approach is to test one command at a time, confirm the result, and avoid stacking unrelated changes in the same session.

General Commands

  • Spawn prefab: `c_spawn("prefab",amount)` spawns a mob, item, blueprint, or other prefab under the mouse cursor.
  • Give item: `c_give("prefab",amount)` places the prefab in the player's inventory. It only works with items that can appear in a backpack.
  • Go adventuring: `c_goadventuring()` gives the player a starting item set.
  • Scenario: `c_doscenario(scenario)` applies and runs a scenario on the selected element.
  • Set Health: `c_sethealth(percent)` sets Health to a decimal percentage.
  • Set Sanity: `c_setsanity(percent)` sets Sanity to a decimal percentage.
  • Set Hunger: `c_sethunger(percent)` sets Hunger to a decimal percentage.
  • Set Moisture: `c_setmoisture(percent)` sets Wetness to a decimal percentage.
  • Set Temperature: `c_settemperature(degrees)` sets the player's temperature.
  • God Mode: `c_godmode()` prevents Sanity, Hunger, and Health loss from attacks, revives the player on death, and toggles off when entered again. Stats cannot be changed while it is active.
  • Super God Mode: `c_supergodmode()` enables god mode and fills all stats to maximum.
  • Maintain Health: `c_maintainhealth(ThePlayer)` keeps Health regenerating. Use `c_cancelmaintasks(ThePlayer)` to stop it.
  • Maintain Sanity: `c_maintainsanity(ThePlayer)` keeps Sanity regenerating. Use `c_cancelmaintasks(ThePlayer)` to stop it.
  • Maintain Hunger: `c_maintainhunger(ThePlayer)` keeps Hunger regenerating. Use `c_cancelmaintasks(ThePlayer)` to stop it.
  • Maintain Temperature: `c_maintaintemperature(ThePlayer)` keeps Temperature regenerating. Use `c_cancelmaintasks(ThePlayer)` to stop it.
  • Maintain Moisture: `c_maintainmoisture(ThePlayer)` keeps Moisture regenerating. Use `c_cancelmaintasks(ThePlayer)` to stop it.
  • Maintain All: `c_maintainall(ThePlayer)` keeps all stats regenerating. Use `c_cancelmaintasks(ThePlayer)` to stop it.
  • Mob Invisibility: `c_makeinvisible()` makes hostile mobs ignore the player, though it may not always work.
  • Running Speed: `c_speedmult(multiplier)` changes movement speed. The default is 1, 2 is double speed, and the maximum is 12.

Player Commands

  • Action Prediction: `ThePlayer:EnableMovementPrediction(enable)` toggles movement prediction. Disabling it may trade rubberbanding for choppy movement, which can help in some combat situations.
  • Creative Mode: `c_freecrafting()` allows free crafting. Enter it again to turn the effect off.
  • Give All Recipes: `GetPlayer().components.builder:GiveAllRecipes()` unlocks every crafting recipe for the player.
  • Maximum Health: `ThePlayer.components.health:SetMaxHealth(value)` changes the player's maximum Health.
  • Maximum Sanity: `ThePlayer.components.sanity:SetMax(value)` changes the player's maximum Sanity.
  • Maximum Hunger: `ThePlayer.components.hunger:SetMax(value)` changes the player's maximum Hunger.
  • Pause Hunger: `ThePlayer.components.hunger:Pause(true)` prevents starvation.
  • Damage Multiplier: `ThePlayer.components.combat.damagemultiplier=(value)` changes player damage output.
  • Werebeaver Transformation: `c_setbeaverness(percentage)` turns Woodie into the Werebeaver at 1 and returns him to normal at 0.
  • List Players: `c_listallplayers()` prints the players on the server. It may not work every time.
  • Get Player: `AllPlayers[number]` targets a specific player after you identify their number with `c_listallplayers()`.
  • Command All Players: `for k,v in pairs(AllPlayers) do command end` applies another command to every player. For example, `for k,v in pairs (AllPlayers) do c_move(v) end` moves all players to the mouse position.
  • Teleport Player to You: `c_move(AllPlayers[number])` moves that player to the mouse position.
  • Kill Player: `AllPlayers[number]:PushEvent('death')` kills the selected player.
  • Resurrect Player: `AllPlayers[number]:PushEvent('respawnfromghost')` revives the selected player.
  • Give Creative Mode to Player: `AllPlayers[number].components.builder:GiveAllRecipes()` grants all recipes to that player.
  • Teleport to Player: `c_goto(AllPlayers[number])` moves you to the selected player.
  • Drop Player Inventory: `AllPlayers[number].components.inventory:DropEverything()` drops everything in that player's inventory.
  • Despawn Player Character: `c_despawn(AllPlayers[number])` sends another player back to character selection. This deletes that player's inventory, so use it like a loaded crossbow.

Global Commands

  • Teleport to Prefab: `c_gonext("prefab")` teleports the player to the nearest matching prefab.
  • Delete Item Under Mouse: `ConsoleWorldEntityUnderMouse():Remove()` or `c_select():Remove()` removes the element under the cursor. Use the second command on dedicated servers.
  • Delete All of a Prefab: `for k,v in pairs(Ents) do if v.prefab == "prefab" then v:Remove() end end` removes every matching prefab globally.
  • Reveal Map for Self: Use `minimap = TheSim:FindFirstEntityWithTag("mini­map")`, `TheWorld.minimap.MiniMap:ShowArea (0,0,0,10000)`, and the reveal loop `for x=-1600,1600,35 do for y=-1600,1600,35 do ThePlayer.player_classified.MapExplorer:RevealArea(x,0,y) end end` to reveal the map locally.
  • Reveal Map for All Players: `for k,v in pairs(AllPlayers) do for x=-1600,1600,35 do for y=-1600,1600,35 do v.player_classified.MapExplorer:RevealArea(x,0,y) end end end` reveals the map for everyone from remote execution.
  • Skip Time Units: `LongUpdate(X)` skips X time units and runs the LongUpdate function on world objects.
  • Speed Up Simulation: `c_speedup()` accelerates time in the current world and may trigger events.
  • Set Simulation Time: `TheSim:SetTimeScale(X)` changes simulation speed. Setting X to 0 pauses the game and disables the console, preventing normal resumption.
  • Skip Time: `TheWorld.net.components.clock:OnUpdate(1630x)` skips the number of days set by x. Large values may freeze the game.
  • Skip Days: `c_skip(num)` skips the specified number of days.
  • Next Day Cycle: `TheWorld:PushEvent("ms_nextcycle")` advances to the next world cycle day.
  • Next Phase: `TheWorld:PushEvent("ms_nextphase")` skips the current day-cycle phase.
  • Set Phase: `TheWorld:PushEvent("ms_setphase",PHASE NAME)` changes the phase to `day`, `dusk`, or `night`.
  • Set Segments: `TheWorld:PushEvent("ms_setclocksegs", {day=x,dusk=y,night=z})` changes day, dusk, and night segments. The total cannot exceed 16 and resets the next day. For example, `{day=14,dusk=1,night=1}` makes a very long day.
  • Next Nightmare Cycle: `TheWorld:PushEvent("ms_nextnightmarecycle")` skips to the next Nightmare Cycle.
  • Next Nightmare Phase: `TheWorld:PushEvent("ms_nextnightmarephase")` skips the current Nightmare Cycle phase.
  • Set Nightmare Phase: `TheWorld:PushEvent("ms_setnightmarephase",PHASE NAME)` changes it to `calm`, `warn`, `wild`, or `dawn`.
  • Set Nightmare Segments: `TheWorld:PushEvent("ms_setnightmaresegs", {calm=A,warn=B,wild=C,dawn=D})` sets Nightmare segments and does not reset next cycle. The default is `{calm=12,warn=3,wild=5,dawn=2}`.
  • Lock Nightmare Phase: `TheWorld:PushEvent("ms_locknightmarephase",PHASE NAME)` locks the phase to `calm`, `warn`, `wild`, or `dawn`.
  • Unlock Nightmare Phase: `TheWorld:PushEvent("ms_locknightmarephase")` stops the lock.
  • Set Season Segments: `TheWorld:PushEvent("ms_setseasonclocksegs", {summer={day=sx,dusk=sy,night=sz}, winter={day=wx,dusk=wy,night=wz}})` permanently sets seasonal segments. Segment totals above 16 cause errors.
  • Set Season Length: `TheWorld:PushEvent("ms_setseasonlength", {season="summer", length=15})` changes season length.
  • Start Season: `TheWorld:PushEvent("ms_setseason", "{season}")` starts `winter`, `spring`, `summer`, or `autumn`.
  • Start Rain: `TheWorld:PushEvent("ms_forceprecipitation")` starts rain.
  • Stop Rain: `TheWorld:PushEvent("ms_forceprecipitation", false)` stops rain, including Frog Rain.
  • Lightning Strike: `TheWorld:PushEvent("ms_sendlightningstrike", ConsoleWorldPosition())` strikes the cursor position, unless a nearby lightning rod redirects it.
  • Meteor Strike: `c_spawn("shadowmeteor", 1)` calls a meteor at the cursor position. It may crash the game.
  • Activate Events: `for k, v in pairs(SPECIAL_EVENTS) do if v ~= SPECIAL_EVENTS.NONE then local tech = TECH[k] if tech ~= nil then tech.SCIENCE = 0 end end end function IsSpecialEventActive(event) return true end` activates all events at once, unless world-generation events are set to Auto.
  • Measure Distance: `print(math.sqrt(ThePlayer:GetDistanceSqToInst(ConsoleWorldEntityUnderMouse())))` prints the distance to the object under the cursor in the console log, viewed with Ctrl + L by default.

Common Command Patterns

Several commands in this list are variations on the same idea. `c_spawn` creates something in the world, while `c_give` tries to place an item directly into the player's inventory. `c_gonext` searches for the closest matching prefab and moves the player there, while `c_find` locates an existing item for follow-up commands such as teleporting it.

Player commands usually target `ThePlayer` for the person running the command or `AllPlayers[number]` for a specific person on the server. World commands usually target `TheWorld`, `TheSim`, or entities under the mouse cursor. Knowing which object a command affects is the difference between adjusting your own character and accidentally involving everyone else.

When commands mention a decimal percentage, use values such as 1 for full, 0.5 for half, and 0 for empty. When a command asks for a phase name or season, use the exact names listed with the command. Small formatting differences can prevent the command from working.

Network and Server Commands

  • Kick or Ban: `TheNet:Kick(userid)` or `TheNet:Ban(userid)` removes or bans a player.
  • Temporary Ban: `TheNet:BanForTime(userid,time_in_seconds)` bans a player for a set duration.
  • Connect to Server: `c_connect("IP address", port, "password")` connects to a server by IP, port, and password.
  • Reload World: `c_reset()` reloads without saving and may crash the game if used as a client.
  • Regenerate World: `c_regenerateworld()` regenerates items in a world.
  • Regenerate Shard: `c_regenerateshard()` regenerates items in a shard.
  • Save Server: `c_save()` forces an autosave.
  • Shut Down Server: `c_shutdown( true / false)` saves when true and exits without saving when false.
  • Roll Back Server: `c_rollback(count)` rolls the server back by the specified number of saves.
  • Allow New Connections: `TheNet:SetAllowIncomingConnections( true / false )` allows joins when true and blocks new joins when false.
  • Server Announcement: `c_announce("announcement")` posts an announcement from the dedicated server console, useful before shutdowns or restarts.
  • Stop Vote: `c_stopvote()` stops the active vote.

Skill Tree Commands

  • Max Inspiration Points: `TheSkillTree:AddSkillXP(10000, "{character name}")` gives a character the maximum Inspiration points possible.
  • Ancient Fuelweaver Status: `TheGenericKV:SetKV("fuelweaver_killed", "1")` marks the current character as having killed Ancient Fuelweaver.
  • Celestial Champion Status: `TheGenericKV:SetKV("celestialchampion_killed", "1")` marks the current character as having killed Celestial Champion.

Miscellaneous Commands

  • Change Length, Width, and Height: `c_select().Transform:SetScale(x, y, z)` changes a mob or player's visible dimensions. Other players will not see the effect.
  • Clear Morgue: `ErasePersistentString("morgue")` clears the morgue after closing and reopening the game.
  • Count Prefab and Say It: `ThePlayer.components.talker:Say(tostring(c_countprefabs("prefab")))` returns the total count as character speech when used remotely.
  • Count Prefab: `c_countprefabs("prefab")` counts prefabs in the active local area when local, or in the world when remote. Dedicated-server results print to the server console.
  • Spawn Wormholes: `worm1 = c_spawn("wormhole")` then `worm2 = c_spawn("wormhole")` creates Wormholes or Cave Entrances at the cursor.
  • Connect Wormholes: `worm1.components.teleporter.targetTeleporter = worm2` and `worm2.components.teleporter.targetTeleporter = worm1` links both ends.
  • Spawn Domesticated Beefalo: `function spawn_beef(tendency) local beef = c_spawn("beefalo"); beef.components.hunger:DoDelta(400); beef.components.domesticatable:DeltaTendency(tendency, 1); beef:SetTendency(); beef.components.domesticatable.domestication = 1; beef.components.domesticatable:BecomeDomesticated(); end` spawns a tamed Beefalo nearby.
  • Teleport Item to Player: `c_find("item").Transform:SetPosition(AllPlayers[1]:GetPosition():Get())` moves the nearest matching item to the player.
  • Change Player Size: `ThePlayer.Transform:SetScale(number,number,number)` changes player size.
  • Change Prefab Size: `c_select().Transform:SetScale(number,number,number)` changes the selected prefab's size.
  • Change Player Color or Transparency: `c_select().Transform:SetScale(number,number,number)` changes player color or transparency.
  • Change Prefab Color or Transparency: `ThePlayer.AnimState:SetMultColour(number,number,number,number)` changes the selected prefab's color or transparency.
  • Make Prefab Pick-Up-Able: `c_select():AddComponent("inventoryitem")` makes the selected prefab pick-up-able. It commonly crashes the game when mods are enabled.
  • Change Character Body Parts: `for k,v in pairs(Ents) do if v.AnimState and v.AnimState:GetBuild() == "character'sname" then v.AnimState:OverrideSymbol("bodypart", "enothercharacter'sname","bodypart") end end` swaps a body, face, hand, or other part. Example character names include `webber`, `Wilson`, and `wx78`.
  • Unlock Scrapbook: `TheScrapbookPartitions:DebugUnlockEverything()` unlocks every Scrapbook entry.

Use commands responsibly on dedicated servers, especially commands that affect other players or overwrite world state. If you manage a Don't Starve Together world through HolyHosting, keep admin commands limited to trusted operators and save before testing risky world changes.

Still have questions?

Come chat with us and we will get back to you as soon as possible!

Contact Support