Nav mode.cfg (L4D)

From Valve Developer Community
Jump to navigation Jump to search

Contents of the default configuration files included with the Left 4 Dead Authoring Tools.

General uses of nav_mode.cfg

Many developers agree that a nav mesh generated with nav_generate is only the beginning. A hand-edited mesh reduces nav mesh size, improves NPC behavior, and provides an opportunity for developers to take some creative control from the ai director. Learning the keys (and mouse buttons) bound to this script is extremely important in manual nav mesh editing. Most importantly, it saves time by reducing the number of visits to the console. These binds also allow developers to work in a more natural flow. This is especially true when maps have a lot fun terrain for players, survivor bots, and infected to navigate on.

Note.pngNote:Of course! You can create your own script or edit the default nav_mode.cfg to suit your needs.
Note.pngNote:Some commands are as shown in the official L4D level design tutorial. The actual commands bound to these keys can be found in the nav_mode.cfg.

Switching to Nav Edit Mode

First, nav_mode.cfg and game_mode.cfg (provided below) should be located in the <L4D2 or L4D2 Root>\cfg\ folder. The cfg folder is located where other directories like maps and sound are located.

Switch to 'Nav Edit Mode' by hitting Page Down on your keyboard. The console will also confirm that you are in Nav Edit Mode. Toggle back to 'Game Mode' by hitting the Page Down key once more.

Some bound commands

Nav selection

Keyboard Key Console Command Description
L nav_mark Marks the Area or Ladder under the cursor for manipulation by subsequent editing commands.
Z nav_toggle_in_selected_set Add or remove current area from the selected set.
G nav_clear_selected_set; nav_move_mode_off Clear the selected set; Turns off a series of settings that allow nav areas to be moved.
H nav_flood_select Marks the Area or Ladder under the cursor for manipulation by subsequent editing commands.
I nav_place_floodfill Selects the current Area and all Areas connected to it, recursively. To clear a selection, use this command again.

Automatic nav generation

Spawning and controlling Surivor Bots

Add and moving Infected

Editing Areas

Setting (common) nav area attributes

Moving nav

Connecting and disconnecting nav areas

Two-way connection: Select two horizontally adjacent nav areas with Z and press the Middle Mouse Button.

One-way connection: Select the starting nav area with Z and connect the ending nav area with Middle Mouse Button. This is different from creating a two-way connection by merely selecting only one nav area instead of two before creating a connection.

Ladder building

Simply start out by pointing at a func_ladder that you created in your map. The five-pointed cursor will change color from white to green. That means that you are pointing at a ladder. Build by pressing P on the keyboard.

It may be necessary to manually create connections between the ladder and nav areas on the top and bottom of the ladder. This can be done by marking the ladder with L, selecting a nav area with Z, and connecting the two with Middle Mouse Button. This creates a two-way connection. A one-way connection can be created by marking the starting nav area, L, and connecting the end nav area with Middle Mouse Button.

The ladder will require a full nav_analyze in order to be fully functional. You will notice a green box surrounding the entire func_ladder once nav_analyze is done.

Splitting

Merging

Splicing

Raising a nav area

Raising a nav area corner

nav_mode.cfg

steamapps\common\left 4 dead\left4dead\cfg\nav_mode.cfg :

echo "--------------------------"
echo "- Entering Nav Edit Mode -"
echo "--------------------------"

// Save user's current game bindings
host_writeconfig game_user_cmds.cfg

// Settings for Nav Editing mode
sv_cheats 1
director_stop
nav_edit 1
z_debug 1
sb_perf_collect 0
changelevel_inhibit 1

// Toggle out of nav editing
bind "PGDN" "sv_cheats 1; director_start; nav_edit 0; z_debug 0; sb_perf_collect 1; changelevel_inhibit 0; nav_move_mode_off_silent; exec game_mode"

// Basic game and movement control defaults
bind "w" "+forward"
bind "s" "+back"
bind "a" "+moveleft"
bind "d" "+moveright"
bind "e" "+use"
bind "f" "impulse 100"
bind "SPACE" "+jump"
bind "MOUSE3" "+zoom"
bind "CTRL" "+duck"
bind "MWHEELUP" "invprev"
bind "MWHEELDOWN" "invnext"

bind "n" "noclip"

// High level nav commands
bind "," "incrementvar nav_edit 0 1 -1"
bind "TAB" "nav_save"

// Toggle the Director
alias director_start_toggle "echo Director Start; director_start; bind F3 director_stop_toggle"
alias director_stop_toggle "echo Director Stop; director_stop; bind F3 director_start_toggle"
bind "F3" "director_stop_toggle"

// Display settings
bind "]" "incrementvar mat_wireframe 0 2 1"
bind "\" "incrementvar vcollide_wireframe 0 1 1"
bind "." "incrementvar z_debug 0 2 -1"

// Automatic nav generation
bind "b" "nav_generate_incremental"
bind "m" "nav_mark_walkable"
bind "v" "incrementvar nav_generate_incremental_range 512 2048 512"

// Nav selection
bind "l" "nav_mark"
bind "z" "nav_toggle_in_selected_set"
bind "g" "nav_clear_selected_set; nav_move_mode_off"
bind "h" "nav_flood_select"
bind "i" "nav_place_floodfill"

// Alias for Incapping yourself
alias incapped "god 0; incap"

