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

[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