|Date:||1/15/2003 2:21:59 AM|
|Subject:||Got hair? cause you are gonna need it.|
This will probably be put in the manual.
I wanted an alarm on the red side of a map to constantly play. Ok, easy enough with func_flag events and stop it when it was returned or dropped, but there is no NOT in the ents that we have. Basically I could trigger a looping sound with a func_flag event, but if the blue flag was dropped and then picked up again, the loop would stop, and start up again once it was capped.
with me so far?
Ok, so I tried just about every combination of entities to get a conditional "if flag is picked up and on stand", but it didn't work. Couldn't figure out why, all I was doing was targeting a speaker. I could target shaders (switching colors in a base to make alarm lights go on) no problem, but targeting ents was becoming an issue.
Ok, next step, just make a timer start on and target a speaker with the conditional flag is taken and flag is dropped, right? since the conditions wouldn't be met, it'd work out fine, the timer wouldn't trigger the speaker because the relay wouldn't let it.
That didn't work. The timer would fire correctly, I had another wav fire off with each timer, but damned if it wouldn't work. Oh I could press a button and the conditions would work, but not for a world spawned trigger.
Then the light grew. Since I can't modify the source and the patch is already uploaded (waiting for rav) I knew I had to link the triggering ent to a player, even if it is a timer. So I targeted the timer, not looped on, from a spawn similar to how one would do a target_give. Well, it worked, but if I were to spawn again it would trigger it again and turn it off. But at least I was getting somewhere.
The problem was, how do I link the timer ent to a player without having someone else trigger it again (sans modifying code) causing the whole trigger/loop efect to go wrong? It had to be linked, it had to be a timer, and it couldn't be tripped more then once per flag event.
Then it dawned on me, and I prayed and prayed that whoever put in the forceteambalance check did it right and remembered that there is a trigger around the flag, and the flag is not really a flag but a representation of a trigger and model. So, I linked the flag, spawned some bots, kicked all the ones off of blue, and yep, the flag event code is good.
Players are linked to the flag, and all triggers that are fired at their targets, even if the client disconnects, are still linked to that flag.
So without futher ado, here's how you can link entities with an if/then ent to DoCoolStuff(tm)
You can put a relay(s) past the flag and target off of that if you need to control more then one set of events for the flag event.