• 🏆 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!

[Solved] Is there a way to hide floating text to enemies or if there is a fog (details inside)

Status
Not open for further replies.
Level 17
Joined
Jun 2, 2009
Messages
1,141
Hello everyone. I know how to TempPoint and TempGroup works and i know how to clean these. But i am not experienced with Floating Texts. First of all is that leaks?

  • Actions
    • Floating Text - Create floating text that reads TEST! at (Position of (Triggering unit)) with Z offset 0.00, using font size 11.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
    • Floating Text - Set the velocity of (Last created floating text) to 85.00 towards 90.00 degrees
    • Floating Text - Change (Last created floating text): Disable permanence
    • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
    • Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
My question is how to prevent them visible by enemies within specific situations
You are playing your game, you are fighting with creatures and you know enemy cannot see you because of the fog of war.
But if someone try to look your position, they can see your floating text within fog.
Is there a way to prevent this?

Alternatively i can send it as message to players but i prefer make it with FloatingText first.
 
Level 39
Joined
Feb 27, 2007
Messages
5,023
  • Floating Text - Change (Last created floating text): Disable permanence
  • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
These two lines (which you are already doing) are the only things that need to be done to properly clean up a floating text to prevent any leaks. You must disable permanence before setting the lifespan (which you are doing correctly), otherwise it will not work.

Floating Text can safely be created and hidden locally, so you can just do this to only show it for one player:
  • Set FTPlayer = (Owner of (Triggering Unit)) //or however you determine which player it should be shown for
  • Custom script: if GetLocalPlayer() == udg_FTPlayer then //make sure to match the variable name here
  • Floating Text - Show (Last created floating text)
  • Custom script: endif
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
There is a boolean condition to check if a unit can be seen by a specific player. You can iterate over all players and check that condition like so:
  • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Your_Unit is visible to (Picked player).) Equal to True
        • Then - Actions
        • Else - Actions
The condition is under 'Boolean comparison' section, called 'Visibility - Unit Is Visible To Player'
 
Status
Not open for further replies.
Top