[TUTORIAL] CTF Capture entities and tricks.

Oct 25, 2007
219
690
We'll be creating a one sided, timed CTF map. Basically Red need to capture three flags that spawn at different locations, and blue has to defend.

You can download my VMF file here for reference.

So go ahead and create a long room. Mine is 512x1024. Decide which end will have the flags, and which end will be the capture zone. Go ahead and place an info_player_teamspawn entity in the middle of the room. Put two light entities in the two areas of the map as well. Now we can focus on CTF specific entities.

1. Creating a capture zone.
Click on the block creation tool.
block-creation.jpg
Select the trigger texture (not trigger_relay though). Draw a large enough box. Mine is 128x256x128. Once created, select it and right click to get a menu. Select tie to entity. The entity we'll need is fun_capturezone.

Optional: I placed some decals on the wall and floor to help identify the capture zone. The trigger texture is invisible in the game, so having some visual hints of it's location is a good idea.

2. Creating the first flag.
Click on the new entity tool.
new-entity.jpg
Select item_teamflag for the list of entities.
teamflag.jpg

Place the entity in a place where it will be distinct from the other flags. Create it.

Go into the properties. Give it a unique name, I gave it flag1. Set the team to Blue. Make note that the start disabled value is no.

3. Creating the other flags.
Create the other two flags, go into the properties. Gave them each a unique name, set the team to blue, as you did with the first flag. However, this time we'll be setting the start disabled option to yes.

4. Spotlights.
I'm going to put some spotlights which turn on and off, pointing where the new flag is. Select light_spot from the list of entities. If you have a map with shifting flag stations, you should find a way to communicate with the players where the new flag is. Another neat way of doing this would be to have dynamic_props with the flag sign that appear and disappear. Place the spotlights above the areas where you'll be placing the flags. Go into each, and give them each a distinct name. I called them light1, light2 and light3. On each, you want to set the entity to point at to the nearest flag. For spotlights 2 and 3, go to the flag tab for each, and place a checkmark next to initially dark. We want them to turn on only when their flag is there.

5. Enabling and disabling flags.
Go back into the properties of the first flag you created. Now go to the outputs tab. We'll be creating the following five outputs.
flag-outputs.jpg

So, breaking them down logically. When someone grabs the intelligence, the spotlight turns off. If you defend the flag and it's timer runs out and it returns to base, the spot will turn back on. The you capture the intelligence, the flag turns itself off, and turns off the next sequential flag. It will also turn on the spotlight for the next flag.
You'll have to create similar outputs for the other flags, just changing the names of the next entities.

6. Last of the game entities.
Create a game_round_win entity somewhere within your map. Give it a name, such as bluewin. Set the team to blue. Set switch teams on map win? to yes.

Now create a team_round_timer. Give it a name, such as timer. For timer length, I chose 60 (seconds). Go to the outputs tab. YOu want an output OnFinished, the target is the game_round_win entity you had just created.And the target input is RoundWin. This means if the time runs out, the blue team wins.

7. Options
If this were a real map, I would add one more output on the item_teamflag entities.
The output OnCaptured, the target would be the team_round_timer entity (timer), the target input would be AddTime; the parameter would be however many seconds you want to add to the timer.


Hope that helps. Good luck!
 
Last edited:

Intraman

L4: Comfortable Member
Nov 4, 2007
191
0
This is really interesting. Would you be able to say have 2 flags for each team, that when one is captured (as in brought back to the opposite teams capture point) it then activates the other flag, and viceversa. Because that could set up some interesting defensive systems.