Zh-tw/Your First Left 4 Dead Map
這個教程會教大家製作一個基本的Left 4 Dead地圖。教程會教大家如何使用一些在必需Left 4 Dead地圖上必要的Entity , 例如Director,生成可用的武器和生成喪屍等等。還解釋一些地圖製作者常犯的錯。
這個教程對象並不是入門級的地圖製作者,所以教程所用的技巧可能看不懂,建議先看Basic level construction。

這個教程會教大家製作一個一共包含兩個章地圖的戰役,但永遠玩不完,没有結局。Sounds fun, right? 這個教程目標不是完整的戰役,但會教大家如何製作一個基作的基本的L4D地圖。
首先,製作一個可玩的L4D地圖需要以下的東西:
- A director (導演)
- 生還者開始地點
- 兩道安全門
- 武器,彈藥和藥包
- 救出死去同伴的密室
- 轉換地圖
- 雾的控制器 (粒子效果需要)
以下教程會根據右面那張圖的布局。
還有的是Hammer並没有中文版,所以一些功能上的字眼仍然使用英文。
生還者開始地點
首先在上圖最左邊(區域紅色1)里面增加一個Entity名叫info_player_start
。之後,增加另外兩個Entity,info_director
和env_fog_controller
,這兩個Entity放在那裡都可以。為了方便,建議都放到區域1。
之後確保env_fog_controller
的「Properties」內,「Fog Enable」是「Yes」的。
在這里,我們可以新增加以下補給的Entity:
- 四個藥包,
weapon_first_aid_kit_spawn
- 兩支槍;
weapon_smg_spawn
和weapon_pumpshotgun_spawn
- 彈藥
weapon_ammo_spawn
開始地點需要一道安全門,新增一個Entity叫"prop_door_rotating_checkpoint
。在「Properties」里,更改名稱(Name)為「checkpoint_exit」,「Spawn Position」設定成「Closed」,「world model」設成「models/props_doors/checkpoint_door_01.mdl」和確定「Flag」內的「Starts Open」已經被選取。還有確保安全門上「EXIT」的標誌是向內的。
生還者開始地點大致上完成,最後增加一個Entity叫info_landmark
,並命名為「landmark_a」,之後會解釋為什麼。
救出死去同伴的密室
之後我們會製作兩個小密室(上圖區域2),救出死去同伴。在第一個小密室里,大家只需要增加四個Entity,包括三個info_survivor_rescue
和一個prop_door_rotating
。在第二個小密室里,同樣做法。
我們需要一道闊54個單位,高104個單位的門,所以prop_door_rotating
里的「world model」設成「models/props_doors/doormain01.mdl」。
安全室和轉換地圖
現在我們製作一個可以轉換到下一個地圖的安全室。安全室(區域3)門口位新增一個一道門prop_door_rotating_checkpoint
,這里與之前的安全門有少許不相同,開它的「Properties」,並把它命名為「checkpoint_entrance」,「world model」設成「models/props_doors/checkpoint_door_02.mdl」,亦都確保「Flag」內的「Starts Open」是選取了的。還有安全門上「小屋圖示」是向外的。
To finish setting up the transition from one map to the next we still need to add an info_landmark
and a trigger_changelevel
. First add the info_landmark
to the center of the room near the ceiling, then open it's properties and name it "landmark_2". Now create a large brush to cover the floorspace inside the safehouse and tie it to the trigger_changelevel
entity, make sure the brush comes in contact with the floorspace inside the room (doesn't necessarily have to overlap the floor space, but it does have to at least touch it). Open the changelevel's properties and set the landmark name to the one we just created, "landmark_b" and for the "next map" property, enter "lst_l4dmap_b".
For the survivor bots and infected to be able to move, you will need to create a navigation mesh ("mapname.nav" file) for your map. To build a basic mesh you need to have the map already compiled and loaded. Once the map is running, aim your crosshairs at the floor space, open up the console in game, and then type the following:
sv_cheats 1
nav_edit 1
nav_mark_walkable
nav_generate
The map will be reloaded after you type nav_generate, and if all goes well, we should no longer have the "NAV ERRORS - Map is unplayable!" message displayed on the screen when the map loads. This is because nav_generate assigned certain attributes to the nav mesh through a process known as "nav marking".
You can see the changes using the "select_with_attribute A" command. What this console command does is select all the nav areas that have been "marked" with the attribute "A". For instance, by using "select_with_attribute CHECKPOINT", all the nav areas that have been marked with the "CHECKPOINT" attribute would be highlighted.
With "nav_edit 1" set, you would open the console and type:
- select_with_attribute DOOR
- 4 nav squares should be highlighted telling the bot AI there is a door in these locations.
- select_with_attribute CHECKPOINT
- The nav areas in the safehouse at the end of the level should be highlighted.
- select_with_attribute RESCUE_CLOSET
- The two two rescue closets should have there nav squares highlighted
- select_with_attribute ESCAPE_ROUTE
- Now a lot of nav squares are highlighted forming a path from the player spawn to the nav areas marked "checkpoint" at the end of the level.
NAV Marking
In this case, nav_generate did a fairly good job at locating and assigning the final checkpoint, rescue closets, and other attributes to the nav mesh, but you may not always be so lucky. To manually assign attributes to nav squares, you will need use the MARK command via 'mark A', where A is the attribute you wish to mark the nav area with.
For example, before we can get our level working correctly, we will have to manually "mark" one additional location on the nav mesh that nav_generate missed, a starting checkpoint. To do this, we need to be in nav editing mode with:
sv_cheats 1 nav_edit 1
Now inside the starting safe room we will label one nav square at a time by pointing the targeting reticule at them then typing this into the console:
mark CHECKPOINT
Or, to speed things up, you can use the nav gui interface by opening up the console again and typing:
nav_gui
With the nav gui enabled, you can now left click multiple meshes, and use the mark CHECKPOINT
console command to set the attribute for all the selected areas.
If you make a mistake, you can remove a single attribute from a selected nav area by using:
nav_clear_attribute A
- where A is the attribute you wish to remove (eg:
nav_clear_attribute CHECKPOINT
)
- where A is the attribute you wish to remove (eg:
Or, if you wanted to remove all nav attributes from the selected area, you could use:
wipe_attributes
Once you have finished with nav marking, be sure to save the changes to your map with nav_save
, then re-analyze it with nav_analyze
Getting the infected to spawn
Now that the nav mesh is built, you should be able to get the infected to spawn by using the console commands:
director_stop
director_start
You should only have to do this once inside the map, then every time you load the map after that the director should start on it's own.
Making the second chapter
With the first map out of the way, the second map can be made quite easily. Back in Hammer, with the map we just compiled still loaded, go up to the file menu and choose "Save As". Now type in "lst_l4dmap_b" to save the current map under a new name. Go up to the exit menu and hit "Select all", hit CTRL and M to bring up the translation tool and type 180 into the Z field and hit "Ok".
Change the name of the info_landmark
entities so that the one in the starting room is named "landmark_b" and the one in the ending safehouse is named "landmark_a". Remember "landmark_a" we created in the first map? We're going to link the changelevel in our new map to it, open the trigger_changelevel's properties and replace "landmark_b" with "landmark_a" and "lst_l4dmap_b" with "lst_l4dmap_a". After changing up the names, finish up by compiling the map and repeating the nav creation steps you used for the previous map, don't forget to mark the spawn room with the checkpoint attribute. If all goes well, you should now have a working 2 level campaign.
Additional possibilities
For spawn areas in later chapters of the campaign, you do not have to keep using the weapon_smg_spawn
and weapon_pumpshotgun_spawn
you used in the first map as most players will likely have already swapped these for other more powerful weapons they've found along the way. These more powerful weapons you can use in the spawn areas for the later chapters will usually consist of:
- a
weapon_rifle_spawn
,weapon_autoshotgun_spawn
, and aweapon_hunting_rifle_spawn
.