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

[JASS] TextTag - Select Which Players Can See It...

Status
Not open for further replies.
Level 4
Joined
Jun 8, 2007
Messages
89
So, I have a working jass trigger to make Floating Text over a unit's head, however, I have noticed that the Floating Text can be seen through fog of war.
My question is this:
Is there a way that I can make the Floating Text unable to be seen through the Fog of War, or is there a way to display it to only the Players belonging to the Forces that side with the Units involved (attacker and target)? If so, how would I go about doing it?

The Function as it stands is below.

-Thanks in advance
Cov3r70ps

JASS:
function damageText takes unit attacker, unit target, string str, integer red, integer green, integer blue, real life, real fade, integer zoffset returns nothing

    local real x = GetUnitX(attacker)
    local real y = GetUnitY(attacker)
    local texttag tt = CreateTextTag()

    call SetTextTagText(tt, str, 0.023)
    call SetTextTagPos(tt, x, y, 75 + zoffset)
    call SetTextTagVelocity(tt, 0, 0.03)
    call SetTextTagColor(tt, red, green, blue, 255)
    call SetTextTagPermanent(tt,false)
    call SetTextTagFadepoint(tt, fade)
    call SetTextTagLifespan(tt,life)

    set str = null
    set target = null
    set attacker = null
    set tt = null
    
endfunction
 
Level 11
Joined
Apr 6, 2008
Messages
760
JASS:
if IsUnitVisable(blah) then
    if GetLocalPlayer() == Player(GetOwningPlayer(unit) then
         call ShowTextTag(asd)
    endif
endif


should be something like this(not sure) but u have to add a loop and other things.
 
Level 4
Joined
Jun 8, 2007
Messages
89
Thanks, but I'm still not really sure...
What exactly does GetLocalPlayer() do?

Always helps to know waht you are doing. :wink:
 
Level 4
Joined
May 17, 2008
Messages
75
WC3Jass.com :: View script - GetLocalPlayer

For each computer running the game, it returns the player on that computer. Meaning on Player 1's computer it returns Player 1, on Player 2's computer it returns Player 2 etc.

Since it gives a different result on each computer it will cause a desync if used incorrectly.

In the case of texttags, make sure you create the texttag for all players, then add something like this:

call SetTextTagVisibility(tt, not IsUnitFogged(attacker, GetLocalPlayer()))
 
Status
Not open for further replies.
Top