LilBlueSmurf
New Member
- Reaction score
- 0
The basic overview of what I am trying to do is this:
When the function is run it creates a textag above a unit.
A periodic timer is made that will update the text to the unit's position every 0.02 seconds as well as changing the text to the units custom value.
After <waitTime> the text and timer are destroyed.
I don't know lag wise if it helps to change the tags instead of destroying/creating new ones each time but I am guessing it does.
Basically what I'm going for is you click a unit and it displays a number overhead that increases each time you click for X time, then something happens and the process would start over. Multiple players will be clicking on multiple (different) units at the same time though.
My obviously non working, probably not much use to start with code/pseudo code is this:
I am coming back after a long time away so I am horribly rusty and didn't even realize you can't pass variables when you do the "function xxx" stuff. If it is easier to start from scratch please free to do so. I don't expect anyone to totally write this for me (unless you feel like it) but I obviously need some big help.
When the function is run it creates a textag above a unit.
A periodic timer is made that will update the text to the unit's position every 0.02 seconds as well as changing the text to the units custom value.
After <waitTime> the text and timer are destroyed.
I don't know lag wise if it helps to change the tags instead of destroying/creating new ones each time but I am guessing it does.
Basically what I'm going for is you click a unit and it displays a number overhead that increases each time you click for X time, then something happens and the process would start over. Multiple players will be clicking on multiple (different) units at the same time though.
My obviously non working, probably not much use to start with code/pseudo code is this:
JASS:
function refreshCounter takes unit target, texttag t returns nothing
local point tempPoint = GetUnitLoc(target)
set t = I2S(GetUnitUserData(target))
call SetTextTagPosBJ( t, tempPoint, 10.00 )
call RemoveLocation(tempPoint)
endfunction
function killCounter takes timer pTimer, texttag t returns nothing
call DestroyTimer(GetExpiredTimer())
call DestroyTimer(pTimer)
call DestroyTextTag(t)
endfunction
function newCounter takes unit target, real w returns nothing
local timer pTimer = CreateTimer()
local texttag t = CreateTextTagUnitBJ(I2S(GetUnitUserData(target)), target, 10, 11, 80.0, 80.0, 100.0, 0 )
call SetTextTagVelocityBJ( t, 0, 0 )
call SetTextTagPermanentBJ( t, true )
call TimerStart(pTimer, 0.02, true, function refreshCounter(target, t))
call TimerStart(CreateTimer(), w, false, function killCounter(pTimer, t))
endfunction
I am coming back after a long time away so I am horribly rusty and didn't even realize you can't pass variables when you do the "function xxx" stuff. If it is easier to start from scratch please free to do so. I don't expect anyone to totally write this for me (unless you feel like it) but I obviously need some big help.