Basically it goes like this.
Hero A casts a spell on Hero B
Hero A and Hero B have texttags placed above their heads that display the text of an integer variable
Every second of game time, the integer ticks down by 1
When one of the timers runs out, the respective hero will die.
It will find the trigger, but the text tags never show up.
I remember seeing a unit speech function somewhere awhile ago but I can't seem to find the function (I'm not even sure if its a native/BJ one)
Any help is appreciated.
I tried the alpha value as 0 or 100, with no change in results.
Hero A casts a spell on Hero B
Hero A and Hero B have texttags placed above their heads that display the text of an integer variable
Every second of game time, the integer ticks down by 1
When one of the timers runs out, the respective hero will die.
It will find the trigger, but the text tags never show up.
I remember seeing a unit speech function somewhere awhile ago but I can't seem to find the function (I'm not even sure if its a native/BJ one)
Any help is appreciated.
I tried the alpha value as 0 or 100, with no change in results.
JASS:
function ShBC takes nothing returns boolean
return GetSpellAbilityId() == 'A04J'
endfunction
function ShBA takes nothing returns nothing
local texttag t1 = CreateTextTag()
local texttag t2 = CreateTextTag()
local unit u = GetTriggerUnit()
local unit z = GetSpellTargetUnit()
set udg_SBcaster = u
set udg_SBtarget = z
if(GetUnitAbilityLevel(u, 'A04J') == 2) then
set udg_SBcount1 = 160
endif
call SetTextTagText(t1,I2S(udg_SBcount1),20)
call SetTextTagText(t2,I2S(udg_SBcount2),20)
call SetTextTagColor(t1,255,0,0,100)
call SetTextTagColor(t2,255,0,0,100)
call SetTextTagPosUnit(t1,u,100)
call SetTextTagPosUnit(t2,z,100)
call SetTextTagVisibility(t1,true)
call SetTextTagVisibility(t2,true)
call EnableTrigger(gg_trg_SK_Bat1)
call EnableTrigger(gg_trg_SK_Bat2)
loop
exitwhen udg_SBcount1 < 1 or udg_SBcount2 < 1 or GetUnitState(u, UNIT_STATE_LIFE) < 1 or GetUnitState(z, UNIT_STATE_LIFE) < 1
call SetTextTagText(t1,I2S(udg_SBcount1),20)
call SetTextTagText(t2,I2S(udg_SBcount2),20)
set udg_SBcount1 = udg_SBcount1 - 1
set udg_SBcount2 = udg_SBcount2 - 1
call TriggerSleepAction(1)
endloop
if(udg_SBcount1 < 1) then
call KillUnit(u)
elseif(udg_SBcount2 < 1) then
call KillUnit(z)
endif
//resets the timers so the hero can cast again
set udg_SBcount1 = 120
set udg_SBcount2 = 120
//These triggers just add to the count when a hero uses an ability
call DisableTrigger(gg_trg_SK_Bat1)
call DisableTrigger(gg_trg_SK_Bat2)
call DestroyTextTag(t1)
call DestroyTextTag(t2)
set t1 = null
set t2 = null
set u = null
set z = null
endfunction