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

Disconnect the locally floating texts if it is in function?

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
i want reduce the potentional heavy traffic when i use floating texts in gui damage engine so planed i try this, but i cant teest it in multiplayer so i ask if this make dc or no?

if IsUnitVisible(u, GetLocalPlayer()) then

floating text header function
JASS:
function FT takes string txt, real fsize, unit u, integer speed, integer red, integer green, integer blue, integer alpha returns nothing
    local real x
    local real y 
    local real diff 
    local texttag tt 
if IsUnitVisible(u, GetLocalPlayer()))  then
    set x = GetUnitX( u )
    set y = GetUnitY( u )
    set diff = StringLength( txt ) * fsize / 2.00 + 1
    set tt = CreateTextTag( )
    call SetTextTagText( tt, txt, fsize * 0.023 )
    call SetTextTagPos( tt, x - diff, y, 100.00 )
    call SetTextTagColor( tt, red, green, blue, alpha )
    call SetTextTagPermanent( tt, false )
    call SetTextTagLifespan( tt, 4.50 )
    call SetTextTagFadepoint( tt, 2.50 )
    call SetTextTagVelocity( tt, speed * 0.71 / 128 * Cos( 3.14159 / 2 ), speed * 0.71 / 128 * Sin( 3.14159 / 2 ) )
    set tt = null
endif
endfunction

another question if i dont destroy the floating text in this case, then its isnt leak ? because have life span but have destroy floating text in gui too
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
JASS:
if IsUnitVisible(u, GetLocalPlayer())  then

You can not assign visibility to a unit per player, this would cause a desynchronization. However IsUnitVisible doesn't check for the "visibility" of the unit but for the acquisition range of that player's units in order to "see" that unit.

When I have a unit that has a sight range of 500 and a acquisition range of 100, then IsUnitVisible will only be true when it's closer than 100. So I don't think this would cause a desynchronization. Please correct me if I'm wrong though...
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
No, IsUnitVisible refers to whether the unit is not fogged/masked nor invisible through an ability to that player (nor hidden in general).

Even if that block was synchron, it would not cause net traffic. Nothing is broadcasted there. It only lessens the local stress marginally. Texttags are completely async, so they do not cause desyncs. Lifespan clears the texttag up automatically.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
No, IsUnitVisible refers to whether the unit is not fogged/masked nor invisible through an ability to that player (nor hidden in general).

Even if that block was synchron, it would not cause net traffic. Nothing is broadcasted there. It only lessens the local stress marginally. Texttags are completely async, so they do not cause desyncs. Lifespan clears the texttag up automatically.

Thank you, yet again I've learned something new :)
 
Even if that block was synchron, it would not cause net traffic. Nothing is broadcasted there. It only lessens the local stress marginally. Texttags are completely async, so they do not cause desyncs. Lifespan clears the texttag up automatically.
Are you 100% sure? Texttags are handles and handles got an ID and thus need to be synchronized. He is creating texttags in a local block, so it will desync for sure.

Btw: As text tags are limited to 100 instances at the same time anyway, you shouldn't bother about net traffic here. The traffic will not be noticable.
You may edit some texttag attributes locally, but do not create or set the lifespan of texttags locally.

Use synchronized texttags and simply hide/show them locally. Everything else is just stupid.
 
Status
Not open for further replies.
Top