• 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.

[Trigger] How can i create floating names only?

Status
Not open for further replies.
Level 9
Joined
Oct 15, 2006
Messages
339
I want to create floating names to the right of each player but leave the text be.

For my map it will be easy because i only have one unit per player.

Players will select their unit at the beginning by dialog buttons or chat but will also change between a selection of units during the game.

How could i make this code?
 
Level 11
Joined
Aug 25, 2006
Messages
971
Make an array of units which uses the player number as the index. Make each unit in the array equal the unit you want to have the text float over. Then every .02 seconds cycle through the array moving the text to the proper unit. I'd love to show you this in GUI, but, well.... Look in my sig.
 
Level 11
Joined
Aug 25, 2006
Messages
971
Disable the trigger until you need it OR set the default unit of the array to a unit on the map. Then when your cycling through the array to move the text, if the unit is equal to the unit set as the default unit of the array, skip updating that unit's text.

I g2g to bed. Good night. I'll try and help some more tomorrow.
 
Level 5
Joined
Aug 16, 2007
Messages
149
Names above head system

you would need a trigger like this to initialize the text:
  • names above unit heads
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set unitsfortext[0] = Peasant 0000 <gen>
      • Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Actions)
        • Loop - Actions
          • Floating Text - Create floating text that reads (Name of (Picked player)) above unitsfortext[((Player number of (Picked player)) - 1)] with Z offset 0.00, using font size 12.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Enable permanence
          • Set text[((Player number of (Picked player)) - 1)] = (Last created floating text)
(the Map Initialization event would change to whatever your event is and the peasant 0000 generic variable would be whatever unit you wanted to make the text float above, plus you would need to set the unitsfortext variable to the other players' units too)
and then a trigger would be needed to make the floating text follow the unit around like this 1:
  • follow movement
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 0 to 11, do (Actions)
        • Loop - Actions
          • Floating Text - Change the position of text[(Integer A)] to unitsfortext[(Integer A)] with Z offset 0.00
hope this is useful
 
Level 2
Joined
Dec 2, 2007
Messages
22
Its a little complicated, because in every moment that the unit/hero moves, the floating text must follow it...I think it's not so usefull, anyway, you can do it.
 
Status
Not open for further replies.
Top