This article relates to the game "Team Fortress 2". Click here for more information.

Flag Based Goal Systems

From Valve Developer Community
Jump to: navigation, search

English (en)한국어 (ko)русский (ru)

Flag-based goal systems use item_teamflag entities to determine how a team scores points. Flags must be carried by players to func_capturezone brush-based entities, which act as drop-off points. Although they are called "flags," item_teamflags are actually represented by Tfwiki favicon.png intelligence briefcases in Team Fortress 2 Team Fortress 2.

The entities and input/output system may allow us to do some interesting things with Flags in Team Fortress 2.

Basic CTF

This gametype is included in A Boojum Snark's Team Fortress 2 Gametype Library

The complete entity setup for this gametype is included in "A Boojum Snark's Team Fortress 2 Gametype Library," a downloadable VMF that includes all official Team Fortress 2 gametypes. The entities can easily be transferred from the VMF to your own custom map without the hassle of having to build it yourself or debugging it.

"A Boojum Snark's Team Fortress 2 Gametype Library" can be downloaded here:

The most common capture the flag game type, retrieve the flag from the enemies base and take it to your own to capture it. A basic CTF map has a simple flag-based goal system, consisting of one flag spawn point per team and one drop-off point per team, with both points usually lying in the same location. There are seven official CTF maps for Team Fortress 2 so far: ctf_well and ctf_sawmill, which are conversions of other maps; the ubiquitous ctf_2fort; the user-contributed ctf_turbine and ctf_landfall; ctf_2fort_invasion, which has a drastically different theme from the original; and ctf_doublecross. In December 2020, ctf_snowfall, a Christmas-themed reskin of Landfall, was also added, though it was removed the following January.

This tutorial will show you how to setup a complete basic CTF goal system.


First, create a couple of landmarks to act as a location for the intelligence briefcase to spawn in and also for the capture zone. This is not strictly necessary, but it will help new players to quickly learn your map.

Flag Landmark

The empty pedestals.

For the example, we will use a pair of simple blocks to serve as pedestals for the intelligence, one for each team. Start with the RED team's side of the map and make a brush 96 by 80 units that is 48 units high, texture it with the wood/grain_elevator_facade_14a texture, and tie it to the func_detail entity.

Capture Zone Landmark

A nice border.

Now to create a landmark for the capture zone. In this example, we will simply place the landmark for the capture zone in the same location as the landmark for the intelligence. Create a brush-based border that is 16 units wide and 2 to 4 units high around the pedestal. Texture it with the props/hazardstrip001a texture and tie it to a func_detail entity as well. Also, select the signs/capture_zone texture and place it inside the border as an overlay.

The item_teamflag

Next, create an item_teamflag entity and put it on your flag landmark. This will be the briefcase itself. Since were going with the RED team in our example, so set the team property to RED.

The func_capturezone

The RED team's briefcase-flag and capture zone.

Finally, create a func_capturezone brush-based entity over your capture zone landmark. This defines the area in which the enemy briefcase can be returned to score points. In our example, we'll define it as a column above our capture zone pedestal. We'll make it 160 units high to be sure jumpy scouts can score too. Again set the func_capturezone's team property to RED.

Finishing up

You now have all you need for the RED team, and just need to repeat the process for the blue team. Once that is done, you will have a fully functioning capture the flag map! With these entities in place, the map briefing will automatically be filled out with the CTF description, and the win condition for the round will be set to 3 captures.

Download an example map here:

Carrier message
Note.pngNote:a team's capture zone does not have to be in the same location as the intelligence briefcase, it can be placed anywhere inside the map. However, if a player from the opposing team touches it while carrying the intelligence, they will see the message, "Take the INTELLIGENCE back to YOUR BASE".

Special Delivery

In Special Delivery, both teams are attempting to take the neutral flag from the drop site to the neutral capture zone. This game mode also added the ability for triggers that only work when the flag carrier is present, which is used in the official Valve map sd_doomsday.

The flag also uses custom capture and return announcements.

There is only one official SD map: sd_doomsday.

Neutral flag CTF

When an item_teamflag has its team set to any, it is considered neutral and either team can pick it up and take it to their capture zone to score. Neutral flags have a white skin variant of the briefcase, and a grey return timer above them during gameplay.

Icon-Bug.pngBug:Keep in mind, while carrying a neutral flag, the HUD element will show that you are carrying an enemy flag.

Multiple flag CTF (simultaneous)

A player can score using any flag that doesn't belong to his team. So, theoretically, you could have as many flags as you wanted on your map.

A player can carry as many flags as he can find, but will only be able to turn in one of those flags - the rest will get stuck with him. The bug where players would pick up an unlimited number of flags has been fixed, as you can no longer carry more than one flag. However, this does not disallow multiple flags, as you can have as many flags as you please in your map. This fix is also an insight to Valve's intentions for Neutral Flags

Multiple flag CTF (sequential)

This technique allows you to change the position of the flags between captures. This way, you can make a team's second capture harder than its first, move a neutral flag around each time it's captured, or any number of other interesting tweaks to standard CTF.

Name your flags

First, make sure you have a few item_teamflags placed on your map, and give them all names. We'll be using three in our example, each with their team set to any (neutral), called flag1, flag2, and flag3. Don't forget your func_capturezones for each team as well.

Start disabled

All of your flags should have the Start Disabled property set to yes except the ones you want to have on the map when the round starts. In our example, flag1 is the only one with Start Disabled set to no.

Setup their outputs

The second flag in the multiple sequence, and its outputs.

Select the flag you want available first; flag1 in our example. You will need to setup a couple of outputs. One to turn the next flag on, and another to turn this one off. They should look like this:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnCapture flag2 Enable   0.00 No
Io11.png OnCapture flag1 Disable   0.00 No

Do the same for the other flags, turning on the next in the sequence and disabling the current flag. When you get to the last one, you can loop around and turn the first one on again.

You now have three flags, of which only one will be active at a time! We used neutral flags in the example, but you could do this for both team's flags to get a really dynamic CTF map.

Reverse CTF

Reverse CTF is a simple variation on basic CTF in which the position of the flags and capture zones are reversed - put on the opposite side of the map. Instead of retrieving a defended flag, the goal is to deliver a flag from the friendly end of the map to a defended capture zone.

Football CTF

This is Reverse CTF with neutral flags. With a single flag, the result is similar to the sport of football or the Bombing Run game type in the Unreal Tournament series, in which both teams fight to carry the flag into the capture zone on the enemies' end of the map.

Design theory

  • A flag room should have enough space for both defenders and attackers, more than one entrance, a few good sentry positions, and some cover from those sentry positions.
  • The mission briefing appears to be the regular CTF briefing no matter what kind of funky things you do with the entities. It is possible to manually change the mission briefing.
  • Flag and capture zone locations usually feature landmarks, such as the desk in ctf_2fort, to make them easy to identify.

See also