This topic is a resurrection of my l4d one of the same stuff. Most of it is copy paste since things haven't changed much, but where it is different I've tried to make a note of it.
For more console related information, visit here http://forums.steampowered.com/forums/showthread.php?t=765781
or here http://left4dead.wikia.com/wiki/Complete_list_of_console_commands
Ins and outs of the Developer's Console
First, you will need to turn the console on. Go to options, click keyboard, and look for the fifth option which will say "Developer's Console”. Make sure this is enabled.
In order to now access the console, click on ` which is also referred to as ~ or tilde and is located under the escape key (on most keyboards).
Console commands generally consist of a command and a variable. Some commands do not require variables, some will require one of two, and others can have up to five choices.
When a command does not have a variable after it, typing the command causes it to work. For example, 'openserverbrowser' does not have a variable and, when typed, opens the server browser.
If a variable is required and there are two choices, 1 means to turn it on and 0 means to turn it off (some people will refer to this as binary or boolean).
Console commands auto complete, meaning it will try to guess what commands you want to type based on what you have typed so far. As an example, it knows that if you type "sv_che", you probably want "sv_cheats" and displays it as an option, along with whatever its current variable is.
When entering console commands, you normally enter them one by one. If you want to enter multiple commands on the same line, separate them with a semicolon (“sv_cheats 1; god 1”).
If a text document is saved with a .cfg extension and placed in C:\programfiles\Steam\steamapps\common\left 4 dead\left4dead\cfg, then it can be run whenever you type exec and its name.
What this means is that I can place any number of console commands in a cfg file, name it something.cfg, and then apply it by using the command “exec something”. It is highly recommended that you take frequently used commands and put them in a cfg file.
For example, you might decide to make a godmode.cfg file which gives you full health, invincibility, and unlimited ammo.
Make a text document and rename it godmode.cfg. Then you want to edit it/ open with notepad, and put in the following lines:
now whenever you type “exec godmode”, those commands are applied. Please note that sv_cheats doesn't work unless you created the local server using the map command (more on that later).
If a cfg line has // in it, that means the rest of the line following // doesn't count. Normally people use it for commenting, writing notes about what each step does. Our example commented would look like this.
godmode. //makes you invincible and stuff.
sv_cheats 1 //turn cheats on
give health //give me full health
god 1 //make me invincible
sv_infinite_ammo 1 //give me infinite ammo
Of special note is the file autoexec.cfg. If you don't already have one, go ahead and make one; any thing put into autoexec automatically runs every time you turn the game on.
cfg files work best with what are generally called scripts. I will be giving you a number of scripts in a bit that you can put in cfg files at your leisure, or you can make your own based on what you feel you will need/use.
there are ten posts for this, so if you could let me get them all in before responding I'd appreciate it.
Practicing as infected in single player.
These commands are to help you play as a zombie in single player against the ai controlled bots.
First, from the main menu, use the map command. After typing map, autocomplete to find the right map (c1m3 would be campaign 1 map 3, which is dead center in the mall). After you have the map you want, type teh mode after it. For our example, we're using "map c1m3_mall versus".
sv_cheats 1 //turns on cheats
jointeam 3 //switches you to infected.
jointeam 2 //puts you back on the survivor side.
jointeam 1 //
As a note, the bots won't complete a map by themselves because, in versus, if there are no player survivors the bots don't have to do anything. You won't be able to fight against the ai bots, but you can practice things like hunter jumps or arcing spitter shots for long range. The following commands are useful for controlling the bots to an extent.
sb_stop 1 //this makes it so the bots won't do anything
god 1 //this makes it so the bots won't die while you are wall jumping
z_common_limit 0 //set this to zero and normal zombies won't spawn, meaning you wouldn't have to turn on god mode. Useful to test pounce damage.
Now, if you are in the blue spawn screen for infected, type
z_spawn (hunter/smoker/boomer/tank/charger/jockey/spitter) and it will let you be whatever you asked to be. You can also spawn witches or mobs. If you put in something the game doesn't recognize (like elephant) it creates one normal infected instead.
Special note for hunters:
if you have pounced someone but want to stop shredding them to set up another pounce, use "noclip".
Noclip lets you fly through walls and off the person you pounced.
Special note for smokers:
tongue_allow_voluntary_release 1 lets you release the tongue pull with a right click. Again, useful if you want to test pulls without killing the survivors.
Special notes for tanks:
z_frustration 0 disables control. That way you don't have to worry about it while practicing rock lobbing or whatever.
Other useful or fun commands:
I suggest binding f1 through f6 for various zombie spawns (bind f1 z_spawn hunter, bind f6 z_spawn mob, etc) just for simplicity. I also have \ bound as "noclip" for a similar reason. If you're on of those people who always hit f1 for votes, then I guess you shouldn't.
ghost //takes you from "you are dead" to "you may respawn" immediately instead of waiting five seconds or however long it waits.
z_(infected)_limit 1 //determines how many of each zombie you are allowed to have. gas is for smokers, exploding is for boomers, and hunter is for ... hunters. You can always spawn more than the limit, but sometimes it makes the game sad/crash.
(boomer/hunter/smoker)_pz_claw_damage // lets you set how much claw damage does. Specials claw through doors at the same rate, even if it is as high as 1000 or as low as 0. Setting it negative does not make it heal people.
z_lunge_power determines how fast the hunter pounces. Set it high and he becomes rather ridiculous.
sb_takecontrol //takes control of whatever bot you are looking at, switching your side if necessary.
respawn_all //forces all dead survivors to respawn in the safe room
I suggest creating a cfg for some or more of these, at least the ones that set up all bot team and human zombies and etc. up to you though.
The command bind lets you assign a specific command to a key. You’ve already seen some of the binds I use, but this topic is designed to not only teach you console commands, but to also inspire you to come up with some scripts of your own. In order to help with that, I’m supplying all the binds used by default for the game. You can then use these as you see fit for other purposes (it's also helpful in case you mess something up and need to fix it).
If you ever need to unbind a key, just use "unbind (key)" or "unbindall".
//these three are for opening the menus.
bind "ESCAPE" "cancelselect"
bind "`" "toggleconsole"
bind "START" "gameui_activate"
bind "TAB" "+showscores" //scores
bind "SPACE" "+jump" //jumping
bind "0" "slot10" //not used
bind "1" "slot1" //primary gun
bind "2" "slot2" //pistols
bind "3" "slot3" //grenades
bind "4" "slot4" //kits
bind "5" "slot5" //pills
bind "6" "slot6" //not used
bind "7" "slot7" //not used
bind "8" "slot8" //not used
bind "9" "slot9" //not used
bind "a" "+moveleft" //go left
bind "d" "+moveright" //go right
bind "e" "+use" //use, open, or rescue
bind "f" "impulse 100" //flashlight toggle
bind "h" "motd" //server page
bind "m" "chooseteam" //switch teams
bind "c" "+voicerecord" //use mic
bind "q" "lastinv" //go to last weapon
bind "r" "+reload" //reload
bind "s" "+back" //step back
bind "t" "impulse 201" //use sprays
bind "u" "messagemode2" //teamspeak
bind "w" "+forward" //run forward
bind "x" "+mouse_menu QA" //question anwser menu
bind "y" "messagemode" //all speak
bind "z" "+mouse_menu Orders" //command menu
bind "CTRL" "+duck" //crouch
bind "SHIFT" "+speed" //walk
bind "F1" "Vote Yes" //vote yes
bind "F2" "Vote No" //vote no
bind "F5" "jpeg" //take screenshot
bind "MWHEELDOWN" "invnext" //scroll inventory
bind "MWHEELUP" "invprev" //scroll inventory the other way
bind "MOUSE1" "+attack" //shoot
bind "MOUSE2" "+attack2" //melee
bind "MOUSE3" "+zoom" //scope
I find having a third person camera to be extremely useful for certain applications in the game. It makes some hunter pounces easier, and I find fighting a tank to be easier in third person mode.
There are two commands that turn on thirdperson, being "thirdperson" and "thirdpersonshoulder". You can return to firstperson by using either "firstperson" or whichever thirdperson command you used. Do note that thirdperson is cheat protected (can’t activate it without sv_cheats 1).
This one is, for lack of a better name, the "resident evil" camera:
c_thirdpersonshoulderheight 2 //this is subject to your preference, some people like it bigger
cam_idealdist 50 //again, some people like this number bigger.
cam_idealyaw -5 //this one too.
This one is, for lack of a better name, the "metal gear solid" camera:
I have these bound to home and end (bind home exec thirdpersonMGS) so I can just press it and it will activate and then hit it again to turn it off.
You're encouraged to come up with your own cameras for what works for you, of course. Bad news for the snipers out there, you really can't use thirdperson with the rifle if you want perfect aim at all ranges...
Scripts for advancing gameplay: Guns
These are all scripts that modify certain aspects of game play. If you want to use them, either put them in a special cfg file or place them in autoexec.cfg.
These gun scripts modify how you can use the various guns in the game. With these in place, you can press [ to toggle auto reload for the shotguns, press v to cycle between full auto, burst fire, and semi auto for the rifle/uzi, and press alt to toggle automatic fire for the pistols. Your crosshair will change color for each gun feature (purple for reload, red for burst, green for semi, black for full auto on the pistols, and blue for normal).
A note about how each one works. The wait command tells the script to wait before applying the next command. Now, it isn't perfect. In laggy games, the wait command acts differently so you won't get the right shot. Also, each gun has a different fire rate so the wait commands are interpreted differently. With the smg, burst fire is 3 shots, but for the ak it only gives 2. It has no real effect on the sniper, shotgun, or desert rifle, so only use these on the other guns. Finally, auto pistols only work with dual wielding since the fire rate is not capped then. For the single pistol/magnum, you can't fire faster than a certain speed.
//key binds to switch
bind , "normal"
bind . "burst"
bind / "semi"
alias normal "bind mouse1 +attack; normalcross;reload2; alias switch.w switch1"
alias burst "bind mouse1 burstshot;reload2;alias switch.w switch2"
alias semi "bind mouse1 semishot;reload2;alias switch.w switch3"
alias normalcross "cl_crosshair_blue 220; cl_crosshair_green 182; cl_crosshair_red
alias burstcross "cl_crosshair_blue 50; cl_crosshair_green 50; cl_crosshair_red
alias semicross "cl_crosshair_blue 50; cl_crosshair_green 220; cl_crosshair_red 50;
//attack definitions for each mode
alias burstshot "+attack; wait 5; -attack; wait 3; +attack; wait 5; -attack; wait
3; +attack; wait 5; -attack; wait 3"
alias semishot "+attack; wait 5; -attack; wait 3"
//prevent items from messing up, needed to fix scrolling
bind 3 "normal; normalcross; slot3"
bind 4 "normal; normalcross; slot4"
bind 5 "normal; normalcross; slot5"
bind mwheelup "normal;normalcross; invprev"
bind mwheeldown "normal;normalcross; invnext"
bind q "lastinv; reload2"
//rotate modes with v
alias switch.w switch1
alias switch1 "burst; burstcross; alias switch.w switch2"
alias switch2 "semi; semicross; alias switch.w switch3"
alias switch3 "normal; normalcross; alias switch.w switch1"
bind v switch.w
alias mp.reload reload1
alias reload1 "+reload; alias mp.reload reload2; cl_crosshair_blue 220;
cl_crosshair_green 0; cl_crosshair_red 138"
alias reload2 "-reload; alias mp.reload reload1; cl_crosshair_blue 220;
cl_crosshair_green 182; cl_crosshair_red 138"
bind [ "normal; mp.reload"
//rapidfirepistol (use this one at your own risk, it's rather complicated)
alias mp.fast fast1
alias fast1 "bind mouse1 +1; alias mp.fast fast0; cl_crosshair_blue 0;
cl_crosshair_green 0; cl_crosshair_red 0"
alias fast0 "normal; alias mp.fast fast1"
bind alt mp.fast
alias "+1" "alias 3 +2; +2";
alias "+2" "+attack; wait 1; -2";
alias "-2" "-attack; wait 1; 3";
alias "3" "+2";
alias "-1" "alias 3 -attack";
Scripts for advanced gameplay: misc
From the main menu, the console command "map (level name)" lets you open a map from your root::/left4dead2/maps folder. Best way to open custom maps, from which you can then invite friends to play the many user created maps already available. I don't know much about transferring maps from l4d to l4d2, besides that with the sdk it is possible and that there are plenty of people setting that up as I'm typing this.
If you have already started a game, you need to use the command "changelevel (map name) instead. Using just "map" will crash the game since you're already in a map.
These scripts allow you to send messages to your team by pressing the corresponding key on your number pad. 1 and 4 are for hunters, 2 and 5 are for smoker, 3 and 6 are for boomers, 7 is tank, 8 is witch, and 9 is horde. Plus is to say "wait here" and minus is for "let's go". These are really useful if you don't have a mic or if your team can't hear you because of being boomed/surrounded/etc.
bind KP_END "say_team Hunter up ahead!"
bind KP_DOWNARROW "say_team Smoker up ahead!"
bind KP_PGDN "say_team Boomer up ahead!"
bind KP_LEFTARROW "say_team Jockey up ahead!"
bind KP_5 "say_team I've been pinned! I need help!"
bind KP_RIGHTARROW "say_team Charger up ahead!"
bind KP_HOME "say_team Tank up ahead!"
bind KP_UPARROW "say_team Witch up ahead!"
bind KP_PGUP "say_team Incoming Spit! Move!6"
bind KP_PLUS "say_team Let's wait here a minute..."
bind KP_MINUS "say_team Let's move out!"
This script brings up netgraph 1 when you press tab. Since the patch, pressing tab shows everyone's ping, so its not exactly necessary, but netgraph one has other uses besides displaying ping; it also shows your fps, a more accurate ping, and a few other things. Try it out if you are curious; you can also modify which netgraph shows to get more detailed information (just change 1 to 2 or 3 or 5).
//scores and netgraph
bind "TAB" "+sb";
alias "+sb" "+showscores; net_graph 1";
alias "-sb" "-showscores; net_graph 0";
Me personally, I don't like holding down ctrl or shift to crouch or walk. I would much rather just press it to toggle it on or off. These scripts do just that.
alias mp.walk walk1
alias walk1 "+speed; alias mp.walk walk2"
alias walk2 "-speed; alias mp.walk walk1"
bind shift mp.walk
alias mp.duck duck1
alias duck1 "+duck; alias mp.duck duck2"
alias duck2 "-duck; alias mp.duck duck1"
bind ctrl mp.duck
Left 4 LAN2.
If you want to play left 4 dead 2 on a lan server, you must first set it up.
"map (name of the map)"
Now, anyone else connected to your computer on the lan should be able to connect by either using the command "connect" or by opening the server browser and using the lan tab.
Miscellaneous commands part 2.
More random commands that don't have a specific place, but do have some use.
retry- disconnects you from a server and then tries to reconnect you to it. Useful to reset the number of times you can switch teams, in case the server keeps switching you to the other team or some such.
team_desired "(team character)"- when you join a server, it will give you the desired team and character if possible. DOES NOT work in lobby, only when joining a server. For example, if I were to use "retry; team_desired survivor bill" the game would take me out and then stick me on the survivor team in bill's spot if possible.
disconnect- takes you off the current server
sv_crash- takes out the current server (cheat protected)
ping- shows everyone's ping in console.
cl_playerspraydisable- tells your game to not show sprays. I guess you might want to use this if you're concerned that someone might put up an inappropriate spray that you don't want children/siblings/parents/etc seeing.
alias sprayon "cl_playerspraydisable 0; bind \ sprayoff"
alias sprayoff "cl_playerspraydisable 1; bind \ sprayon"
bind \ sprayoff //just a quick toggle for turning sprays on and off. use if that's something you would need.
status- gives a report on status in console. Has information that might be useful for server owners.
report- gives an onscreen message display on status. It basically shows you how you are doing, things like how many kills you have gotten, your accuracy, the number of times you've reached the safehouse, and etc.
director_report- much more detailed report. It shows director information, including things like when mobs are going to next spawn. It’s cheat protected.
hide_message_panel- closes report or director_report.
"sv_search_max_ping (default 250)" is the max acceptable ping for the lobby leader when he searches for games. If you're the leader and set it to say 70 you'll only search for good ping games. Another note on the ping is that everyone's ping is always wildly variable. If you use netgraph, tab, and the ping command in console, I always get three different values for ping, normally 10 or so off from each other.
Callvote changemission (mission name, airport or hospital or etc) calls a vote to switch to one of the other campaigns. Easier way of switching maps in a public setting.
Including a link with information about the survivor cloning source plugin (this is the one for l4d, dunno how well it works in l4d2 but i know they were working on getting it running but didn't have an eta when i was typing this).
Let’s you have more than one of each bot, opening up all sorts of fun possibilities.
8v8 versus is an obvious option, but you could also use the console command "survivor_max_incapacitated_count 0" to disable incapacitation and then play expert instead. You have twice the firepower, but if you die you stay dead until rescued...
Split screen setup.
These are for if you want to play with a friend on the same computer.
First, you have to create a map that suports splitscreen. From the main menu, use "ss_map (map name)".
Once the map loads you have to use connect_splitscreen localhost 2 to add the splitscreen player. If you want a command to apply to the second player in a splitscreen, put cmd2 in front of it. Now, you could set up the arrow keys and numpad to move player 2 and etc, but I find that using a second mouse confuses my game. To avoid this, I use a wired 360 controller.
These commands configure the input so it is 360 specific. In order to get my controller to work, it has to be set to player two. Plug it in, and it says it is player one. Start up the game, and on the loading screen after the cinematic, unplug and replug the controller and it should switch to player two.
joy_advanced "1" // use advanced joystick options (allows for multiple axes)
joy_name "L4D Xbox360 Joystick Configuration"
joy_advaxisx 3 // x-axis controls GAME_AXIS_SIDE (strafing left and right)
joy_advaxisy 1 // y-axis controls GAME_AXIS_FORWARD (move forward and back)
joy_advaxisz 0 // z-axis is treated like a button
joy_advaxisr 2 // r-axis controls GAME_AXIS_PITCH (look up and down)
joy_advaxisu 4 // u-axis controls GAME_AXIS_YAW (look left and right)
joy_advaxisv 0 // v-axis is unused
joy_forwardsensitivity -1.0 // movement sensitivity
joy_forwardthreshold 0.1 // movement dead zone settings
joy_pitchsensitivity 1.0 // look sensitivity
joy_pitchthreshold 0.1 // look dead zone settings
joyadvancedupdate // advanced joystick update allows for analog control of move and look
these commands will allow the second player to use the controller to move around and etc.
// controller2 bindings
cmd2 +jlook // enable joystick look
cmd2 bind "A_BUTTON" "+jump;+menuAccept"// (A) button - Jump - accept things
cmd2 bind "B_BUTTON" "+reload" // (B) button - Reload
cmd2 bind "X_BUTTON" "+use" // (X) Use
cmd2 bind "Y_BUTTON" "lastinv" // (Y) button - swap pistol/rifle
cmd2 bind "R_TRIGGER" "+attack" // RT - Main weapon
cmd2 bind "L_TRIGGER" "+attack2" // LT - Melee
cmd2 bind "R_SHOULDER" "+lookspin" // RB - Fast 180 spin
cmd2 bind "L_SHOULDER" "toggle_duck" // LB - Duck - is also used to give objects to people.
cmd2 bind "STICK1" "vocalize smartlook" // LS - vocalize whatever the player is looking at
cmd2 bind "STICK2" "+zoom" // RS click - Rifle Zoom
// Fixed bindings, do not change these across joystick presets
cmd2 bind "BACK" "togglescores" // (back) button - scores
cmd2 bind "START" "pause" // (start) button - pause
cmd2 bind "S1_UP" "+menuUp" // Hud menu Up
cmd2 bind "S1_DOWN" "+menuDown" // Hud menu Down
cmd2 bind "UP" "impulse 100" // DPad Up - Toggle flashlight
cmd2 bind "LEFT" "slot3" // DPad Left - grenade
cmd2 bind "RIGHT" "slot4" // DPad Right - health
cmd2 bind "DOWN" "slot5" // DPad Down - Pills
You can also give the second person a name with "name2 (name)". You’ll notice that "name (name)" is your nickname.
Commands of dubious purpose.
The first are vocalize commands. "vocalize (phrase)" causes your character to say the applicable phrase. vocalize smartlook causes your character to comment on whatever they are looking at, saying pills, tank, look at this, or whatever is appropriate to what they are looking at. Here is an applicable list.
You can also use vocalize to taunt or grief by spamming the annoying phrases. I won't tell you what these are, because I hate griefers, so you'll have to look them up on your own time.
You can also use console commands to cheat achievements (not that you should, most of them are easy or rewarding enough that you should complete them legit). But I’ll assume you use this knowledge to fix glitches that remove achievements. :P
First, for most achievements as long as sv_cheats is 0 when you earn it you get it, even if sv_cheats was on while earning it. So I could activate god mode, teleport to the saferoom on expert each time, turn cheats off, and close the door, and get the achievement for taking no special damage. Or I could use "kick boomer" to remove a boomer every time I hear it spawn. Of special note, the kick command is not cheat protected in single player. It’s also an easier way to remove the survivor bots; just use kick nick/ellis/etc and sb_add to replace them later on.
The infected achievements are harder to cheat- I mean unglitch. You have to use split screen if you are doing it in single player and get each person on a different team. I find that kicking the bots help, but it is up to you.
The command "record (name)" creates a demo file of the current server game. Any maps visited on the same server are also given demos, at name_(2,3,4, etc).
To view demos, use the command "demoui". From here you can load demos, play them, and so forth. In demos, you can use certain console commands if they don't change the game at all. For example, you can use crosshair 0 to turn off the crosshair or any of the thirdperson scripts to turn on thirdperson.
You can also see any console commands entered from the demo. I often take notes in my console in game when I want to record something but I don't want to say it out loud (normally to comment on a n00b move by someone). Just open the console and type whatever you want in there. Later on in the demo, open the console and find what you wrote. As long as your writing can't be construed as a console command, you're fine (it shouldn't do anything anyway since most games have cheats off).
If you have a mic and want your voice to be recorded, you need to use the command "voice_loopback 1". This causes your speakers to throw your voice as well, meaning echo. If you use headphones like me it won't bother your team, but you'll have to handle it for yourself regardless.
There are edit options available in the demoui, as well as smoothing options. You can also adjust video options and use higher detail at your choosing, since you won't have lag from other people's connections as much.
I use xfire or hypercam to record demos I am playing back. I get better quality and it doesn't lag me in game. Of course, if you already have fraps or what have you, use what you prefer.
Using console commands, you can change certain aspects of the game and create new modes. As an example, here is a "romero" mode which gives the zombies a lot more health, more numerous hordes, and a lot less speed, meaning they are best killed by headshots.
It’s designed to mimic the slow zombies of George A Romero’s description.
They are best dispatched with headshots and puts an emphasis on teamwork and aiming.
Another I have enjoyed is the invinci-boomer.
z_exploding health 50000
z_vomit interval 60
Start a versus map, have four people on survivor, and one on infected. z_hunter_limit and z_gas_limit should both be 0 so the infected always comes as a boomer. now, the boomer is basically invincible but can't barf as frequently, so his major job is to get in the way and use his fat to slow down the survivors.
Feel free to create your own console mods based on what you have learned so far. There is a lot of felexibility in teh console commands, and there are plenty I haven't talked about that you can look for. All you need to do is open up a practice game and try it out, and if it is enough fun then get a local server going and invite some friends to it.
This is sort of a beta work. I'm sure there are other console commands that are nifty and cool and will be added to this list in the future. For now, if you have questions or find one that doesn't work or should be added, post here and let me know.