• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Player Name Plates Problem

Status
Not open for further replies.
Level 8
Joined
Jun 26, 2019
Messages
318
Hello you all. I need help with this trigger. For player 1, I want the player names to be shown only to player 1 and player 1's team on their hero units, and enemy players cannot see their player names above their hero units. Same thing for player 2 and player 2's team.

  • startgame
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Set VariableSet TempPoint = (Random point in Team1start <gen>)
      • Unit - Create 1 Footman for Player 1 (Red) at TempPoint facing Default building facing degrees
      • Set VariableSet TempPoint = (Random point in Team2start <gen>)
      • Unit - Create 1 Footman for Player 2 (Blue) at TempPoint facing Default building facing degrees
      • Game - Enable selection and deselection functionality (Disable selection circles)
      • Game - Disable pre-selection functionality (Disable pre-selection circles, life bars, and object info)
      • Visibility - Disable black mask
      • Visibility - Disable fog of war
      • Wait 1.00 seconds
      • Visibility - Enable fog of war
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Trigger - Turn off (This trigger)
  • PlayersNameText
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet TempGroup = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Peasant) or ((Unit-type of (Matching unit)) Equal to Footman)))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet TempString = (Name of (Owner of (Picked unit)))
          • Set VariableSet TempPoint = (Position of (Picked unit))
          • Set VariableSet TempPoint2 = (TempPoint offset by (5.25 x (Real((Length of TempString)))) towards 180.00 degrees.)
          • Set VariableSet TempFtext = (Load (Key text.) of (Key (Picked unit).) in Hashtable)
          • Floating Text - Destroy TempFtext
          • Floating Text - Create floating text that reads (|cffffcc00 + (TempString + |r)) at TempPoint2 with Z offset ((Current flying height of (Picked unit)) + 130.00), using font size 7.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Hashtable - Save Handle Of(Last created floating text) as (Key text.) of (Key (Picked unit).) in Hashtable.
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call RemoveLocation(udg_TempPoint2)
      • Custom script: call DestroyGroup(udg_TempGroup)

giphy.gif
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,887
Why are you using floating texts on point when there is an option for "above units"? You're make it harder.
I didn't really understand your problem with hiding the floating text to enemies, since all you had to do was scroll down and find:
  • Floating Text - Hide (Last created floating text) for (All enemies of (Owner of MyUnit))
Just remember that when you create a floating text it initially shows to all, so no need extras "show" for allies, just "hide" for enemies, since it's your objective.
 
Last edited:
Status
Not open for further replies.
Top