Skip to end of metadata
Go to start of metadata

What are zones? Why do I need them?

Zones are used to divide your map into "areas" or "sections". Each section has one or more zombie spawn locations which are activated when players are standing within the zone, and deactivated when no players are present. At least one zone is required in order for zombies to spawn on a map which runs the latest Mod Tools scripts (v1.4).

What are "adjacent" zones?

Adjacent zones are exactly what the name implies. They are zones which are directly adjacent to (or "neighboring", "bordering") another zone. The game uses adjacent zones to activate nearby zones to the players to give the illusion that zombies are "coming from all directions". It makes it harder for the players to escape an oncoming wave of zombies.

Aerial view of zones on UGX Comosea

How to set up Zones

Volumes

To create a zone volume in Radiant, right-click the 2d view and from the Info menu, click Volume. This will create a brush with the "Volume Texture" on it. You must create volumes this way. You cannot just draw a normal brush and then apply the Volume tool-texture to it.

Stretch the brush to cover a section of your map. You want each zone to represent an area which has been sectioned off by buy-able barriers/debris.

Warning

Make sure you cover ALL playable area with zones volumes. If a player steps outside of a zone at any time, the game will freeze for a few seconds and zombies will not be able to find the player.

In order to accurately cover an area with a zone volume, you may need to use multiple brushes (see Fig. 1). This is OK as long as you give the additional zone pieces the same KVPs.

Setting the KVP's

NOTE: KVP is an abbreviation for "Key-Value Pair". When entering a KVP in the Radiant Entity Window, ensure that you have the entity selected first. If you do not have an entity selected, Radiant will automatically add the KVP to the "worldspawn" entity. This is BAD and will likely cause your map to crash while loading! In these pages, KVP's are referred to in this format: Key | Value. Note they are separated by a pipe ( | ) character. This character should be ignored when entering the Key-Value Pair.
To properly add a KVP to an entity:

  • Select the entity by holding the Shift key on your keyboard followed by clicking the entity(ies) that you wish to add a KVP to.
  • Enter the first value (this is the Key) into the text field labeled "Key"
  • Enter the second value (this is the Value) into the text field labaled "Value".
  • Press the Enter key on your keyboard to save the KVP to the entity. You should see the KVP appear in the entity's KVP table (located above the Key text field).

Select the zone volume(s) and give them the following KVP's:

Key

Value

targetname

<zone_name>

target

<zone_name>_spawners

  • Replace <zone_name> with a name for the zone. Remember the names you give these zones because you will need to recall them later.
  • Make sure to append "_spawners" to the zone name when entering the target value - this will tell the zone which zombie spawners it will activate.

    Note: Each area should have its own unique name to prevent conflict with other areas you have created. Your names can be as simple as "zone1", "zone2", etc, or you can name them specifically like "twostory_house_2nd_floor".

Spawners

Each zone's purpose is to activate/deactive the zombie spawners it is linked to. In order for this to work properly you must correctly link your zombie & dog spawners to your zones.

For more info on how to create a zombie or dog spawner, see Creating Zombie and Dog Spawners

Select the spawners which you want to link to a zone. Give them the following KVP:
Select the zone volume(s) and give them the following KVP's:

Key

Value

targetname

<zone_name>_spawners

  • Replace <zone_name> with the zone name which this spawner should be linked to. This should match the value you set for the "target" key of the zone volumes. A zombie AI spawner which is properly linked to a zone will be connected to the zone with a yellow line in Radiant, assuming the zone has not been hidden.

Remember that all of your riser and dog structs need to have the proper targetname to work properly with zones. See Creating Zombie and Dog Spawners for more info.

Script Changes

NOTE: "mapname.gsc" refers to your map's main gsc file, which is named the same name as your map.

For example, a map called "nazi_zombie_example" would have a mapname.gsc named "nazi_zombie_example.gsc". This file is commonly used to call custom scripts for a map.

Lines which precache items such as models need to be called BEFORE the gamestate starts and should not be threaded. Lines which do not precache any items should be called AFTER the gamestate starts and should be threaded.

The gamestate is started by this line in mapname.gsc:

maps\_zombiemode::main();

To add lines to your mapname.gsc:

  • Open your mapname.gsc file, which can be found in root/mods/mapname/maps.
  • For Precache Lines, add them before the gamestate line.
  • For Thread Lines, add them after the gamestate line.

Declaring the start zone

You must tell the game the name of the zone which players spawn inside at the start of the game. Since this zone is not activated by debris, it is declared differently than normal zones.

Find this line in your mapname.gsc

zones = [];
zones[zones.size] = "initial_zone" 

Change "initial_zone" to match the name of your start zone. Typically people use "start_zone" as their name, but if you want to save a step you could just use "initial_zone".

Declaring Adjacent Zones

In order for the game to know which zones are "adjacent", you must set the zones up in your mapname.gsc.

Find this block of code in your mapname.gsc:

