[TUTORIAL] Single Flag CTF with flag team switching.

Dr Forrester

L2: Junior Member
Aug 15, 2008
60
23
This tutorial will show you how to set up the flag on a single flag map so that once one team has picked up the flag, the other team cannot try to pick it up until a certain amount of time after it is dropped. entity types will be in Green, entity names will be in Orange. Outputs will be in Purple

Okay, first of all, I want to say I got a lot of inspiration from these two threads, so please thank them if you get a chance.
http://forums.tf2maps.net/showthread.php?t=647
http://forums.tf2maps.net/showthread.php?t=3364

Specifically, Zephyr was the one that gave me the Idea that let it all fall into place.

To get this to work you will need:
a logic_auto
a logic_timer
an item_teamflag
two team filters, one red, one blue
two bursh-based trigger_multiple entities.

Ok, first set up your item_teamflag and set the team to neutral (0). this tutorial assumes you are naming it "Flag", but name it whatever you want.
set up your logic_auto. set the following outputs, all OnMultiNewRound:
Flag SetTeam 2; Flag SetTeam 3, 1 second delay; Flag SetTeam 0, 2 second delay. This will get your indicators working.
Set up two brushes slightly larger than the flag as trigger_multiple entities. Use the same method for each that you would to trigger a spawnroom door, using the filters for red and blue. set the delay to 0, and parent both to the item_teamflag.

set up your logic_timer. Now here's the tricky part. for the sake of this tutorial, the triggers are named "triggerred" and "triggerblue", and the logic_timer as "timer"

Ok, now with the logic_timer, i've found that it does weird things to your logic_auto when it starts enabled. so start it disabled.

Go to your flag and set the output OnDrop timer Enable. Also set the output OnPickup Disable for both Triggers. Next, set the output OnDrop timer RefireTimer ##, the ## being the amount of time in seconds you want before the Flag can be picked up by the opposite team. Next add the Outputs OnReturn timer FireTimer. This will override the timer in the event that the flag is returned to base before your timer runs out. Now we are done with the Flag.

Go to your logic_timer. Set the outputs OnTimer triggerred Enable, OnTimer triggerblue Enable, OnTimer Flag SetTeam 0, & OnTimer timer Disable. This basically clears the flag back to neutral and resets our triggers, the turns the timer off until we need it again.

Lastly, go to your trigger_multiple entities. Triggerred should be set to filter red players, Triggerblue should be set to filter blue players. On Triggerred, set the output OnStartTouchAll flag SetTeam 3 (blue). On Triggerblue, set the output OnStartTouchAll flag SetTeam 2 (red). Now the flag will switch to the opposite color of the person touching it and stay that way until it receives further instructions from your logic_timer.