Adding Command Posts

Since you might want to have more than just the 4 default CPs in conquest, here is a quick tutorial on how to add more CPs to your map. This is based on the Getting Started.doc in the documentation folder of the BF2_ModTools.

The key things that every CP needs in Conquest:

SpawnPath – This is where you will spawn if you select this CP
CaptureRegion – The region that you need to be inside in order to capture the CP

And optionally:

ControlRegion – This region controls vehicle spawns

Open the world as described in the Getting Started page and open the conquest layer.
Now you’re going to want to go into Object edit mode.

The CP Object

Placing the CP

On the top of the left side panel, select the Place button. Further down the left side, you’ll see a box for "ODF File:" with a browse button underneath it that you should click. Browse to the following location: \BF2_ModTools\data_abc\common\odfs, and select com_bldg_controlezone.

The browse dialog will automatically close, and you be back in your editor view. Drag your mouse around the 3D view, and notice there is now a small object that is always under your mouse cursor. This is the CP object. Simply click on a spot on the terrain and it will place a new CP object in your level.

Now that the CP is placed, we need to set up the name of the CP, and a few other things like what spawn path it will use, and what capture region it will use.

Editing the CP Properties

Click on the Select button on the upper-left part of the Object edit panel. Move your mouse cursor over the CP object you just placed, and you’ll see it turns green when the mouse cursor is over it. Click on it, and it will turn blue. This means the CP is now selected.

Now that you have the CP selected, we need to change it’s name. I recommend keeping with the naming scheme that we used in the template files, so your new CP should be named cp5 (as we already have CPs 1 through 4 that were automatically placed when you created your level). I also recommend always using lower case in anything you type in any of these fields, just because it eliminates the possibility of having mis-matched capitalization across associated objects. So let’s name this CP, cp5. Simply click on the auto-generated name in the name field, which will highlight the name, type your new name, and hit enter.

Next, click on the 0 in the Team field, enter a 1, or 2, and hit enter. This makes this CP belong to team 1 or 2, whichever you select, at the beginning of the match.

The Label field isn’t really important, so you can just leave it blank.

Notice also, that once the CP is selected, you’ll notice some new information has appeared in the Object Instance box on the right side of the Zero interface.

The fields we want to modify are the CaptureRegion, ControlRegion, and SpawnPath fields.
-In the CaptureRegion field, enter cp5_capture
-In the ControlRegion field, enter cp5_control
-In the SpawnPath field, enter cp5_spawn

Note: The CaptureRegion is the region that you need to be standing in in order to capture the CP. The ControlRegion is a region that controls the spawning of vehicles associated with a CP. Vehicle Spawns are placed inside the Control Region, and once they leave the Control Region, if they are abandoned, they will eventually self-destruct, and respawn.

Repeat the above process with however many CPs you want to add to your map. Continue the naming scheme of cp6, cp7, etc. And make sure to use cp6_capture, cp6_control, etc. You can, if you like, start some CPs on team 0. This will make them Neutral at the beginning of the match. You need to have at least one CP start team 1 and team 2 respectively at the beginning so the teams both have an initial CP to spawn in at.

Now that you have your CPs in your level, with all the appropriate namings, and associations set up, we’ll move on to creating the spawn paths, and capture/control regions.

Adding the Control and Capture Regions

On the Edit Mode toolbar, click on the Region button.

First, click on the New Group button on the left-hand panel. Then, click on the Cylinder button under the Shape section. This will allow you to place a cylindrical region in your level. As with Object Mode, simply move your cursor to where you want to place your region (the regions should be placed in the same location as the CP that they are going to be used for) and left-click. Position the region so that it is centered over cp5 and sunken slightly into the ground to make sure there are no places you could stand and have your feet not be inside the region.

Once your region is placed in the world, click on Select Region under the Action section. Move your cursor over the region you just placed and click on it to select it.

You’ll notice that just as with objects, a name is automatically filled in, in the Region ID boxes.

At the top of the screen, next to the top Region ID box (there are 2 Region ID boxes, one on the tool panel as you can see in the image on the left, and one at the top of the screen to the right of the tool panel) there is a box titled Class Properties. I know this is confusing, but this is where you need to type the name of your region (I know it’s weird, but trust me, it works). Click in the Class Properties box, and enter the name “cp5_capture” (without the quotes). You should then copy that name into the Region ID box to avoid any confusion later on. It will also make the region easier to select from it’s Region ID in the list.

Creating the Control Region for this CP works the same way. First, click on New Group in the region tool panel. This time, we’re going to make a box region, so under Shape, click Box.

Now just click where you want to place the region. Note: It should also be slightly sunken into the terrain

Select the region (click on Select Region and then click to select) and enter the name “cp2_control” into the Class Properties and Region ID fields, the same as we did on the Capture Region.

Now, you have a cylindrical Capture Region and a rectangular Control Region. The Control Region is used for vehicle spawns, which is explained in the adding vehicles page, and need be added if vehicles are planned at this CP. For information on regions in general, see the Zeroeditor page.

