Playing an announcement for 1 team only

necro

L3: Member
Mar 24, 2008
106
13
This should be easy, but once again its probably a major ordeal with TF2. When an enemy enters a team's base, I want to play announcer_security_alert.wav, but only for the base's team members (the enemy team should not hear it). How to do that?
 

Cpt Raem

L1: Registered
Feb 20, 2008
12
1
I second this request, I also need to know how one would play announcer sounds for only a single team.
 

kimangroo

L3: Member
Mar 15, 2008
111
6
I think Warmecha was also trying to work this one out without much success. Dunno if he solved yet.

Off the top of my head I can think of one really, really hacky way of doing it:

If red is defending and you want a security alert when blu breaches the red base.

1) Firstly have one huge trigger_multiple that covers the entire map with a targetname of "red_security_alert". Set the trigger delay to 0. Add an output of onStarttouch sending a command to a point_clientcommand of "play my_map_name/announcer_security_alert.wav". Set the trigger to start disabled. Tie the trigger to a filter_activator_tfteam and set the team to red and allow.

2) Secondly place trigger_multiples in the red base entrances tied to a filter_activator_tfteam set to the blue team. Add an output of OnStarttouch(all?) to enable the "red_security_alert" trigger and then disable it a few seconds later.

3) In the tf2 sounds folder add a new directory my_map_name and put the announcer_security_alert.wav in there. Make sure to include this in your map's bsp.

When blu enters the red base it should play the warning to all red team members who are alive. This method probably needs a lot of tweaking to make it work.

In your case Necro I think it would actually be much better and easier just to have the warning play as ambient_generics from a bunch of speaker models dotted around the red base. It's more "realistic" this way.

Add the trigger_multiples tied to the blue team filter in the red base entrance. Set the trigger delay to 10 seconds or so to stop the trigger spamming the alerts. Send the output to playSound on an ambient_generic with your security wav. Set the sound source to "red_alert_speaker" and then add lots of speaker models named "red_alert_speaker" around your base.

Hope you can work something out from this!

PS I have no idea what the difference between onstarttouch and onstarttouchall is!
 

phatal

L6: Sharp Member
Jan 8, 2008
259
21
I don't believe you have to do all of that. I did this on a test map that I believe was tied to a gametext output so that 1 team gets a text and sound. Wish I could have hammer here at work. :D

I believe OnStartTouch refers to 1 player starts touching and won't trigger another player until the first player triggers OnEndTouch. However with OnStartTouchAll and OnEndTouchAll it does not wait for the first player to leave the area.
 

necro

L3: Member
Mar 24, 2008
106
13
Unbelievable. I miss the simple days of tfc mapping. Every step of the way has been a struggle with this map.

I'll try your suggestion Kimangroo. Thanks.

On a side note, it used to be that you could string together custom warning messages by piecing together words. There was a whole library of computer spoken words. So for instance, I was able to make a warning like "the enemy is attacking your reactor" Is that still possible with TF2?
 

Cpt Raem

L1: Registered
Feb 20, 2008
12
1
I don't believe it's possible to do that now. You can type custom messages that appear though. You could always record the messages yourself and import them?
 

necro

L3: Member
Mar 24, 2008
106
13
I don't believe you have to do all of that. I did this on a test map that I believe was tied to a gametext output so that 1 team gets a text and sound. Wish I could have hammer here at work. :D

Phatal (or somebody), can you elaborate on how to make this work? Its become important again that I play different sounds for the different teams and I never did figure out how to do it.
 
T

The Asylum

I'm doing something like that for a new gametype I'm diddling around with. I put an ambient_generic and sent it a play input with a trigger_multiple, filtered for (oh let's say, BLU.) Then, (and I assume you want a different message to play for RED and BLU when entering this area) within that trigger area, I put a sliiiiightly smaller trigger brush inside it, setting it's filter for RED and sending a different ambient_generic a play command.

So both teams get different messages, only RED will get it a fraction, pretty much unnociable, of a second later.
 

necro

L3: Member
Mar 24, 2008
106
13
hmm, if I understand your suggestion correctly, either red triggers a sound that plays for everybody or blu triggers a sound that plays for everybody.

I'm wanting something different. I'd like anybody to trigger a unique sound that plays only for red, and another unique sound that plays only for blu. Is that what your suggestion does?
 

Metritutus

L1: Registered
Oct 14, 2008
5
1
hmm, if I understand your suggestion correctly, either red triggers a sound that plays for everybody or blu triggers a sound that plays for everybody.

I'm wanting something different. I'd like anybody to trigger a unique sound that plays only for red, and another unique sound that plays only for blu. Is that what your suggestion does?

Um, sorry for bumping this, but I think I can help, assuming you haven't solved this already.

I'm not that good with Hammer, but anyway, I think you're going at this from the wrong direction.

I succeeded in making sounds play for one team only, by working at it from a client side perspective. There is a console command, the 'play' command which can be used to play any sound in tf2 for that client only.


So, as an example, follow these instructions:

First, create a simple room (light, etc, the team-spawn entities).

Then, create a trigger multiple in the centre of the room. Name this trigger1.

Then, create two new trigger multiples that encompass the whole room, and name them both trigger2. Set them both to start disabled. Then, give one of them a filter name of bluefilter, and the other of redfilter.

Then, create two filter_activator_tfteam entities. Name one bluefilter, and one redfilter. Set the team according to the name. ;) Make sure that the filter mode is set to ALLOW entites that match that criteria.

Next, create two point_clientcommand entities. Name one sound1 and one sound2.


This should be all the entities you need if I've got this right.

Now it's onto the inputs/outputs stuff. Select trigger1, and give it the following output:

Code:
My output named: OnTrigger
Target entities named: trigger2
Via this input: Enable
With a parameter override of: <none> (although this box is actually automatically greyed out for this one)

Then comes dealing with both the trigger 2's. For the one specifying the filter of bluefilter, give it the following outputs:

Code:
My output named: OnTrigger
Target entities named: sound1
Via this input: Command
With a parameter override of: play vo/announcer_success.wav

Code:
My output named: OnTrigger
Target entities named: trigger2
Via this input: Disable
With a parameter override of: <none> (although this box is actually automatically greyed out for this one)

Now deal with the one specifying the filter of redfilter. Give it the following outputs:

Code:
My output named: OnTrigger
Target entities named: sound2
Via this input: Command
With a parameter override of: play vo/announcer_failure.wav

Code:
My output named: OnTrigger
Target entities named: trigger2
Via this input: Disable
With a parameter override of: <none> (although this box is actually automatically greyed out for this one)


Once this is done, compile your map and choose a team. Then run the centre of your map where trigger1 is. As a member of the blue team, you should hear the announcer shout "Success!", and for red team "Failure!"


This will happen every time a player runs through the trigger, and you should be able to adapt this little tutorial to whatever you want to play some sounds for specific teams.


It's similar to what kimangroo has posted I suppose, but I hope it helps. :)