Finding Player Name (possible use of !player or !activator)

Kloopy

L1: Registered
Feb 27, 2009
6
0
Hi,

I have searched the forums briefly and hopefully I've not missed an obvious answer to my question. If I have, I apologise....

Does anyone know how I can get the player name of someone who activates a trigger? At the moment I'm not too fussy which entity output I use to make use of the player name; to begin with I'd like a proof of concept method to get a players name.

I've looked at the Valve Developer Community wiki's list of TF2 entities, and can't find a way to find the players name from !activator. Is there a way to do this and, for example, pass it to a game_text_tf? To begin with it would be wonderful to have a simple brush entity and when ever anyone walks in to it, their name is displayed in game.

I'm pretty competant when it comes to mapping in Hammer and know most of the simple stuff... I'd just appreciate a nudge in the right direction on this one.

Thanks for your time :)

Kloopy
 

StoneFrog

L6: Sharp Member
May 28, 2008
395
81
In TFC, the info_tfgoal entity had a special dialog string (I think %a or something) that would place the name of the player who activated the goal (capping a flag, etc.) in the text message.

I know of no such equivalent in TF2. /me wants specialized messages back!
 

Kloopy

L1: Registered
Feb 27, 2009
6
0
Is there any way to uniquely identify a player? Perhaps some sort of reference I can get from !activator to uniquely identify one player?

This could be used, for example, to ensure the person who presses a button to open a door is the only one allowed to close it.
 

-gr-

L1: Registered
Jul 11, 2008
17
12
Is there any way to uniquely identify a player? Perhaps some sort of reference I can get from !activator to uniquely identify one player?

Yep, when a person runs through a trigger, you can use OnTrigger !activator AddOutput targetname special_player to give them a unique name, and then use a filter_activator_name on another trigger/entity that only fires for that named person. (special_player)

OR

You can parent a point_proximity_sensor to the player and use that to determine if a person is "carrying" it when they go near whatever you want to interact with. The advantage of that compared to the other method (if you need such an advantage, depends on the map) is that the point_proximity_sensor can be unique, so only one person at a time can have it.

There may be other methods, but those are the two I've used in my maps with good success. I have small sample maps showing both methods. If you want to see them, let me know.
 

Kloopy

L1: Registered
Feb 27, 2009
6
0
-gr-, I'd be interested in a map showing your first solution, if that's not too much trouble! It sounds just what I'm after!

I'll keep an eye out for forums PM and on this thread. If you want my email address, let me know.

Thanks!
 

-gr-

L1: Registered
Jul 11, 2008
17
12
Here it is, .bsp and .vmf attached in a .zip archive.

First arch adds the "special_player" name.
Second arch will only harm players named "special_player".
Third arch removes the "special_player" name.

Enjoy.