Multiple flag solution

DrHaphazard

L5: Dapper Member
Jan 6, 2008
249
12
Well as I elucidated in a previous post, theres a problem currently with having more than one flag per team in your map, namely that a flag carrier can carry an infinte number of flags.

To avoid this problem I have worked out a system in which the flag carrier drops his flag when approaching another flag's starting point and a system for returning the dropped flag immediately (props to richard_cabeza for this last part!)

- Create a brush around your item_teamflag (i put the flag in a small room and blocked off the doorway with the brush)
- Turn the brush into a func_respawnroom
- Give your respawnroom a name
- Go into your item_teamflag outputs and do:
+ OnPickup Disable "respawnroom brush name" .01
+ OnDrop Enable "respawnroom brush name" .01
+ OnCapture Enable "respawnroom brush name" .01

The .01 is the delay. Last night I could not seem to get the OnCapture thing to work, at which time i had 0 delay. When i added .01 delay to the commands it seems to work just fine. Go figure.

To make this system utterly foolproof you need to make sure the flag returns immediately, otherwise a flag carrier could intentionally or accidentally run over a dropped flag waiting to return somewhere in the level. As soon as a second flag is picked up by a flag carrier the first flag glitches out. It cannot be capped or dropped and therefore will never return to its starting position.

To eliminate a flag return timer do the following:

- Create a point_template in the exact middle of your item_teamflag
- Open up the point_template properties' Flag tab and click "Don't remove template entities"
- Name your point_template
- Click on Template 1 and put in the name of the flag that you want returned to that spot
- Open item_teamflag properties and in output type:
+ OnDrop "flag name" KillHierarchy
+ OnDrop "template name" Forcespawn 0.01

I will be happy to post this as a tutorial (which seems somewhat ridiculous given how bad I am at mapping) but I would prefer some confirmation from others that this works for them.
 
Last edited:

DrHaphazard

L5: Dapper Member
Jan 6, 2008
249
12
Yes. The idea is that we do not want a flag carrier picking up another flag. While the mapper can control how a player approaches a flag at its starting point, he cannot control a player approaching a flag dropped randomly in a level.

The simplest solution to that problem is to ensure that a dropped flag does not stay dropped for long. Once the flag has returned to the safety of its starting position, it is again "guarded" by a func_respawnroom from other flag carriers

If you all like i could create a minimalist map to illustrate the idea.
 
R

richard_cabeza

Good post, and thanks for the props.

I'm still working on adjusting the default timer for a flag to return. I'd like for it to sit there for 20 seconds, but not 60. I'd also like to figure out how to allow a team to return a flag instead of protecting it. (i.e. a Red guy kills the Blue flag carrier, then stands over the Red flag, which respawns after 5 seconds of contact... or something.)

I'm narrowing down the methods. I've never programmed/mapped/modded before, so it's a lot of trial and error. But good forums like this one make it easy.
 

DrHaphazard

L5: Dapper Member
Jan 6, 2008
249
12
I am going to quote here from the fpsbanana.com forum, a guy over there named Beelzebub came up with a much smarter solution than mine I think. Its only a rough idea and I have not yet tried to check it out, but I thought yall would be interested in hearing it...

I think your idea is possible. I am at work right now so I can't do all the research to piece it together properly, but here is a summary...

Create a filter_activator_name and set the filter to "FlagCarrier".
The item_teamflag's OnPickup output should fire the AddOutput input on !activator (which shold be the player that picked up the flag) and set the player's name to "FlagCarrier". Also add an output on OnDrop & OnReturn to set the players name to "NonCarrier".
Each flag has a trigger_multiple parented to it so that the trigger moves with the flag.
The trigger_multiple should have its filter set to the "FlagCarrier" filter you setup.
The trigger_multiple's OnStartTouch output should call the Disable input on the associated flag.
The trigger_multiole's OnEndTouch output should acll the Enable input on the associated flag.


How it should work is if a player picks up a flag, their internal name is changed to "FlagCarrier" if they get too close to another flag, it will get disabled so they can't pick it up. When they drop/cap the flag they are carrying, their name is cleared so they can once again pick up flags.
Let me know if you you need more details.​

So I'll check back later, but I think that parented trigger idea is really good.
 
R

richard_cabeza

update: i just solved the problem. It's a bit off-topic, so I think I'll start a new post with instructions. The solution is actually fairly simple. I was thinking too hard.