• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Nameing

Status
Not open for further replies.
Level 8
Joined
Jan 8, 2008
Messages
454
Hey everybody,

I remember seeing this in a map a long time ago but I haven't quite fathomed how to do it myself. I want to make a system whereby a player can put a floating text name to follow and move around a unit. For example one would type -name Levdragon and then a floating text would follow the unit around saying Levdragon. This text would have to go away when that said unit dies however and would there be any way to remove that text at will?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Is there only 1 unit (hero) per player?
If that is the case, something like this would be the easiest way:


  • Move Text
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Floating Text - Change the position of TextTag[(Player number of (Picked player))] to Hero[(Player number of (Picked player))] with Z offset 0.00
When a hero dies, you can do this:
  • Floating Text - Destroy TextTag[(Player number of (Triggering player))]
And re-create it when the hero revives.
(This is also how you should remove the floating text if you want it gone).


"PlayerName" is a string array. PlayerName[1] is the name of Player 1, Red.
"Hero" is a unit array, Hero[1] contains Player 1, Red's hero.
"TextTag" is a floating text array, "TextTag[1]" is the text shown above Hero[1].
 
Level 37
Joined
Mar 6, 2006
Messages
9,243

  • Move Text
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Floating Text - Change the position of TextTag[(Player number of (Picked player))] to Hero[(Player number of (Picked player))] with Z offset 0.00

I'd like to add that floating texts are shown through fog of war. To prevent that, do this:
  • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
      • set integer = Player number of picked player
      • Floating Text - Change the position of TextTag[integer] to Hero[integer] with Z offset 0.00
      • Custom script: call SetTextTagVisibility(udg_TextTag[udg_integer], IsUnitVisible(udg_Hero[udg_integer], GetLocalPlayer()))
 
Last edited:
Level 8
Joined
Jan 8, 2008
Messages
454
Ah, thank you for the quick response. Yes it's something along those lines only a bit more complex. I also wish for the it to be able to affect any hero made at all by any player so you can have multiple heroes of any type running around with text above their heads. Since each player will have even up to 10 heroes at once it makes individually assigning names a tad bit difficult.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
I also wish for the it to be able to affect any hero made at all by any player so you can have multiple heroes of any type running around with text above their heads. Since each player will have even up to 10 heroes at once it makes individually assigning names a tad bit difficult.

Add units into a unit group and pick units in the group and not players. Remove units from the group when they are dead and add them back if they are revived.
 
Status
Not open for further replies.
Top