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

[Solved] Floating Text issue

Status
Not open for further replies.
So this is not working.
JASS:
set LumberText = CreateTextTag()
call SetTextTagText(LumberText, I2S(FF_Lumber_Amount[id]), .023) //the formula is apparently size * 0.023 / 10. So a size of 10 would be... 0.023
call SetTextTagPos(LumberText, GetUnitX(Ent), GetUnitY(Ent), 60.00)
call SetTextTagColor(LumberText, 0, 153, 0, 255) //is 255 alpha fully visible or fully transparent?
call SetTextTagLifespan(LumberText, 4.0)
call SetTextTagFadepoint(LumberText, 2.0)
call SetTextTagVelocity(LumberText, 64 * Cos(1.5708), 64 * Sin(1.5708))
call SetTextTagVisibility(LumberText, true)
/*call SetTextTagVisibility(LumberText, false) //This has been commented out because I don't know if I'm using GetLocalPlayer() correctly
if GetLocalPlayer() == GetOwningPlayer(Ent) then
    call SetTextTagVisibility(LumberText, true)
endif*/

I've only ever used GUI floating text so I'm a bit lost with the JASS version. For instance, this part converted from GUI works without any problems:

JASS:
set LumberText = CreateTextTagUnitBJ( I2S(FF_Lumber_Amount[id]), Ent, 0, 10.0, 0.00, 60.00, 0.00, 0 )
call SetTextTagVelocityBJ( LumberText, 90.00, 90 )
call SetTextTagLifespan(LumberText, 4.0)
call SetTextTagFadepoint(LumberText, 2.0)
call ShowTextTagForceBJ( false, LumberText, GetPlayersAll() )
call ShowTextTagForceBJ( true, LumberText, GetForceOfPlayer(GetOwningPlayer(Ent)) )
 
Last edited by a moderator:
Level 14
Joined
Jul 1, 2008
Messages
1,314
I am succesfully using this script in my maps:

JASS:
function TextTag_FadingFunc takes real TargX, real TargY, string msg, real Size, real zOffset, real duration, integer red, integer green, integer blue, integer transparency, player ShowToPlayer, boolean WantsPermanent, integer mode returns texttag
    local texttag t = CreateTextTag()
    call SetTextTagText( t, msg, Size * ( 0.023 / 10.0))
    call SetTextTagPos( t, TargX, TargY, zOffset)
    call SetTextTagColor( t, red, green, blue, transparency)
    call SetTextTagPermanent( t, WantsPermanent )
    call SetTextTagLifespan( t, duration)
    call SetTextTagFadepoint( t, 1.00 )
    // Set Text fade according to presets
    if mode == 0 then
        call SetTextTagVelocityBJ( t, 64, 90 )
    elseif mode == 1 then
        // no fading
    endif
    // if player specified, show only to local player, else show to everybody
    if ShowToPlayer == null then
        call SetTextTagVisibility( t,true)
    else
        call SetTextTagVisibility( t, GetLocalPlayer() == ShowToPlayer)
    endif
    return t
endfunction

and call it e.g. like this:
JASS:
set udg_TempTextTag = TextTag_AboveUnit( axe, I2S( damage2), 22.00, 100.00, 1.70, 255, 100, 100, 170, null, 1)

I thought, 255 alpha is fully visible ...

edit: Oh and I am setting the texttag to a global in order to destroy it later.
 
Status
Not open for further replies.
Top