Spawn Pathing

Click on the Path button under Edit Modes.

First, click New Path. The first thing we’ll do is rename the path to “cp5_spawn”. To do this, click on the auto-generated name in the Path Name box, and type “cp5_spawn” (no quotes) and hit enter.

Now, to place path points, just click on the terrain where you want to place your node. Each CP should have at least 6 or 8 spawn points. Click on the terrain, and place the number of nodes you want on the ground around cp5.

Notice that there are a set of axis visible on each path node. There is a blue, red and green axis. Players will spawn into the world facing in the direction of the green axis. To rotate this axis, first click on the Move button under the Action tab, and then click on the node you want to rotate.

Once you have the node selected, press and hold the X key to go into rotate mode. Click and drag with your Middle Mouse Button to rotate the green axis into the position that you want players to face when they spawn in. Repeat this process for each node.

Adding to the Lua Script

I’ll go over quickly how to make your new CPs actually count in conquest. You’ll need to open up your Lua script (either abcc_con.lua or abcg_con.lua) which is located in \BF2_ModTools\data_abc\common\scripts\ABC\. At the top you’ll see this function:

function ScriptPostLoad()       

    --This defines the CPs.  These need to happen first
    cp1 = CommandPost:New{name = "cp1"}
    cp2 = CommandPost:New{name = "cp2"}
    cp3 = CommandPost:New{name = "cp3"}
    cp4 = CommandPost:New{name = "cp4"}

    --This sets up the actual objective.  This needs to happen after cp's are defined
    conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, 
                                     textATT = "game.modes.con", 
                                     textDEF = "game.modes.con2",
                                     multiplayerRules = true}

    --This adds the CPs to the objective.  This needs to happen after the objective is set up
    conquest:AddCommandPost(cp1)
    conquest:AddCommandPost(cp2)
    conquest:AddCommandPost(cp3)
    conquest:AddCommandPost(cp4)    

    conquest:Start()

    EnableSPHeroRules()

 end

All you have to do to get your new CPs working in conquest, is to add entries for cp5, cp6, etc…for however many CPs you add to your level. So let’s say you added cp5 and cp6. Add the line cp# = CommandPost:New{name = "cp#"} in its associated place and the line conquest:AddCommandPost(cp#) in its associated place. Your new ScriptPostLoad function should look like this:

function ScriptPostLoad()       

    --This defines the CPs.  These need to happen first
    cp1 = CommandPost:New{name = "cp1"}
    cp2 = CommandPost:New{name = "cp2"}
    cp3 = CommandPost:New{name = "cp3"}
    cp4 = CommandPost:New{name = "cp4"}
    cp5 = CommandPost:New{name = "cp5"}
    cp6 = CommandPost:New{name = "cp6"}

    --This sets up the actual objective.  This needs to happen after cp's are defined
    conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, 
                                     textATT = "game.modes.con", 
                                     textDEF = "game.modes.con2",
                                     multiplayerRules = true}

    --This adds the CPs to the objective.  This needs to happen after the objective is set up
    conquest:AddCommandPost(cp1)
    conquest:AddCommandPost(cp2)
    conquest:AddCommandPost(cp3)
    conquest:AddCommandPost(cp4)    
    conquest:AddCommandPost(cp5)
    conquest:AddCommandPost(cp6)

    conquest:Start()

    EnableSPHeroRules()

 end

…and that’s it. You’re new CPs are now functional. Note: if you don’t make these changes to your script, you’re new CPs will show up just fine in the game, and will be capturable, but they will not contribute to the conquest functionality, meaning that if CPs 1-4 are all captured, the game will still end even if CPs 5 and 6 haven’t been.

CPs for CTF and Hero Assault

For CTF and Hero assault instead of using the object com_bldg_controlzone, which is meant for conquest CPs, you’ll use (from the same directory) com_bldg_controlzone_CTF. The rest of the process is the same, except these CPs do not need capture regions (and in fact should never have capture regions). In fact, control regions are only needed if you are going to have vehicle spawns associated with that CP. The only requirements are the name, team, and spawnpath has to be set properly. CPs in CTF (1 flag and 2 flag) and Hero Assault are ONLY used as spawn points, and will not be capturable.

A note about layers

Be sure that you select the proper Layer when you add CPs, or any other objects to your level.

If, for example, you are in the ctf layer, and you are trying to place CPs for conquest, you’re going to get new CPs showing up in CTF, and no new CPs in conquest. So always be mindful of which layer you are currently editing. Objects, regions, paths, etc, that are placed in any of the game mode layers (conquest, ctf, 1flag, or eli) will only show up in that game mode. If you want objects to show up in all game modes, you can either create a new layer (which by default will show up in all game modes) or you can just add these objects to the Base layer.

See ZeroEditor_GameModes.doc or the layers page for more info about layers and game modes.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License