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

Texttag sometimes do not appear for no reason

Level 9
Joined
May 24, 2016
Messages
299
Hello.

Sometimes texttags do not appear in my map

The script is pretty simple

JASS:
function TextTagSize2HeightJ takes real size returns real
    return size * 0.023 / 10
endfunction


function SetTextTagTextJ takes texttag tt, string s, real size returns nothing
    local real textHeight = TextTagSize2HeightJ(size)

    call SetTextTagText(tt, s, textHeight)
endfunction

function texttagcreate takes nothing returns nothing
local texttag TX 
local string S
set S = ""


if IsPlayerInForce(GetLocalPlayer(),UndeadForce)
set S = "-> Teleportation" //|c00FBE14F-
endif
set TX = CreateTextTag()
call SetTextTagColor(TX, 250, 94, 250, 250) //250
call SetTextTagTextJ(TX, S, 13 ) //14 05
call SetTextTagPos(TX, 12900, 10000, 10)
set TX = null
endfunction
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,023
  • There can only be 99 texttags at a time in a map; it's a special type of handle.
  • You create two texttags every time the texttag function is run (one in the declaration of TX and again below). The first is an error.
  • Neither of the texttags you create are destroyed. The second one should have its permanence disabled and then be given a lifetime (the order matters).
  • Since you never destroy those two texttags, once the 99 have been made no more will show (I think it just overwrites the oldest ones to stay at the 99 cap).

  • Most of this could be inlined; there's no real reason to call two sub-functions here.
  • texttag is a horrible name for a function. You should not give functions names that are defined types or other JASS keywords.
 
Last edited:
Level 9
Joined
May 24, 2016
Messages
299
  • There can only be 99 texttags at a time in a map; it's a special type of handle.
  • You create two texttags every time the texttag function is run (one in the declaration of TX and again below). The first is an error.
  • Neither of the texttags you create are destroyed. The second one should have its permanence disabled and then be given a lifetime (the order matters).
  • Since you never destroy those two texttags, once the 99 have been made no more will show (I don't think it just overwrites the old ones).

  • Most of this could be inlined; there's no real reason to call two sub-functions here.
  • texttag is a horrible name for a function. You should not give functions names that are defined types or other JASS keywords.
Im sorry. I named it "texttag" as function name only for cosmetic purposes to show code on hive

There's also no actual 2 texttag creations. That was also made for cosmetic purposes, to show that I declare a local for that. I made this mistake only in this message, not in actual map function.

About life spam. The textag is intended to be permament, so there's no reason to give life time.
 
Level 9
Joined
May 24, 2016
Messages
299
  • There can only be 99 texttags at a time in a map; it's a special type of handle.
  • You create two texttags every time the texttag function is run (one in the declaration of TX and again below). The first is an error.
  • Neither of the texttags you create are destroyed. The second one should have its permanence disabled and then be given a lifetime (the order matters).
  • Since you never destroy those two texttags, once the 99 have been made no more will show (I don't think it just overwrites the old ones).

  • Most of this could be inlined; there's no real reason to call two sub-functions here.
  • texttag is a horrible name for a function. You should not give functions names that are defined types or other JASS keywords.
I found that texttag may appear for second team,but it's complete random. IDK why, I do not use any GetLocalPlayer things as you can see.
 
Level 39
Joined
Feb 27, 2007
Messages
5,023
The textag is intended to be permament, so there's no reason to give life time.
There can only be 99 texttags at a time in a map; it's a special type of handle. … Since you never destroy those two texttags, once the 99 have been made no more will show (I think it just overwrites the oldest ones to stay at the 99 cap).
Bruh, did you read? That is the fundamental problem with what you’re doing. Why do you need >> 99 permanent texttags in your map? What is the application that makes this necessary?
 
Level 9
Joined
May 24, 2016
Messages
299
Bruh, did you read? That is the fundamental problem with what you’re doing. Why do you need >> 99 permanent texttags in your map? What is the application that makes this necessary?
I did. There's no >99 texttags in my map. Permament texttags number im my map are around 10-20, that's maximum.

This is why I have not responded to that point.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
I don't think anyone is experiencing a floating text bug on the current patch, at least nobody has mentioned it, so it's likely one of two things:

1) You're going over the limit. If you have text tags like floating damage numbers, your own custom crit and miss text, etc, those can overwrite and erase your previously created permanent text - as far as I understand.

2) You're using GetLocalPlayer() incorrectly and can't see the text tags even though they exist.

Remember, things don't just happen "for no reason". There's a reason.
 
Last edited:
Top