• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[JASS] FloatingText won't display

Status
Not open for further replies.
Level 15
Joined
Oct 16, 2010
Messages
942
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)
 
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.
 
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
 
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.
Back
Top