• 🏆 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] FloatingText won't display

Status
Not open for further replies.
Level 15
Joined
Oct 16, 2010
Messages
941
This won't display for a reason which is beyond me :*(

JASS:
function GetDamageText takes unit target returns nothing 
    local texttag dmgtxt
    set dmgtxt = CreateTextTag()
    
    call SetTextTagPosUnit(dmgtxt, target, 0)
    call SetTextTagText(dmgtxt, "hello", 13)
    call SetTextTagVisibility(dmgtxt, true)
    call SetTextTagPermanent(dmgtxt, false)
    call SetTextTagVelocity(dmgtxt, 64, 90)
    call SetTextTagFadepoint(dmgtxt, 1.6)
    call SetTextTagLifespan(dmgtxt, 3)
    call SetTextTagColor(dmgtxt, 255, 255, 255, 0)
endfunction

  • Floating Text Test
    • Events
      • Player - Player 1 (Red) types a chat message containing text as An exact match
    • Conditions
    • Actions
      • Set tempunit = Sage 0014 <gen>
      • Custom script: call GetDamageText(udg_tempunit)
 
Level 14
Joined
Nov 18, 2007
Messages
816
Go and look at how SetTextTagTextBJ works.

JASS:
function SetTextTagTextBJ takes texttag tt, string s, real size returns nothing
    local real textHeight = TextTagSize2Height(size)

    call SetTextTagText(tt, s, textHeight)
endfunction

Also, its a damn good thing texttags dont actually make use of their alpha channel. Else i would have informed you that setting alpha to zero normally makes everything disappear completely.

Edit: Good point about the velocities, WaterKnight.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Font size and velocities are a bit high. GUI/BJ-functions use these conversions:

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

function TextTagSpeed2Velocity takes real speed returns real
    return speed * 0.071 / 128
endfunction

So a GUI font size of 13 would be about 0.0299 using the native function, velocities of 64/90 would be 0.0355/~0.05.

edit: hi deaod
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
For future reference when you're trying to do something that you know can be done in GUI, just take a look at some of blizzard's natives to look at some precautions they may have taken when writing them. They're not always 100% right, but sometimes they'll include something that you wouldn't have thought was related (or that you forgot about).
 
Status
Not open for further replies.
Top