Ads keep us online. Without them, we wouldn't exist. We don't have
paywalls or sell mods - we never will. But every month we have large bills
and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3
Some commands & console variables you can change to affect minor gameplay elements.
1.Introduction
I've dived into the console commands for HL2 & Source in general multiple times over the years, and I felt like documenting some of the more useful commands that ship with the game, but are otherwise little-known or unused.
Odds are, you'll know most of these. If I manage to teach you about one more command you didn't know about, I'd consider that a win.
Let's get started, then.
There's actually a lot of useful commands you can find. These are some of the basics you would probably get the most use out of.
1.1.Basics
clear - Clears the console text. You'll probably use this one the most.
help [string] - get the help string tied to a command
find [string] - find any commands that have the search string in them or their descriptions
1.1.1.Inputs
key_listboundkeys - return a list of all your bound keys
key_findbinding [string] - find keys bound to a specific string in the command name
key_updatelayout - updates the keyboard layout in-game to the current Windows setting; i.e. DVORAK or QWERTZ
1.1.2.Developer Settings
developer [int] - Enable developer mode. developer 1 will mostly print the console feed to the top corner of the screen. developer 2 will print extremely verbose feedback including map I/O systems being run and time stamps. Recommend to only use developer 1 unless you're trying to find issues with your map's functions or bug hunting. Can be used at startup by using the -dev launch command.
con_notifytime [int] - How many seconds to show the console feed on-screen. Set to 0 to disable the screen popups.
phys_penetration_error_time [int] - How long to show the VPHYSICS PENETRATION ERROR text on objects that are stuck in the world. This happens a lot on maps with physics props just slightly too low into the ground (d2_coast_11 is a really big example of this). Setting this to 0 is recommended unless you're doing some serious head-scratching bug testing, as it's mostly an error you can ignore.
1.2.AI System
notarget - NPCs will ignore the player, but otherwise operate normally.
ai_disable - Completely disables the AI system. May break maps & level progression. Use at own risk.
ai_norebuildgraph [bool] - Hides the NODEGRAPH OUT OF DATE, REBUILDING text. HDtF wishes they knew about this one.
1.2.1.Citizens
npc_citizen_explosive_resist [bool] - When set to 0, Citizens will essentially die to one grenade or explosion as a one-hit-kill.
npc_citizen_auto_player_squad [bool] - Citizens will immediately join the player's squad, and can't be removed until they die.
npc_citizen_auto_player_squad_allow_use [bool] - Allows the player to manually add/remove Citizens from their squad by pressing +use on them. Requires npc_citizen_auto_player_squad 0 to properly work.
npc_citizen_insignia [bool] - places a visible model on the Citizens in your squad. In the case of HL2, it's a chef hat.
npc_citizen_squad_marker [bool] - similar to the previous command, but puts a crosshair gizmo beneath your squad members' feet.
sk_citizen_heal_ally [int] - how much medics will heal you, per medshot.
sk_citizen_heal_ally_delay [int] - how many seconds between heals.
sk_citizen_heal_ally_min_pct [float] - how low your health must be before they will heal you in a decimal. i.e. 0.9 would be 90/100 health.
sk_citizen_giveammo_player_delay [int] - how long in seconds the NPCs must wait before they give you more ammo.
1.3.Spawning & Creation
impulse 82 - create a Jeep
impulse 83 - create an Airboat
npc_create [NPC class name] - spawn an NPC of the specified class. i.e. npc_create npc_citizen or npc_create npc_combine_s.
npc_create_equipment [weapon script name] - spawns NPCs with the specified weapon name. i.e. npc_create_equipment weapon_shotgun.
prop_physics_create [model path] - Spawn a physics prop of the specified type. i.e. prop_physics_create props_c17/oildrum001_explosive.
prop_dynamic_create [model path] - Spawns a dynamic prop of the specified type. Might present errors if the model has no prop_data or $staticprop flags in the compiled model.
1.4.Performance Tweaks
npc_citizen_dont_precache_all [bool] - toggle the precaching of all citizens to prevent hiccups & stuttering
cl_detaildist [int] - How many units to render detail props. Set to 0 to disable them.
g_ragdoll_maxcount [int] - how many corpses can be rendered at once. 0 will make them disappear immediately, while 100 would let 100 different corpses appear at once.
1.4.1.Flushing
snd_restart - restart the sound system of the game. It is greatly advised to use this command over stopsound as this command won't break soundscapes, soundscripts, or entity sounds.
r_flushlod - flushes the model cache. Can be used to prevent overfilling it (hitting the max of 2048 will crash the game), or to empty the cache to see the changes to a recompiled model on the spot.
mat_reloadalltextures - empty & reload the texture cache.
reload - reloads the most recent save, or reloads the entire map depending on the circumstances.
impulse 203 - Remove the object you're aiming at. Dangerous command: use at own risk.
hud_reloadscheme - Reload the HUD files.
vehicle_flushscript - Reload the vehicle script files.
1.4.2.Inputs & Controls
toggle_duck - toggle the player's crouch status. The same as using +duck, but a toggle instead of a hold.
toggle_zoom - toggle the player's Suit Zoom. The same as using +zoom, but a toggle instead of a hold.
toggle [command] [intervals] - toggle a console variable on/off or cycle values. i.e. toggle npc_citizen_auto_player_squad would toggle the boolean on & off each time the command was used, while using toggle sk_max_357 1 3 6 would set the max .357 ammo to 1, then 3, then 6 each time the command was used.
impulse 200 - Holster your weapon view model. Will just disappear if the weapon lacks an ACT_VM_HOLSTER activity.
sv_stickysprint [bool] - Change the sprint from hold to toggle. Will continue sprinting until the player stops moving.
sv_autoladderdismount [bool] - Toggle auto-mounting of ladders when near an exit point. If turned off, you'll need to press +use to dismount manually.
sv_ladderautomountdot [float] - The deadzone of how close you have to look at a dismount point to trigger getting off on it. 1 would make it have almost no automount, while 0 would mount it even if you're not facing it. Default of 0.4 is fine in most situtations.
1.4.3.Weapons
impulse 101 - The classic. Give all weapons.
lastinv - switch the last weapon used. Useful when making quick-switch commands in chain bindings.
use [weapon script name] - instantly select a weapon from your inventory. i.e. use weapon_357.
phys_swap - instantly swap to the Gravity Gun. Essentially the same as using use weapon_physcannon.
bug_swap - instantly swap to the Bugbait. Essentially the same as using use weapon_bugbait.
give [weapon script name] - Give the specified weapon. i.e. give weapon_357.
givecurrentammo - Give the maximum amount of ammo for the currently equipped weapon.
hud_fastswitch [int 0-2] - Set the fast switch setting. 0 = disabled, 1 = PC fast switch, 2 = console-style selection.
1.5.Game Settings
hl2_episodic [bool] - enable some minor effects used in EP1 & EP2. May not be immediately visible or very obvious. Recommended to leave off in HL2 as it will make Zombies burst into flames & break in half on damage.
sv_unlockedchapters [int] - Unlock or lock chapters in the game. Set to 0 to essentially reset progression, or to 99 to unlock all features. SiN Episodes uses the 99 setting to enable the HARDCORPS new game plus mode, for example.
sk_auto_reload_time [int] - How many seconds after it was holstered to auto-reload the weapon. If set to 3, it will reload the weapon three seconds after being holstered. Setting it to 0 will cause the weapon to be reloaded immediately on holster. To essentially disable this setting, you'd need to set the time to something like 999 to make it just take so long you'd never notice.
1.5.1.Saving
sv_autosave [bool] - Toggle autosaving; saving on level transitions will still occur.
save_screenshot [int 0-2] - Save a screenshot on the save. 0 = no screenshot, 1 = manual saves only, 2 = always.
save_history_count [int] - How many save iterations to keep. Default is 1, while 3 would keep 3 copies of the saves.
autosavedangerous - Force a "dangerous" autosave. These are used when an autosave occurs while enemies are nearby.
1.6.Interface
hud_deathnotice_time [int] - how long to show death notices on the top right before making them fade. Set to 0 to disable the feed visibility.
closecaption [bool] - Toggle full closed captioning support. Not compatible with cc_subtitles.
cc_subtitles [bool] - Toggle subtitles. Not compatible with closedcaption.
mat_yuv [bool] - toggle the entire game to be in grayscale. As compared to a custom color correction scheme, this will affect everything, including VGUI & menu elements.
mat_colorcorrection [bool] - Toggle colour correction capabilities. If you're on a map that has some god-awful colour corrections like some obnoxious GMod RP maps do, you'll enjoy turning this off.
hud_showemptyweaponslots [bool] - Toggle showing weapon slots if there is no weapon currently in them. i.e. show the Shotgun/Crossbow slot if neither have been picked up.
1.6.1.Chat
hud_saytext_time [int] - how long to show chat messages before making them fade. Set to 0 to make the chat messages not show until the chat window is opened.
voice_enable [bool] - toggle voice chat
voice_loopback [bool] - Toggle hearing your own voice broadcast in game back to yourself as other people hear it.
1.6.2.HUD
hud_quickinfo [bool] - toggle the Xbox-style reticle that shows health on the left & magazine left on the right.
hud_draw_fixed_reticle [bool] - toggle the fixed reticle for the quick info command around the normal crosshair.
hud_draw_active_reticle [bool] - make the fixed reticle change colours when over friendly or enemy NPCs.
cl_showhelp [bool] - disable the HUD hints.
hud_jeephint_numentries [int] - max number of hints to show for the Jeep. Set to 0 to disable the hints.
hud_airboathint_numentries [int] - same as abouve, but for the Airboat. Set to 0 to disable hints.
commentary [bool] - Toggle developer commentary mode. This is the command used by the game when toggling commentary mode.
1.6.3.Flashlight
r_flashlightfov [int] - the field of view that flashlight will have. Default is 45, while setting it to 90 will drastically improve the effectiveness of the torch, especially on ultrawide resolutions like 21:9 or 32:9
r_newflashlight [bool] - Toggle between HL1-style flashlight or HL2 style. HL1 style emits from the crosshair, while HL2 style emits from the player.
r_flashlightlockposition [bool] - Lock the flashlight to whatever position it was created at, making it independant of the player. Will delete itself when turned off.
2.Conclusion
I might find more over time, and I might have some stuff wrong. Feel free to suggest changes, or to ask for clarifications.
I've also attached a blank bind config file that you can view for an idea of all the keys you can assign. I'm using a US English Standard QWERTY keyboard, so please take note of that if you use something else like DVORAK or QWERTZ.
I also noticed that, in Half-Life 2, using hl2_episodic 1 makes it so some NPCs generate fire when they are killed or hit with something with the gravity gun! I also got a crash when toggleing this boolean value on and off, so it's good to know.
Was testing impulse 203 several times. Got a crash. Warning, people.
By the way... setting npc_citizen_dont_precache_all to 0 (default value) makes it so the engine preloads every Citizen in the map, increasing loading times, but improving performance in-game?
Disabling hints with cl_showhelp may be a bad thing in games such as Portal 2. I remember that, at the beginning, Chell had to take a sleep, and thanks to the hint, as a player, I knew what to do. Otherwise, I wouldn't have progressed in the game.
This tutorial is awesome. The HDTF reference was a low blow, but a funny one, haha. Can't thank you enough for the key_ commands too!
Didn't know npc_citizen_insignia existed, haha. That's hilarious! As for the crouch/duck toggle, I prefer creating a custom alias, because the default toggle_duck gets buggy when using it fast and repeatedly, whilst this code below, works like a charm :)
alias duck_toggle0 "-duck;bind [key] duck_toggle1" alias duck_toggle1 "+duck;bind [key] duck_toggle0" bind [key] duck_toggle1
Thank you for sharing this. As the creator of the Realistic-ish difficulty mod, this is really helpful, and I'm really into configs and achieving performance on my rather low-end PC. Thanks to you now I can access even more features within the Source engine! :)