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

Fog of war & floating texts??

Status
Not open for further replies.
Level 19
Joined
Apr 25, 2006
Messages
1,309
Is there any way to make floating texts appear only if they are placed where the player can see it, in other words is there a way to place a floating text inside fog of war and make the player not able to see the text??
 
Level 20
Joined
Feb 24, 2009
Messages
2,999
Have the text's transparency set to 100%, until unit comes within 'x' at which point check to see if unit/area is visible to player (if so, set transparency to 0%), reverse to hide again?

Wouldn't work with multiple players though (unless they all shared vision), sadly, which I assume is your intention?

Hmm, in GUI:

  • Text
    • Events
      • Unit - A unit enters Maximum LOS <gen>
    • Conditions
      • ((Center of Floating Text Loc <gen>) is visible to Player 1 (Red)) Equal to True
    • Actions
      • Floating Text - Change the color of (Last created floating text) to (100.00%, 100.00%, 100.00%) with 0.00% transparency
 
Last edited:
  • Text
    • Events
      • Unit - A unit enters Maximum LOS <gen>
    • Conditions
      • ((Center of Floating Text Loc <gen>) is visible to Player 1 (Red)) Equal to True
    • Actions
      • Floating Text - Change the color of (Last created floating text) to (100.00%, 100.00%, 100.00%) with 0.00% transparency

You can do this:
  • Floating Text - Show (Last created floating text) for (All players)
  • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
  • Floating Text - Hide (Last created floating text) for (All players)
  • Custom script: endif
To basically show it only for the unit entered.

If you want to currently check and only make it if there are units in range of the location, just use a unit group. Pick every unit within 512 range of <Location>. Then just check if the units in the group is greater than 0, and show the text for the owner of the picked unit. If you do that, make sure you change GetTriggerUnit() to GetEnumUnit().
 
Level 19
Joined
Apr 25, 2006
Messages
1,309
I don't remember I saw this before but I wonder if just this would work. Though I can't test this before I get a second player.
  • Floating Text - Hide (Last created floating text) for Player Group - Player 1 (Red)
 
Yeah, Black Mask is a little pain in the a** and I couldn't work around with it, even if I tried both Visibility - Enable Black Mask and Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Black mask across (Playable map area).

So, I only worked with Fog of War. Why did I involve fog of war and black mask in the initialization: It's because the timer should be really low in value, which is idiot to spend so much memory for only this effect. So, when I created the floating text, it was visible to me, although I tried many times to hide it. Even though the updating timer worked fine, the creation of the floating text didn't let me hide it instantly. Then I had to walk towards the units, to reveal their position and then the updating timer did the job normally. In the end, I realized I had to "debug" a bit, by emitting custom fog and removing it afterwards.
Here is the final result (works flawlessly, but unfortunately, I couldn't mess anymore with black mask, because it kept ruining the result you wanted):
View attachment Floating Text Hidden within Fog of War.w3x
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
this should work all the time (however the text will still be shown if a unit could see it and then loses sight but forgetting the text is unlikely to be required anyway

  • Fog
    • Events
      • Time - Every 0.30 seconds of game time
    • Conditions
    • Actions
      • -------- The trigger needs a unit and a string to show the text at the given point --------
      • Set s = text
      • Set u = Blood Mage 0002 <gen>
      • Trigger - Run LocalTextTagUnit <gen> (ignoring conditions)
      • -------- The trigger needs a point and a string to show the text at the given point --------
      • Set s = text2
      • Set loc = (Position of Blood Mage 0003 <gen>)
      • Trigger - Run LocalTextTagPoint <gen> (ignoring conditions)
      • Custom script: call RemoveLocation(udg_loc)
  • LocalTextTagPoint
    • Events
    • Conditions
    • Actions
      • -------- Create text --------
      • Floating Text - Create floating text that reads s at loc with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • -------- Hide text for everyone --------
      • Floating Text - Hide (Last created floating text) for (All players)
      • -------- If the point is visible for a player --------
      • Custom script: if IsLocationVisibleToPlayer(udg_loc, GetLocalPlayer()) then
      • -------- The text will be shown again --------
      • Custom script: call SetTextTagVisibility(bj_lastCreatedTextTag, true)
      • Custom script: endif
      • -------- Usually these actions are applied anyway --------
      • -------- It might be possible to place them in the if (you just have to add "else") but it might cause desync (most likely not) and i didnt test it --------
      • Floating Text - Set the velocity of (Last created floating text) to 120.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 3.00 seconds
  • LocalTextTagUnit
    • Events
    • Conditions
    • Actions
      • -------- Create text --------
      • Floating Text - Create floating text that reads s above u with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • -------- Hide text for everyone --------
      • Floating Text - Hide (Last created floating text) for (All players)
      • -------- If the unit is visible for a player --------
      • Custom script: if IsUnitVisible(udg_u, GetLocalPlayer()) then
      • -------- The text will be shown again --------
      • Custom script: call SetTextTagVisibility(bj_lastCreatedTextTag, true)
      • Custom script: endif
      • -------- Usually these actions are applied anyway --------
      • -------- It might be possible to place them in the if (you just have to add "else") but it might cause desync (most likely not) and i didnt test it --------
      • Floating Text - Set the velocity of (Last created floating text) to 120.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 3.00 seconds
 

Attachments

  • text.w3x
    13.3 KB · Views: 34
Status
Not open for further replies.
Top