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

Useful Console Commands to Tweak Your HL2 - A Tutorial for Half-Life 2


Update 6 11mo
  • Addition Added sk_ammo_qty_scale commands
Added sk_ammo_qty_scale1/sk_ammo_qty_scale2/sk_ammo_qty_scale3 commands.
Update 5 1y Addition3 Adjustment2 Update 4 1y Addition5 Update 3 1y Addition Update 2 1y Addition

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.2.2. Squad Behavior

  • player_squad_double_tap_time [float] - How quickly the player must run the impulse 50 command twice in order to summon their squad to follow. Default of 0.25 is fine for most players.
  • player_squad_autosummon_time [int] - How long the squad must be in one position after being sent there before they will automatically go back to following the player. Default of 5 is annoyingly low. Set to something like 64 in order to make them stay for a while.
  • player_squad_autosummon_time_after_combat [int] - Similar to above, but after a combat phase. Default of 8 is similarly annoyingly low. Set to another higher number based on user preference to make the follow or wait.
  • player_squad_autosummon_move_tolerance [int] - How far the player can move away before they will autosummon based on distance. Useful to set to something like 64 or such in case you forget them. Default of 20 is somewhat low if doing more fine-tuned placement. This is not in Hammer units!
  • player_squad_autosummon_player_tolerance [int] - Similar to above. Setting both to the same value probably wouldn't hurt, but I need more data. Default of 10 is pretty low, however.
  • impulse 50 - The send/recall command.

1.2.3. Other NPCs

  • monk_headshot_freq [int] - how many shots Father Grigori must fire before it will guarantee a headshot. Default of 2 means every two normal shots will guarantee a headshot next, while 0 will make everything a headshot. Higher values will create a longer interval before another headshot.

1.3. Spawning & Creation

  • ch_createjeep - create a Jeep; same as impulse 82.
  • ch_createairboat - create an Airboat; same as impulse 83.
  • 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.
  • impulse 201 - Spray command.

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

  • 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. Unlike +zoom, will not block the player from firing.
  • 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. Cheat flagged.
  • 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 dot product 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.
  • sv_ladder_useonly [bool] - Toggle whether you can auto-mount a ladder by being close, or if you must use your use key to grab it.
  • impulse 100 - Toggle the flashlight.

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.4.4. Items

  • sk_battery [int] - how much item_suit power item_battery pickups will provide. Default is 15. Picking up weapon_stunstick entities in HL2 will provide 50% of this value, rounded up.
  • sk_ammo_qty_scale1 [float] - How much ammo to provide on pickup in easy difficulty. Default 1.2.
  • sk_ammo_qty_scale2 [float] - How much ammo to provide on pickup in normal difficulty. Default 1.0.
  • sk_ammo_qty_scale3 0.6 - How much ammo to provide on pickup in hard difficulty. Default 0.6.

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.
  • sv_infinite_aux_power [bool] - Toggle infinite suit power (i.e. sprinting, torch battery, oxygen, etc.)
  • 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.6. Sound System

  • dsp_off [bool] - Toggle DSP effects. Useful for testing sounds without background interference.
  • stopsoundscape - Stop the currently active soundscape. Useful for the same reason as abouve.
  • stopsound - Stops all sounds currently playing. Will not stop soundscape the player is current inside the volume of. This command is known to break sounds, so use sparingly.
  • 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.

1.6.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.
  • save_console [bool] - Toggle console-style saving.
  • autosave - Force an autosave.
  • autosavedangerous - Force a "dangerous" autosave. These are used when an autosave occurs while enemies are nearby.
  • save_disable [bool] - COMPLETELY disable saving, even quick saves. If you die, the game resets to the start. Bring your A-game.

1.7. 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.7.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.7.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.7.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.
  • AlphaBeta avatar
    AlphaBeta Joined 1y ago
    I've wasted close to 6 years of my life on this game yet some of these commands were news to me. Genuinely great guide
    URL to post:
  • 1v4n94 avatar
    1v4n94 Joined 7y ago
    1,182 points Ranked 24,425th
    12 medals 2 rare
    • Thanked 50 submitters Medal icon
    • 6 years a member Medal icon
    • One month a member Medal icon
    • 6 months a member Medal icon
    • 1 year a member Medal icon
    • 2 years a member Medal icon
    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.
    URL to post:
  • 1v4n94 avatar
    1v4n94 Joined 7y ago
    1,182 points Ranked 24,425th
    12 medals 2 rare
    • Thanked 50 submitters Medal icon
    • 6 years a member Medal icon
    • One month a member Medal icon
    • 6 months a member Medal icon
    • 1 year a member Medal icon
    • 2 years a member Medal icon
    1y 1y
    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
    URL to post:
  • 1v4n94 avatar
    1v4n94 Joined 7y ago
    1,182 points Ranked 24,425th
    12 medals 2 rare
    • Thanked 50 submitters Medal icon
    • 6 years a member Medal icon
    • One month a member Medal icon
    • 6 months a member Medal icon
    • 1 year a member Medal icon
    • 2 years a member Medal icon
    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! :)
    URL to post:
  • Stalin Airlines avatar
    Stalin Airlines Joined 2y ago
    299 points Ranked 55,004th
    8 medals 1 rare
    • Returned 1000 times Medal icon
    • Reached 1,000 Points Medal icon
    • Returned 100 times Medal icon
    • One month a member Medal icon
    • Received thanks 5 times Medal icon
    • 6 months a member Medal icon
    This is great! Thank you so much!
    Big Mustache Man
    URL to post:


Difficulty Level