Im trying to make floating text that follows a unit for 1 second. I've been experimenting and testing around for a few hours now, and no luck searching google. This does makes floating text follow a unit for 1 second, the problems are:
1) following text is not very smooth, as in blinking. The lifespan of text cannot go lower than 0.03 otherwise there wont be anything.
2) seems that when the function floattext is called a second time do display a second following text, it crashes (memory access error)
3) Oh and it feels like this is very unefficient, a text tag is created every 0.01 seconds <-- cannot destroy text tag in floattextfollow function otherwise will render texttag useless "sigh"
so can anyone have a look guide me on them points?
tyvm
BTW
waitFunc is a wait function, i cannot use TriggerSleepAction or PollWait outside of triggers otherwise would halt *for some reason*. waitFunc works successfully destroying the timer after 1 second
1) following text is not very smooth, as in blinking. The lifespan of text cannot go lower than 0.03 otherwise there wont be anything.
2) seems that when the function floattext is called a second time do display a second following text, it crashes (memory access error)
3) Oh and it feels like this is very unefficient, a text tag is created every 0.01 seconds <-- cannot destroy text tag in floattextfollow function otherwise will render texttag useless "sigh"
so can anyone have a look guide me on them points?
JASS:
function floatTextFollow takes nothing returns nothing
local integer p = GetHandleInt(GetExpiredTimer(), "p")-1
local texttag t = CreateTextTag()
local string s = GetHandleString(GetExpiredTimer(), "s")
call SetTextTagText ( t, s , 0.02)
call SetTextTagColor( t ,255,220,220,255)
if (IsPlayerInForce(GetLocalPlayer(), GetForceOfPlayer(Player(p)))) then
call SetTextTagVisibility(t,true)
else
call SetTextTagVisibility(t,true)
endif
call SetTextTagLifespan(t,0.03)
call SetTextTagPermanent(t,false)
call SetTextTagPos( t, GetUnitX(udg_CPU), GetUnitY(udg_CPU,0)
//call SetTextTagFadepoint(t,1)
//call SetTextTagVelocity(t,0.01,.04)
endfunction
function floatText takes string s, integer p returns nothing
local timer t = CreateTimer()
call SetHandleInt(t, "p", p+1)
call SetHandleString(t, "s", s)
call TimerStart(t, 0.01, true, function floatTextFollow)
call waitFunc(1)
call DestroyTimer(t)
//call FlushHandleLocals(t)
set t = null
endfunction
waitFunc is a wait function, i cannot use TriggerSleepAction or PollWait outside of triggers otherwise would halt *for some reason*. waitFunc works successfully destroying the timer after 1 second