Game Development Community

Hovering player name

by Leo "kingDUCTtape" Altmann · in Torque Game Engine · 04/16/2005 (2:27 pm) · 4 replies

Hello,
I was wondering how one might go about changing when the player's name appears over their head. At the moment it's whenever you can see them; how would I set it up so it was only when the player was targeted? I'm assuming it'd be something with raycasting, tho I'm no expert on engine modding. Thanks!

#1
04/16/2005 (2:34 pm)
For the actual name it's in the prefs and the game settings,
the rest I'm not sure.

Toby.
#2
04/16/2005 (2:46 pm)
I haven't looked at that code for a really long time, but I believe that this is all done in a certain GUI control. Also, I think that this same gui control draws a health bar under the crosshair when you are pointing directly at an enemy. It seems logical that you could just move the name rendering code to the place in the code where it draws the health bar.

EDIT: I take that back, Guishapenamehud displays the names, while i believe the crosshair displays the health bars.
#3
08/04/2005 (11:31 am)
I have the same question, and in the same position as Leo. Any ideas on how to get Leo's idea working?
#4
08/04/2005 (11:39 am)
I believe calling : %obj.setShapeName("NAME"); sets the name above the player.

If you initialize everyhting to setShapeName(""); no one will have a name above them.

If you are using a raycast or whatever to target, then when the raycast returns a player, store that player id. Call setShapeName(%obj.myNewName); (You'll have ot define myNewName)

When you are no longer targeting a player, or you are targeting a different player then set the shape name of the stored player back to ""... and set the name of the new player.

Hope that makes sense to you.