# L4D关卡制作/NAV编译

## Create tutorial04.vmf and compile

In Hammer, open the map file tutorial03.vmf that you created in the previous tutorial (if it's not already open). This should be located in the tutorial mapsrc folder, by default:

C:\Program Files\Steam\steamapps\common\left 4 dead\sdk_content\mapsrc\


Now we'll make a new version to work with and compile it:

• Go to File menu and choose Save As...
• Change the name to tutorial04.vmf.
• Press F9 to open the Run Map dialog and click on the OK button to compile it.

## 准备工作

1. 进入游戏后，我们会看到一个“ 地图无法进行（MAP IS UNPLAY） ”对话框，因为我们还没有编译NAV。 按“继续”按钮来关闭该对话框。
2. 打开你的控制台 
3. 在控制台输入“director_stop”并按下 Enter 键，这样导演系统将不会再产生丧尸。
4. 再输入“nb_delete_all”</code> 并且再次按下 Enter，这将会删除所有电脑幸存者和丧尸，防止它们打扰你。
5. 再输入“nav_edit 1” 并且再次按下 Enter，这将进入NAV编辑模式
6. 最后关闭控制台.

## 创建新的NAV网络

Note:如果你的地图大的话，你需要多使用几次nav_mark_walkable命令。每次只创建一个金字塔，分析成为导航网络后再创建新的以保持导航网格不会发生错误。
Tip:在输入nav_generate_incremental命令后，系统会分析并产生导航网络。如果你想保存的话，在控制台输入 "nav_save" 以保存你的NAV导航网络。

## NAV选择

• 如果你想取消选择所有被选中的导航网格在控制台输入 “nav_clear_selected_set”。
• 要选择或取消选择一个导航网格，将鼠标对准那个导航网格，并在控制台输入“nav_toggle_in_selected_set”。

## Nav命令绑定

bind PGDN "exec nav_mode"


### 绑定常用命令

bind <键> "要绑定的命令"


bind z "nav_toggle_in_selected_set"


• 更多绑定命令，请看 Bind.
Note:从现在开始，本教程将默认使用 nav_mode.cfg，虽然现在里面只绑定了一个键。 如果你使用了不同的绑定按键，你必须记住。

## 拆分导航网格

In the included nav_mode.cfg file, nav_split is bound to the Insert key.

## 添加属性

{{tip|提示：如果你想删除一个导航网格的属性，然后输入“ clear_attribute <需要删除的属性> “，并按下回车键。例如： “clear_attribute PLAYER_START”。这样被选定的导航网格不再拥有PLAYER_START属性。

Note:注意：它不会阻止丧尸之后在幸存者离开之后在这里出生。如果需要添加属性“NO_MOBS”，丧尸将永远无法从这里重生。

## 分析NAV

1.有标记了“ mark FINALE “的最终区域。（安全室区域）

2.有标记了“ mark PLAYER_START “的幸存者出生地。

3.确保标记了“mark PLAYER_START“间接地连接到标记了“mark FINALE”的最终区域，也就是有连在一起的导航网格或导航线。

4.确保每一个导航网格都连接到

## Drawing your own Nav areas

Sometimes the nav_generate_incremental leaves out areas that you want to have nav on. In these cases, you will need to draw your own nav area.

Drawing nav areas is done with 2 keys. One key is bound to "nav_begin_area" and other bound to "nav_end_area". The nav.cfg file has nav_begin_area bound to the left mouse button and "nav_end_area" bound to the right mouse button.

Point to the area you want to create an area and click the left mouse button. As you move the mouse around, you can see where the nav area will draw until you press the right mouse button to end drawing and create the area.

Drawing a nav area.

Click the right mouse to activate nav_end_area and see the result.

Note:Creating your own nav areas will not automatically connect them to the rest of the nav mesh. Use nav_connect to connect them to adjacent areas.
Tip:If you accidentally press the left mouse button when you don't want to draw a nav area, just press the left mouse button again and it will cancel the nav creation.

### Grid snapping when drawing nav

You might notice that the cursor doesn't snap to a grid when you're in this mode. You can set the snapping properties using "nav_snap_to_grid" in the console.

Tip:In the nav.cfg, the F9 key is bound to "incrementvar nav_snap_to_grid 0 2 1". This will change the grid size when you press the bound key and continue to toggle through the sizes each time you press the F9 key.

It is also possible to draw a ladder using nav_begin_area and nav_end area. Simply point at a corner of the ladder and move the cursor vertically to go to the opposite corner.