// Spawning and controlling Survivor Bots
alias "respawn_bots" "sb_add; sb_add; sb_add; wait; wait; wait; wait; wait; wait; bot_mimic 1; wait; wait; wait; respawn; wait; wait; wait; bot_mimic 0;"
alias "respawn_bot" "sb_add; wait; wait; wait; wait; wait; wait; bot_mimic 1; wait; wait; wait; respawn; wait; wait; wait; bot_mimic 0;"
bind "KP_INS" "warp_far_survivor_here"
bind "KP_DEL" "respawn_bot"
bind "'" "warp_all_survivors_here"
bind "r" "incrementvar sb_follow_human 0 1 -1"

// Add and moving Infected
bind "1" "z_spawn"
bind "2" "nb_delete_all"
bind "3" "nb_move_to_cursor"
bind "q" "nb_delete_all infected"
bind "KP_SLASH" "nb_delete_all infected"
bind "F8" "nb_move_to_cursor"
bind "KP_PGUP" "z_spawn tank"

// Editing areas
bind "MOUSE1" "nav_begin_area"
bind "MOUSE2" "nav_end_area"
bind "INS" "nav_split"
bind "c" "nav_split"
bind "DEL" "nav_delete"
bind "END" "nav_connect"
bind "HOME" "nav_disconnect"
bind "MOUSE3" "nav_connect"
bind "MOUSE5" "nav_disconnect"
bind "o" "nav_splice"
bind "KP_ENTER" "nav_merge"
bind "p" "nav_build_ladder"
bind "F6" "nav_gui"
bind "F7" "nav_simplify_selected"
bind "F9" "incrementvar nav_snap_to_grid 0 2 1"
bind "F12" "nav_flood_select; nav_toggle_selected_set"
bind "PGUP" "nav_trouble_report"
// bind "" "nav_recompute_flow"

// Setting nav area attributes
bind "u" "mark OBSCURED"
bind "y" "mark BATTLEFIELD"
bind "4" "mark BATTLESTATION"
bind "5" "mark PLAYER_START"
bind "6" "mark CHECKPOINT"
bind "7" "mark FINALE"
bind "8" "mark NO_MOBS"
bind "9" "mark EMPTY"

// Moving nav
bind "KP_PLUS" "nav_corner_raise"
bind "KP_MINUS" "nav_corner_lower"
bind "F1" "nav_corner_place_on_ground 5"
bind "F2" "nav_corner_place_on_ground"

// Vertical nav movement with mousewheel
alias nav_move_mode_setonkey "bind KP_5 nav_move_mode_on"
alias nav_move_mode_setoffkey "bind KP_5 nav_move_mode_off"

alias nav_move_mode_on "echo ENABLE MOUSEWHEEL MOVE MODE; bind MWHEELUP nav_corner_raise; bind MWHEELDOWN nav_corner_lower; nav_move_mode_setoffkey"
alias nav_move_mode_off_silent "bind MWHEELUP invprev; bind MWHEELDOWN invnext; nav_move_mode_setonkey"
alias nav_move_mode_off "echo DISABLE MOUSEWHEEL MOVE MODE; nav_move_mode_off_silent"

nav_move_mode_off_silent

// Miscellaneous
bind "F4" "incrementvar host_timescale 1 5 1"
bind "F5" "jpeg"
bind "F10" "incrementvar nb_blind 0 1 1"

game_mode.cfg

steamapps\common\left 4 dead\left4dead\cfg\game_mode.cfg :

// Custom configuration file used to switch between navigation mesh editing mode and game mode.
// This file is used in game mode.

echo "---------------------------"
echo "- Entering Game Play Mode -"
echo "---------------------------"

// empty current bindings
unbindall

// load a default set of game commands
bind "1" "slot1"
bind "2" "slot2"
bind "3" "slot3"
bind "4" "slot4"
bind "5" "slot5"
bind "a" "+moveleft"
bind "c" "+voicerecord"
bind "d" "+moveright"
bind "e" "+use"
bind "f" "impulse 100"
bind "h" "motd"
bind "m" "chooseteam"
bind "q" "lastinv"
bind "r" "+reload"
bind "s" "+back"
bind "t" "impulse 201"
bind "u" "messagemode2"
bind "w" "+forward"
bind "x" "+mouse_menu QA"
bind "y" "messagemode"
bind "z" "+mouse_menu Orders"
bind "`" "toggleconsole"
bind "SPACE" "+jump"
bind "TAB" "+showscores"
bind "ESCAPE" "cancelselect"
bind "SHIFT" "+speed"
bind "CTRL" "+duck"
bind "F1" "Vote Yes"
bind "F2" "Vote No"
bind "F5" "jpeg"
bind "MOUSE1" "+attack"
bind "MOUSE2" "+attack2"
bind "MOUSE3" "+zoom"
bind "MWHEELUP" "invprev"
bind "MWHEELDOWN" "invnext"

// load the user's game commands
// replaces any of the above commands if the user had already set them.
exec game_user_cmds.cfg

// bind a key to nav_mode - change as desired
bind "PGDN" "exec nav_mode"

// Dev commands - unncomment and bind as desired.

//bind "n" "noclip"
//bind "]" "incrementvar mat_wireframe 0 2 1"
//bind "\" "incrementvar vcollide_wireframe 0 1 1"
//bind "F3" "director_stop"
//bind "F4" "incrementvar host_timescale 1 5 1"
//bind "F10" "incrementvar nb_blind 0 1 1"
//bind "F11" "survivor_no_pounce_or_hang 1; god 1; director_ready_duration 0"
//bind "KP_SLASH" "nb_delete_all infected"

See also