Developer Console
This page describes content only available in the Steam release of A Hat in Time.
Other versions may have it with limited functionality or may lack it entirely.
The Developer Console (simply known as Console) is a command-line interface that allows us to write Console Commands to change the game's state.
By default, the console is disabled and can only be enabled directly from the game by going to Settings -> Game Settings -> Scroll to System Settings and then check "Developer Console". To open the console press
for the full console, if you want a smaller one line only you can press
to write one command and it will automatically close afterwards.
Executable Functions
The console allows us to run executable functions that are defined with exec in the source code, for example exec function RestartLevel() defined in PlayerController.uc can be written into the console as restartlevel to restart the level (to the last checkpoint).
Some console commands require additional parameter(s) to run in that case each parameter needs to be separated by a space, for examples:
exec function FOV(float F)fov <F>fov 50-> camera will look zoomed in.
- [Requires cheats]
exec function SetSkinColor(String BodyPart, int R, int G, int B)setskincolor <BodyPart> <R> <G> <B>setskincolor Hair 0 250 154-> Your hair color is now Medium Spring Green.
These functions must be valid and existing in the current space, e.g. you cannot use CheatManager related executable functions without it being created first this is what the enablecheats command does in this regard, see #Enable Cheats for an example.
If you attempt to run any executable functions that don't exist in the current context it will print into the console the following error:
Command not recognized: <command>
Custom Console Commands
The simplest way to add custom console commands is through a custom Interaction subclass:
// NOTE: "within PlayerController" allows this class to use the outer PlayerController's functions, such as ClientMessage().
class Example_CustomCommands extends Interaction within PlayerController;
// type "someconsolecommand"
// result: "Hello world!"
exec function SomeConsoleCommand()
{
ClientMessage("Hello world!");
// Your code here...
}
// type "anotherconsolecommand <s>"
// example: "anotherconsolecommand hi :3" {{!}} result: "Simon says: hi :3"
exec function AnotherConsoleCommand(Coerce String s)
{
ClientMessage("Simon says:" @ s);
}
This class has to be instantiated and inserted into the PlayerController.Interactions array. For example, you can do this through the GameMod:
class Example_GameMod extends GameMod;
var Interaction CommandsInteraction;
event OnModLoaded()
{
SetTimer(0.001f, false, NameOf(RegisterCommands));
}
event OnModUnloaded()
{
UnregisterCommands();
}
function RegisterCommands()
{
local PlayerController PC;
PC = GetALocalPlayerController();
if (PC == None) return;
if (CommandsInteraction != None && PC.Interactions.Find(CommandsInteraction) != INDEX_NONE) return;
CommandsInteraction = new(PC) class'Example_CustomCommands';
PC.Interactions.InsertItem(0, CommandsInteraction);
}
function UnregisterCommands()
{
local PlayerController PC;
if (CommandsInteraction == None) return;
PC = GetALocalPlayerController();
if (PC != None)
PC.Interactions.RemoveItem(CommandsInteraction);
CommandsInteraction = None;
}
Compatible Classes
Besides Interactions, there's a few other classes that can add new console commands. Here's the full list of them:
GameViewportClientGameInfo/Hat_GamePlayerInput/Hat_PlayerInputPlayerController/Hat_PlayerControllerSpecialPawn/Hat_Player(player-controlled)InventoryManager/Hat_InventoryManagerWeapon/Hat_Weapon_UmbrellaHUD/Hat_HUDCheatManager/Hat_CheatManager(when cheats are enabled)Interaction- Those in thePlayerController.Interactionsarray. This is the easiest way for mods to add console commands, even outside of custom levels.
NOTE: Commands are prioritized from top to bottom in that list. The order in the Editor is slightly different though, as GameInfo is below HUD in playtests.
Enable Cheats
Cheats are commands that provide an advantage in game play and can only be used when cheats are enabled, to activate you need to write enablecheats into the console or by pressing
on your keyboard, doing so results in Hat_CheatManager getting initialized and all its functions valid for execution. Despite their cheaty nature they do not disable Achievements.
You cannot enable cheats while in an Online Party (and enabling cheats before entering the lobby will resulting in them getting disabled) resulting in the following message:
"Cheats cannot be enabled while Online Functionality is on."
In Death Wish enabling cheats will result in you taking 1 damage with Snatcher writing into the console mocking you for trying to circumvent the rules of the Death Wish:
"Didn't you read the fine print in your contract? No cheating!" "Trying to cheat me, eh kid?" "I write the rules, kiddo. You don't get to change them like that!" "Now where's the fun in that?"
Cheats are always enabled by default while using the Editor.
Kismet
You can run console commands directly from Kismet using the "Console Command" node, inside the node you can input a list of commands to be run by order. If you want to use commands that requires cheats prior please specify enablecheats before running them, additionally to avoid bugs do not run these commands when the level is loaded through the "Level Loaded" event node but instead by using the "Player Spawned" event node.
List of Commands
These can be used at any time without requiring prior commands to get them enabled. Some commands are marked "With caution" or "Dangerous" depending on their severity, please read carefully before using them.
Clicking on any command will make a direct link to the command.
| Command | Description |
|---|---|
bind <key> <command> |
With caution. Bind a keyboard key to a specific console command, see this list for the proper naming conventions especially for None-Alphabetic buttons. Binds are saved in the game's installation directory under HatinTime\HatinTimeGame\Config\HatinTimeInput.ini starting at the bottom of the file, to unbind you need to exit the game and edit the file then save. You can also adjust those bindings to work with Ctrl / Shift / Alt from the file (but this also requires a game restart to take effect).
|
set <class> <variable> <value> |
Sets the <variable> of <class> to <value> of ALL objects in the world, the passed <value> must be the correct data type of <variable>. This is now considered the new DEFAULT value and will persist even after restarting the level until you close the game.
|
getall <class> <variable> |
Displays all <variable>s of all instances of <class>.
|
getallstate <class> |
Displays the states of all instances of <class>.
|
show <type> |
Toggles Editor related helper based on the passed <type>. Valid: bounds, collision, cover, decals, fog, levelcoloration, paths, postprocess, skelmeshes, terrain, volumes, splines.
|
stat <type> |
Shows debug information on screen related to <type>. Valid: fps, unit, levels and collision. ghostparty is only valid in Online Party.
|
showdebug |
Dangerous. Enables an assortment of debug related utility. This seems bugged and will cause the game to crash because it ran out of memory due to debug line drawing not being removed. You can avoid this by calling flushpersistentdebuglines every now and then to clear the lag. This command cannot be disabled until you load a new map (e.g. quit to main menu) or reload the map through any means such dying or writing suicide/restartlevel in the console.
|
flushpersistentdebuglines |
Exactly as calling FlushPersistentDebugLines(); that is found in the Actor class. Removes all instances of debug lines, good to call in case of lag from the tons of debug lines that were created.
|
open <file_name> |
Opens a valid map file named <file_name>. Example: open hub_spaceship opens the Spaceship Map.
|
exit |
Closes the game. |
disconnect |
Returns back to the Main Menu. |
togglehud |
Show/Hides the HUD, during the hide state the HUD is completely uninteractable. |
enablecheats |
Allows you to use more commands that are marked as "cheating", this command cannot be run while in Online Party and causes 1 damage while a Death Wish contract is active. This gets automatically executed when opening the Editor. Casting this command or their "cheat" commands do not disable acquiring achievements. |
fov <value> |
Sets your camera's field of view to <value>, <value> is clamped between 1 and 170 anything higher or lower will reset the field of view to the default. Default is 90.
|
say <message> |
Write into the console "[Steam Name]: <message>", this has no interaction in Online features.
|
restartlevel |
Restart the level to the last checkpoint without saving. This can be used to circumvent mechanics that occur on death such as 3x |
pause |
Opens the Pause menu. |
startfire 0 |
Similar to firing left click causing an attack. |
suicide |
Commit suicide by calling Died() on the player who called this with the received damage type as DmgType_Suicided.
|
jump |
Causes the player to jump. |
remoteevent [event=""]re [event=""] |
Triggers a remote event that is defined in the map's Kismet, if these commands were called while keeping <event> empty, they will instead print all possible remote event that can be called into the console.
|
invertmouse |
With caution. Invert the vertical movement of the camera and save changes. Call it again to revert the change. |
invertturn |
With caution. Invert the horizontal movement of the camera and save changes. Call it again to revert the change. |
setsensitivity |
Set your mouse sensitivity. Default is 30.
|
duck |
Activates crouching. |
unduck |
Deactivates crouching. |
playeremotestart |
Opens the Emote wheel. |
playeremotestop |
Closes the emote wheel, if it was hovering on an item, it will emote that item. |
List of Commands Marked as Cheating
These commands are marked as cheating and thus they require to write enablecheats into the console for them to work, this doesn't apply to the Editor as cheats are enabled by default. The Editor column implies that these commands can only be used through the A Hat in Time Editor that is provided through the Modding Tools. Some commands are marked "With caution" or "Dangerous" depending on their severity, please read carefully before using them.
Clicking on any command will make a direct link to the command.
| Command | Editor | Description |
|---|---|---|
walk |
Sets the player to walking state. | |
fly |
Sets the player to flying state. | |
ghost |
Sets the player to ghost state. | |
god |
Toggles god mode. | |
benchcamera |
Create a camera that works similar to sitting on a chair. Call again to put the camera back to normal. | |
skipforward |
Sets and teleports you to the next checkpoint. Free Roam maps are instead get their Acts incremented if the Time Piece | |
setskincolor <body> <red> <green> <blue> |
Sets the color of a specified part of the body with an 0 - 255 RGB color format, similar to Color Palettes Valid bodies: Hat, HatBand, HatAlt, Hair, Cape, Orange, Zipper, Dress, Pants, Shoes and ShoesBottom.
| |
openskineditor |
Opens the skin editor that is used to make Color Palettes setskincolor but user friendly.
| |
setact <number> |
Sets the current act number. | |
cammode |
Sets your camera to be a free roam camera with no bounds. During this state you cannot move the player model because your physics are set to None. Call it again to go back to your default camera.
| |
cammodespeed <number> |
Default is 1. Multiplies the free roam camera speed from cammode command.
| |
tposeme |
Sets the player animation tree to None, causing a T-Pose.
| |
givekey |
Adds a key to the player's inventory. | |
dotaunt |
Plays the tongue sticking out 😝 animation. | |
istaunting |
Checks if a taunting animation is playing. | |
itemtaunt |
Plays the "item obtained" animation, type stoptaunt to stop the softlock.
| |
stoptaunt |
Stops the "item obtained" animation or any taunt from currently playing. | |
resetinventory |
Dangerous. Strips all your inventory, including hats, badges, weapons. Type restartlevel to avoid saving this new inventory state!
| |
adddefaultinventory |
Dangerous. Replace your inventory with a new (empty) inventory. Type restartlevel to avoid saving this new inventory state!
| |
savegame |
Saves the current save file, this type of saving is similar to when the player dies or collects a Time Piece | |
resetcheckpoint |
Set checkpoint to 0, subsequent restart (ergo restartlevel) will start from the beginning, if you don't reset, this might break some interactions related to checkpoints..
| |
unlockumbrella |
Gives you the Umbrella. | |
givecosmetic <cosmetic_name> [equip=true] |
Gives you an existing Hat_CosmeticItem and immediately equip it. Set [equip] to false to not equip it.
| |
giveskin <skin_name> [equip=true] |
Gives you an existing Hat_Collectible_Skin and immediately equip it. Set [equip] to false to not equip it.
| |
startmusic |
Starts playing music. | |
stopmusic |
Stops playing music. | |
showmusic |
Opens Hat_HUDElementDebugMusic which shows the currently playing music.
| |
criticalhealth |
Sets player health to 1. | |
destroycpuactors |
Destroy an assortment of enemies, particles, NPCs, doors, dynamic meshes. | |
destroycontrolleractors |
Destroy all Pawns.
| |
printbase |
Prints the name of the ground the player is standing on top. | |
gctest |
Forces garbage collection to happen now. (Might help with performance problems). | |
haslevelintro |
Prints false/true if a level intro is currently playing.
| |
printloadout |
Prints all currently owned items. Inconsistent because printing is limited. | |
clearplayerloadouts |
Dangerous. Strips all players from their loadouts. Type restartlevel to avoid saving this new inventory state!
| |
printinventory |
Prints your inventory items. Inconsistent because printing is limited. | |
addlevelbit <id> <value> |
Adds a level bit. This bit persists regardless of level. | |
removelevelbit <id> <value> |
Removes a level bit. | |
addactbit <id> <value> |
Adds an act bit. This bit persists until the act number changes. | |
removeactbit <id> <value> |
Removes an act bit. | |
hasrainmanager |
Checks if its raining. | |
printdetailmode |
Prints the current detail mode of the world. | |
printmapname |
Prints the file name of the map. | |
printstate |
Prints the current player physics. | |
stateinfo |
Prints a bunch of player current states. | |
openhud <hud_name> [command=""] |
Opens a Hat_HUDElement with an optional [command]. [command] can cause changes in the HUD behaving depending on what is written inside the file. Example: openhud Hat_HUDElementButtonHelp doublejump. This command is constrained to only HatinTimeGameContent package and cannot be used to open Modded HUDs.
| |
fullyrestartlevel |
restartlevel but also sets the checkpoint to 0.
| |
camerayoffset <number> |
Offsets the camera on the y-axis. | |
camerazoffset <number> |
Offsets the camera on the z-axis. | |
cleanbackpack |
Removes level related collectibles from the backpack. | |
freezeframe [delay=0] |
Causes the game to freeze after a short [delay=0], this doesn't mean it is malfunctioning, this is exactly the same state when pausing the game. To unfreeze, press the pause key.
| |
teleport |
Teleport to exactly where the camera is looking. Limited to 10,000 meters. | |
changesize <number> |
Changes the size of the player. Default size is 1.
| |
slomo <number> |
Changes the world's speed with the passed value. Default time is 1. Note: Changable from other sources such as Time Stop | |
setjumpz <number> |
Changes the jump height. Default is 540.
| |
setgravity <number> |
Sets the world gravity, gravity is a negative modifier so inputting positive will cause you to flow up forever. Default is -750.
| |
setspeed <number> |
Multiplies the player's default movement speed, only affects water movement. Default is 1.
| |
killall <class_name> |
Destroys every Actor related to <class_name>.
| |
killallpawns <class_name> |
Similar to killall but kills all Pawn related classes and their controllers. (Like enemies and their AI)
| |
killpawns |
Exactly as calling killallpawns Pawn.
| |
avatar <class_name> |
Posses a Pawn and giving you full control of the specified <class_name>, you can recast this to cycle through another Pawn that is equal to <class_name>, to go back to your original body type avatar Hat_Player to cycle repeatedly until you return back to your own body.
| |
summon <path> |
Spawn an instance of the specified Actor class that is contained inside a Content Package, the <path> must be <content_package_name>.<class_name>.A Hat in Time's package is called HatinTimeGameContent, for Mods however, their packages are named based on their CookedPC file's name (which is based on the mod's folder) holding the mod locally (example: ExampleMod), this is also true for mods downloaded from the Steam Workshop despite their folder being replaced with the mod's workshop ID.To keep it simple, summon HatinTimeGameContent.<class_name> where <class_name> can be any Actor such as Hat_Collectible_EnergyBit Hat_TimeObject Hat_Enemy_Mobster.
|