Zombie Panic! Source mapping guide - Part 1
Mapping for ZPS is much like mapping for HL2 Deathmatch - brushwork, prop placement, everything looks the same. There are 2 main differences that you need to know and get familiar with. First of them is lobby system, the second one is random item placement. Without further ado, let's start:
At the beginning of round everyone spawns in the lobby. Lobby is a place where players can join teams by walking into triggers. You can design the place as you wish, it can be anything. Lobby has to be built outside the normal map, otherwise it may cause errors and players getting killed in the lobby. Now let me explain custom entities related to lobbys:
# info_player_commons - This is the entity that determines where players spawn in the lobby. You should have atleast 32 of those in your map so players will not spawn on each other on crowded servers. Do NOT place this entity outside the lobby.
# info_player_human - This is the entity that determines where players spawn after joining the humans team. You should have atleast 32 of those in your map so players will not spawn on each other on crowded servers. Do NOT place this entity inside the lobby.
# info_player_zombie - This is the entity that determines where players spawn after joining the zombies team. You should have atleast 4 (but this is the real MINIMUM!) of those in your map. Amount of zombies spawned at the beginning is dynamically adjusted to the amount of players. Below is a list explaining how many zombies are spawned:
From 2 to 8 players - 1 zombie
From 9 to 16 players - 2 zombies
From 17 to 24 players - 3 zombies
From 25 to 32 players - 4 zombies
Do NOT place this entity inside the lobby.
# info_player_observer - This is the entity that determines where players spawn after joining spectators team.
When you are done with setting up player spawns, you need to set up proper team triggers in the lobby. Let me explain the triggers first:
# trigger_joinhumanteam - Player joins the humans team after touching the brush tied to this entity.
# trigger_joinzombieteam - Player joins the zombies team after touching the brush tied to this entity.
# trigger_joinspectatorteam - Player joins the spectators team after touching the brush tied to this entity.
Here is how a proper lobby should look like (you can download source of this map at the bottom of this tutorial):
NOTE: You will get error that there is no player start (Map > Check for problems) - It is because the engine does not recognize info_player_commons as player spawn entity. Just ignore that error.
Random item placement:
Okay, things get a bit more complicated here. You can place weapons in the old way, just by placing weapon_ak47, weapon_glock etc. on your map or use our random item placement system. First, you need to get familiar with list of ZPS items:
Blue - Melee weapon
Red - Firearm
Green - Item
The items above are all self-expleanatory. Now let me explain random placement entities. They can be placed in the map just like all other item entities(weapon_glock, item_battery etc.), the difference is that those entities will randomly spawn one of the items every round. They can be limited and defined but I will tell you about those entities later.
# random_any - Spawns random item from 1 to 34.
# random_weapon - Spawns random item from 1 to 27.
# random_firearm - Spawns random item from 18 to 27.
# random_rifle - Spawns random item from 22 to 23.
# random_shotrev - Spawns random item from 24 to 26.
# random_pistol - Spawns random item from 18 to 21.
# random_melee - Spawns random item from 1 to 17.
# random_ammo - Spawns random item from 28 to 31.
# random_misc - Spawns random item from 32 to 34.
Okay, so you have your random items, but what if you dont want to spawn more than 2 ak's and 1 glock? This is where random_def comes in. Place that entity anywhere in your map, turn of smart edit and start defining! If you don't define a weapon in random_def then it can spawn unlimited number of times, if you define a weapon and set the value to 0 then the weapon will not spawn. Any other number will set the maximum amount of each weapons spawned. You need to add new values, for example:
Now lets talk about random placement. You can do that in two different ways. The first one is by using random_def. Here's simple example. Place 3 random_rifle entities on your map. Without defining anything, each weapon has no limit to the number of spawns it can have in the map and 3 random rifles would spawn. Now place random_def and define the following in the entity:
weapon_ak47 - 1
weapon_mp5 - 1
This creates counters for the ak47 and the mp5. As you can see, we defined all rifles avaible and set the values to 1 but we have 3 random_rifle entites! In this case only two weapons can spawn, one (randomly choosen) random_rifle entity will not spawn anything, because amount of avaible rifles reached 0.
The other way to have random placement is using random_limit. Using this entity you can limit how many random spawn entites will be activated. For example limit 2 random_rifle, 1 random_pistol and place more of those entities in your map. Only 2 random_rifle and 1 random_pistol entities will spawn a weapon, the rest will be empty. Here's how to limit them properly:
Note: Do not use random_limit to limit weapons, you do that with random_def entity.
random_def = limiting weapons and ammo (item_ammo_pistol, weapon_ak47 etc.)
random_limit = limiting spawn places (random_rifle, random_firearm etc.)
Combine both random_limit and random_def entities to get the best effect and feel of randomness on your map. Below you can download example map, with a lobby and random item placement system. Enjoy!
Tutorial Map download