nav_mode.cfg (L4D)

From Valve Developer Community
Jump to: navigation, search

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

Introduction

nav_mode.cfg and game_mode.cfg are scripts that provide keyboard shortcuts for essential nav mesh editing commands. Simply place these as text files in the cfg folder. game_mode.cfg does not necessarily contain any nav editing commands, but is used to restore original key bindings when nav mode is turned off. Additionally:

  • You can create your own script or edit the default nav_mode.cfg and game_mode.cfg to suit your needs.
  • Many of these key bindings and commands are used in the official L4D level design tutorial. Further explanations and uses can be found below.

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"

Some bound commands in nav_mode.cfg

Keyboard Key Console Command Description
Tab nav_save Saves the current Navigation Mesh to disk. Does not mean it is analyzed yet, just saved. Save often!
N noclip Toggle. Player becomes non-solid and flies. Optional argument of 0 or 1 to force enable/disable
F3 aliases director_stop_toggle and director_start_toggle Toggle the director
] mat_wireframe 0 2 1 Displays environment as wireframes. Great for performance debugging.
\ vcollide_wireframe 0 1 1 Render physics collision models in wireframe.
. (not the one in keypad) z_debug 0 2 -1 Displays labels of each area in the map.

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 Selects the current Area and all Areas connected to it, recursively. To clear a selection, use this command again.
I nav_place_floodfill Sets the Place of the Area under the cursor to the curent Place, and 'flood-fills' the Place to all adjacent Areas. Flood-filling stops when it hits an Area with the same Place, or a different Place than that of the initial Area.

Automatic nav generation

Keyboard Key Console Command Description
B nav_generate_incremental Generate a Navigation Mesh for the current map and save it to disk. Area must first be marked. Creates within range set by nav_generate_incremental_range or within a mark area that is completely surrounded by nav areas.
M nav_mark_walkable Mark the current location as a walkable position. These positions are used as seed locations when sampling the map to generate a Navigation Mesh.
V nav_generate_incremental_range 512 2048 512 Incrementally increase the range with the set values shown above.

Spawning and controlling Survivor Bots

Keyboard Key Console Command Description
Keypad INS warp_far_survivor_here Teleport the farthest away Survivor to your cursor position
Keypad DEL alias respawn_bot Respawn the survivor bots near the player.
' warp_all_survivors_here Warp all survivors to the player's cursor.

Add and moving Infected

Keyboard Key Console Command Description
1 z_spawn Spawns a common infected.
2 nb_delete_all Delete all non-player NextBot entities.
3 nb_move_to_cursor Tell all NextBots to move to the cursor position.
Q nb_delete_all infected Remove all spawned infected.
Keypad / nb_delete_all infected Remove all spawned infected.
F8 nb_move_to_cursor Tell all NextBots to move to the cursor position.
Keypad PGUP z_spawn tank Spawn a tank.

Editing Areas

Keyboard Key Console Command Description
LEFT MOUSE BUTTON nav_begin_area Defines a corner of a new Area or Ladder. To complete the Area or Ladder, drag the opposite corner to the desired location and issue a 'nav_end_area' command. Cancel by clicking LEFT MOUSE BUTTON again.
RIGHT MOUSE BUTTON nav_end_area Defines the second corner of a new Area or Ladder and creates it.
INS nav_split To split an Area into two, align the split line using your cursor and invoke the split command.
C nav_split To split an Area into two, align the split line using your cursor and invoke the split command.
DEL nav_delete Deletes the currently highlighted Area.
HOME nav_disconnect To disconnect two Areas, mark an Area, highlight a second Area, then invoke the disconnect command. This will remove all connections between the two Areas.
MIDDLE MOUSE BUTTON mark nav_connect To connect two Areas, mark the first Area, highlight the second Area, then invoke the connect command. Note that this creates a ONE-WAY connection from the first to the second Area. To make a two-way connection, also connect the second area to the first.
MOUSE BUTTON 5 nav_disconnect To disconnect two Areas, mark an Area, highlight a second Area, then invoke the disconnect command. This will remove all connections between the two Areas.
O nav_splice To splice, mark an area, highlight a second area, then invoke the splice command to create a new, connected area between them.
Keypad ENTER nav_merge To merge two Areas into one, mark the first Area, highlight the second by pointing your cursor at it, and invoke the merge command.
P nav_build_ladder Attempts to build a nav ladder on the climbable surface under the cursor.
F6 nav_gui Opens the nav editing GUI.
F7 nav_simplify_selected Chops all selected areas into their component 1x1 areas and re-merges them together into larger areas. Save (Tab ) before trying this!
F9 nav_snap_to_grid 0 2 1 Snap to the nav generation grid when creating new nav areas.
F12 nav_flood_select; nav_toggle_selected_set Selects the current Area and all Areas connected to it, recursively. To clear a selection, use this command again; Toggles all areas into/out of the selected set.
PGUP nav_trouble_report Selects areas that may be breaking the map checklist for inspection.

Setting (common) nav area attributes

Keyboard Key Console Command Description
U mark OBSCURED Indicates area is assumed not viewable by survivors.
Y mark BATTLEFIELD Designates a region where a planned crescendo event will play out.
4 mark BATTLESTATION Indicates a strong defensive area that contains supplies/weapons for use during a panic event.
5 mark PLAYER_START This attribute is used in the exact nav mesh area(s) that the players spawn in.
6 mark CHECKPOINT Designates the start/safe-room areas of the map.
7 mark FINALE Indicates a finale area, and controls the spawning of ALL infected during a Finale Sequence.
8 mark NO_MOBS Prevents infected mobs from spawning in this location.
9 mark EMPTY Prevents wandering infected from being populated in this location, especially when survivors are in that area.

Moving nav

Keyboard Key Console Command Description
Keypad + nav_corner_raise Raise the selected corner of the currently marked Area.
Keypad - nav_corner_lower Lower the selected corner of the currently marked Area.
F1 nav_corner_place_on_ground 5 Places the selected corner of the currently marked Area on the ground. To do: Above by five units?
F2 nav_corner_place_on_ground Places the selected corner of the currently marked Area on the ground.
Keypad 5 Various aliases. Allows vertical movement of selected nav areas with mousewheel.

General uses of nav_mode.cfg

Switching to Nav Edit Mode

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

Open the game and load a map with console command map <map name> coop. 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.

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

Hit Keypad 5 to enable vertical nav movement with mouse wheel. Then select a nav area that you want to move. The selected nav area can be moved up and down with your mouse wheel.

Raising a nav area corner

The nav area has to be marked with the L key. Corners are toggled with nav_corner_select. The command is not bound in the default nav_mode.cfg, so this command, by default, needs entered manually into the console. Each time nav_corner_select is done, the square box on the corners of the nav area will toggle to the next corner in a counter-clockwise fashion. Select the corner of your choosing and raise the corner with Keypad + and Keypad - to raise and lower the selected corner of the marked nav area, respectively.

The Nav GUI

To do: Add instructions on splitting, merging, and splicing. Might not be necessary do, but will do it anyway. Also, need to understand Nav GUI and describe

See also

External Links

  • Nav Meshes - A User-Made Tutorial on Counter-Strike: Source Nav Meshes (Certain commands not included.)