• 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.

[JASS] TextTag Help

Status
Not open for further replies.
Level 6
Joined
Mar 20, 2008
Messages
208
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.

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
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
Its in the measure of screen size (one of the deminsions). This is because screen position actually goes from 0 to 1 as a floating point. Text of size 1 will fill your whole screen while text of size 0 will be non existant. This is the same for the spacing in multiboards. It is not blizzard's fault but is actually part of how games work and so it is technically your fault for trying outragous numbers.

I however do admit the GUI and JASS ways of doing it differ alot and should actually be made to be identical. In GUI you should use the same units as JASS does to avoid such confusion as this.
 
Level 6
Joined
Mar 20, 2008
Messages
208
I popped in .023 in and it shows up fine. Just gotta get it to track the unit which shouldn't be a problem.

Thanks
 
Status
Not open for further replies.
Top