Gaming
 

Console commands

From Left 4 Dead Wiki, the free Left 4 Dead info source anyone can edit.

The console is a feature of many games that can be used to change certain elements of a game. In Left 4 Dead, it can be activated in the Options menu (go to "Keyboard/Mouse", then Enable the "Allow Developer Console" option) and then displayed by pressing the tilde (~) key in game (you don't need to press "Shift"). Valve features a quick-type feature in their consoles that allow rapid entry of commands.

Note that the key used to access the (blank) console may be different on non-US keyboard layouts, for example a standard UK keyboard layout uses the ` key (left of the 1 key).

Contents

[edit] 'sv_cheats'

The 'sv_cheats' is a prerequisite command to many of the game-altering commands found in Left 4 Dead. By setting sv_cheats to 1, most all commands are then recognized by the game. It is with 'sv_cheats 1' that most of the exploits were found by users in the demo during its pre-order era.

Setting 'sv_cheats' to 1 disables the ability to earn achievements. This counts towards counters, as well, so any Infected killed with cheats enabled will not count towards Zombie Genocidest or any similar achievement. However, when you turn it off, achievements are reenabled. NOTE: If you turn off 'sv_cheats' after having them on in a campaign, you WILL NOT get the achievement for completing that campaign. 'sv_cheats' must be disabled the entire campaign.

[edit] Annotated list of commands

Knowing all the commands isn't quite as good as knowing what they do. The following will describe what each command does and its default value.

Important things to know about your cheat console:

  • Some commands require you to be the game host (such as setting sv_cheats to 1)
  • It is assumed that you have sv_cheats 1 set for the commands described in this section
  • If you turn on cheats then turn them off, many settings get discarded!
  • The console can auto-complete commands, never type more than you need to, just type a few letters then hit the up/down arrows
  • Commands can be chained. Example: sv_cheats 1; z_spawn boomer; z_spawn hunter; z_spawn smoker; z_spawn mob; sv_cheats 0; will toggle cheats on/off and drops a can of whoop ass where you are pointing.
  • You can store your commands in a "myCommands.cfg" file you create in a text editor like "Notepad" (personally I recommend Notepad++ but the XKCD comic reveals the ultimate tool) and put it in C:\Program Files\Steam\steamapps\common\left 4 dead\left4dead\cfg. It will get executed when your server runs. You can also execute a particular config file, e.g., "die.cfg", by using "exec die.cfg" in the console.

[edit] Spawn Infected

These commands can be used to drop (spawn) in additional enemies.

z_spawn tank 
z_spawn witch
z_spawn boomer
z_spawn smoker
z_spawn hunter
z_spawn common also z_spawn (Unknown) e.g. z_spawn aj will spawn one infected
z_spawn mob (NOTE: these "mobs" last a ''lot'' longer than the usual horde)

To remove (unspawn) special, use the kick command:

kick tank
kick witch
kick boomer
kick smoker
kick hunter

To bind multiple kicks to a key, it is safer to use the wait; command in between the kick commands.
i.e.

bind "K" "kick tank;wait;kick witch;wait;kick boomer;wait;kick smoker;wait;kick hunter"

[edit] Guns R' Us

Press: "give[space]" in the console, and then the item names will appear.

give autoshotgun
give hunting_rifle
give health
give rifle
give pistol
give smg
give shotgun
give pain_pills
give first_aid_kit
give pipe_bomb
give molotov
give propane_tank
give gascan

[edit] Drops

Need to drop a pipe bomb or molotov instantly, damn the consequences? This will throw an armed pipebomb or molotov at your feet. You might want to be running when you try these.

fire // will drop a molotov in the center of the character lighting you on fire
boom // will drop a pipebomb in the center of the character ready to explode

[edit] How many zombies would you like, sir?

By default, the game limits how many zombies are drawn at any given time. You can bypass this limit to get truly outrageous numbers of zombies and also make you crash.

z_common_limit 30
Now how can we get the director to give us more mobs of zombies at random times?
z_mob_spawn_min_interval_expert 90
z_mob_spawn_max_interval_expert 180
z_mob_spawn_min_size 10
z_mob_spawn_max_size 30
Still not hard enough... perhaps you need a MEGA MOB!
z_mega_mob_spawn_min_interval 420
z_mega_mob_spawn_max_interval 900
z_mega_mob_size 50

All good and fine, but what about those spaced out zombies that are just standing still waiting for you to shoot them? Would it not be more awesome if they were always moving and instantly targeted you?

z_must_wander 0
z_acquire_far_range 2500
z_acquire_far_time 5
z_acquire_near_range 200
z_acquire_near_time 0.5

Okay, if you got this far, you're going to need more boss zombies. This controls time in seconds between boss spawns and the max number of bosses that can be spawned at any given time:

z_special_spawn_interval 45
z_exploding_limit 1
z_gas_limit 1
z_hunter_limit 1
z_minion_limit 3 // This limits the number of 1 type of special infected
                    allowed at one time, In certain cases you would get
                    3 hunters this will make sure you do not get 4 so in
                    places like Versus you will not be overrun by smokers
                    / hunters / boomers.

That's still not enough zombies? Well then, time to panic (AKA: mega mob on demand)!

director_force_panic_event

Oh no, you're still alive? Okay try this:

director_panic_forever 1

But if you like beating the crap out of every single one, try this:

STEP 1:
z_common_limit 400
z_special_spawn_interval 45
z_exploding_limit 1
z_gas_limit 1
z_hunter_limit 1
z_minion_limit 9
z_spawn mob
z_spawn tank     (you will be overrun with lots of infected if you try this)

[edit] No more rescues

Don't like the fact that dead isn't dead? Fix it! The variable "rescue_distance" controls how far your teammates must get beyond your dead corpse before you can be rescued. Set to 1 light-year to preclude that ever happening. The second variable, "rescue_min_dead_time", controls how many seconds must elapse after death before you come up for reincarnation. Set to a few centuries (that would be 6294240000 seconds) to preclude that possibility.

rescue_distance 4500
rescue_min_dead_time 60

[edit] Bite me

What if infected could kill you with one bite?

hunter_pz_claw_dmg 10 
z_pounce_damage 5 // There's a delay of 1 second where a teammate
                     can knock it off and you don't take this damage
tongue_choke_damage_amount 10
z_hit_from_behind_factor 0.5 // If a zombie hits you in the back,
                                multiplies the damage done
z_witch_damage 100

Environmental and unknown damage modifiers:

inferno_damage 40 // Damage per second when getting flamed
survivor_extra_damage_ammo_factor 1.25  // Appears to multiply the overall amount of
                                           friendly fire damage. At zero it does no
                                           damage even on expert though a decimal with
                                           many places will still do a good chunk with
                                           the auto shotgun. Does not appear to change
                                           damage on infected at all. TODO: test this
                                           more
z_gun_damage 10 // Melee damage done to doors, boxes, and the like, but not infected

[edit] Walk or sprint?

Don't like the fact that you have a walk key instead of a sprint key? Set this variable to something ludicrous like 5,000...

survivor_walk_speed 85 // For reference base movement speed is 210 and base zombie speed is 250

Still not fast enough? Use the following to get in and out of the action at faster than light speeds. REQUIRED: you must be game host

warp_all_survivors_here   // Warp all survivors to the player's cursor
warp_all_survivors_to_battlefield // Warp all Survivors to the battlefield
warp_all_survivors_to_checkpoint // Warp all Survivors to the exit checkpoint
warp_all_survivors_to_finale // Warp all Survivors to the finale radio
warp_far_survivor_here // Teleport the farthest away Survivor to your cursor position
warp_to_start_area // Warp yourself to a survivor spawn area

[edit] Versus Mode for the Man With No Friends

Well, maybe "no friends" is a bit drastic, but this will help you when you NEED some versus and have no one to play with.

sv_cheats 1
sb_all_bot_team 1
sb_unstick 0 (stops bots teleporting)
vs_max_team_switches 99
chooseteam (or use "M" or whatever key you have assigned to team change)
mp_gamemode versus

Do note that the computer A.I. players will walk through the stage well enough, but may get hung up when it comes to pushing certain buttons or leaving certain areas. Simply switch teams again, accomplish the goal, and switch back.

NOTE:this cheat will never work anymore valve made a new cheat for this!... but if you haven't updated past 1.0.1.2 this will work how then???

[edit] Pitch Black Mode

Disable the white background fog, to play the game without the unrealistic lighting effect. This was the original way the game was designed per the dev team: "Left 4 Dead takes place in a variety of dimly lit nighttime environments. Because of this, playtesters weren't able to see zombie silhouettes in the midground and background. Because of this, they were repeatedly getting mobbed. While sudden zombie attacks were unarguably scary, they were also frustrating—players weren't being given the information they needed to react. They wanted that "Here they come!" moment, and we weren't giving it to them. The solution? Light-colored fog. While not as realistic-looking as actual fog in some settings, it meant playtesters could see attackers in the distance. Once they were able to anticipate attacks, playtesters started to have a much better time."

sv_cheats 1 
fog_override 1 
fog_enable 0

[edit] Change Player Name

This allows a player to change their game name from their steam name

name [name you want]

[edit] God Mode

After enabling cheats, God Mode can be set by entering "God 1". It can be turned off by entering "God 0" into the console. Once set to "God 1" God Mode allows your player to take no damage from infected, falling, etc..

[edit] Kill

Do you want to end your cruel life? Just type "kill" in the console and you will die instantly. Is there a player that's being a pain in the ass? Then type "kill [player's name]". But it has to match the player's/NPC's name's case; so, to kill Bill, type "kill Bill". A side note is that you do not need to type the whole name; to kill Louis, for instance, you can simply type "kill L" and your work is done. This won't work if someone else has L at the beginning of their name, so just keep going until the name string is unique.

[edit] Respawn

Type "respawn" if you want to live again.

[edit] Third-person

Tired of first person view? Want to get a better look on that scratch on the back of Bill's shirt? Or maybe you just like staring at Zoey. Type in "thirdperson" or if you like it like Gears of War or Resident Evil type in "thirdpersonshoulder" to get a view from your shoulder.

 firstperson
 thirdperson
 thirdpersonshoulder

[edit] Items

To visually see all items that spawned, and that could possible spawn in the map, use

 director_debug_scavange_items 1

[edit] General AI status

To see the general status of the AI Manager (Director), use:

 director_debug 1
"Ain't seen anything like this before..."
This article contains new or upcoming content, and therefore may be incorrect and will change from time to time.


[edit] Left 4 Dead 2 Commands

All of the original Left 4 Dead codes work in the Left 4 Dead 2 console as well, but there are some extras that are unique to Left 4 Dead 2. If you use the command z_spawn mob in Left 4 Dead 2, some of the uncommon infected that appear in that level will be mixed in with the regular common infected. The new weapons in Left 4 Dead 2 can be acquired using the following commands.

Weapons As all of the original Left 4 Dead weapons appear in Left 4 Dead 2, you can spawn all of them (save for the pistol from Left 4 Dead)

 give weapon_grenade_launcher // some people may have to rely on ent_create weapon_grenade_launcher
 give rifle_desert (Gives the Combat Rifle)
 give rifle_ak47
 give pistol_magnum
 give shotgun_chrome
 give shotgun_spas
 give sniper_military
 give smg_silenced
 give vomitjar (Bile bomb)
 give defibrillator
 give electric_guitar
 give machete
 give frying_pan
 give katana
 

(Note: as of the release of the demo, the grenade launcher is incomplete, thus it is black and purple striped, and instead of firing a grenade it fires a giant "ERROR" text, but it still functions correctly)

You can also use the console to give your weapon any of the three upgrades in Left 4 Dead 2.

upgrade_add LASER_SIGHT
upgrade_add explosive_ammo
upgrade_add INCENDIARY_AMMO

The explosive ammo can be modified with the following commands. Setting one of the force commands too high will result in the game crashing.

upgrade_explosive_bullet_force (explosive force for all weapons other than shotguns)
upgrade_explosive_slug_force (explosive force for shotguns)
upgrade_show_explosive_ammo_radius (changing to 1 causes a sphere to be shown whenever and explosive shot is fired, depicting it's effective area)

The special infected new to Left 4 Dead 2 can also be spawned

z_spawn spitter
z_spawn jockey
z_spawn charger

[edit] Complete list of commands

See: Complete list of console commands

Also don't forget "bind" use this to make madness such as:
bind "g" "z_spawn tank"
With this, every time you press "G," you will spawn a tank.