dlc3_zone_init()
{
/*
h2. ///ScriptDocBegin

"Name: add_adjacent_zone( <zone_1>, <zone_2>, <flag>, <one_way> )"
"Summary: Sets up adjacent zones."
"MandatoryArg: <zone_1>: Name of first Info_Volume"
"MandatoryArg: <zone_2>: Name of second Info_Volume"
"MandatoryArg: <flag>: Flag to be set to initiate zones"
"OptionalArg: <one_way>: Make <zone_1> adjacent to <zone_2>. Defaults to false."
"Example: add_adjacent_zone( "receiver_zone", "outside_east_zone", "enter_outside_east" );"
///ScriptDocEnd

*/

// Outside East Door
//add_adjacent_zone( "receiver_zone", "outside_east_zone", "enter_outside_east" );
}


Here you should see that Treyarch has already been kind enough to provide a brief description of how to set up your zones. I will not go to the trouble of repeating what is already written there, instead I will expand upon it for clarity.

Below the "Outside East Door" example is where you will be adding your own adjacent zone definitions. To begin, copy this code below the example add_adjacent_zone line (which has been commented out):

add_adjacent_zone( "zone_name", "adjacent_zone_name", "flag_to_activate_zone_name" );
  • "zone_name" should be replaced with the name of the area which you are declaring adjacency to.
  • "adjacent_zone_name" should be replaced with the name of the area which is adjacent to the zone you specified for "zone_name".
  • "flag_to_activate_zone_name" should be replaced with a unique text string which matches the script_flag of the debris that activates the zone. Traditionally people use "enter_<zone_name>", but you can use whatever you like.
  • The last parameter, "one_way", is rarely ever used and therefore was not specified in the sample line. This is a true/false bool which defaults to false when not specified. If set to true, once the zone is activated, the game assumes that the adjacency from one zone to another is not bi-directional. In certain cases you may have a drop-off where players can drop to a new area but cannot climb back up the drop. This an example scenario where you should set "one_way" to true.

For every area you created in Radiant (ex; "zone1", "zone2", etc), you will need to paste a copy of the sample line at least once. If there are multiple zones adjacent to your zone then you will have multiple add_adjacent_zone() calls for the same zone_name.

Example

The best way is to learn by example. Consider the following snippet from UGX Comosea's mapname.gsc:

dlc3_zone_init()
{
add_adjacent_zone( "start_zone", "leftside_spawn_house", "enter_leftside_spawn_house" );
add_adjacent_zone( "start_zone", "center_building", "enter_center_building" );
add_adjacent_zone( "leftside_spawn_house", "left_breezeway", "enter_leftside_spawn_house" );
add_adjacent_zone( "left_breezeway", "rear_lakeside", "enter_leftside_spawn_house" );
add_adjacent_zone( "left_breezeway", "center_building", "enter_leftside_spawn_house" );
add_adjacent_zone( "rear_lakeside", "garage", "enter_garage_zone" );
add_adjacent_zone( "rear_lakeside", "right_breezeway", "enter_leftside_spawn_house" );
add_adjacent_zone( "right_breezeway", "back_right_area", "enter_leftside_spawn_house" );
add_adjacent_zone( "right_breezeway", "center_right_building", "enter_center_right_building" );
add_adjacent_zone( "back_right_area", "back_right_building", "enter_back_right_building" );
add_adjacent_zone( "back_right_area", "far_right_area", "enter_far_right_area" );
add_adjacent_zone( "far_right_area", "far_right_area_room", "enter_far_right_area" );
add_adjacent_zone( "back_right_area", "billboard_room", "enter_leftside_spawn_house" );
add_adjacent_zone( "billboard_room", "billboard_area", "enter_leftside_spawn_house" );
add_adjacent_zone( "billboard_area", "far_right_area", "enter_far_right_area" );
add_adjacent_zone( "garage", "far_left_area", "enter_far_left_area" );
add_adjacent_zone( "far_left_area", "far_left_room", "enter_far_left_area" );
add_adjacent_zone( "back_right_area", "center_breezeway", "enter_leftside_spawn_house" );
add_adjacent_zone( "rear_lakeside", "center_breezeway", "enter_leftside_spawn_house" );
}

As you can see, one zone can have multiple adjacent ones.

Barriers/Blockers/Debris/Doors

Zones must be activated by the script_flag KVP on a barrier, blocker, debris, or door. Ensure the script_flag matches what you specified for the zone in your mapname.gsc

See:

Help! I get a script_runtime error or my game lags...

...when I spawn into my map

You probably forgot to set up your start_zone in your mapname.gsc. See Declaring the start zone.

...when I enter a new zone

Add zone_debugger.iwd to your C:\Users\<USERNAME>\AppData\Local\Activision\CoDWaW\mods\mapname folder and run the map. Pause the game and check the console output after you spawn.

Scroll all the way to the bottom of the console window and look for any yellow [ Warning ] lines or red [ Error lines ]. You need to resolve all of these yellow/red issues to solve this script_runtime error.

If you don't see any yellow [ Warning ]'s or red [ Errors ], then proceed by buying your way to the zone which causes the error/freeze. Now check the console again for any yellow [ Warning ]'s or red [ Errors ]. Follow the directions that the lines give you.

Please remember to REMOVE the zone_debugger IWD from your map folder before releasing your map.

Credit: Treminaor