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

Problem with Text Tags

Status
Not open for further replies.
Level 6
Joined
Jun 11, 2009
Messages
151
In my trigger, everything works correctly except my text tag part. It shows no errors or anything, it just doesn't create it.

JASS:
globals
    integer rawcode = 'A004' //'Fatal Blow' rawcode.
endglobals

function Trig_Fatal_Blow_Conditions takes nothing returns boolean
    return (GetSpellAbilityId() == rawcode)
endfunction

function Trig_Fatal_Blow_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit() //Caster.
    local unit target = GetSpellTargetUnit() //Target.
    local player casterowner = GetOwningPlayer(caster) //Owner of Caster.
    local real x = GetUnitX(target) //X of Target.
    local real y = GetUnitY(target) //Y of Target.
    local integer bonusgold = (75 * GetUnitAbilityLevel (caster, rawcode)) //Amount of bonus gold.
    local string sfx = "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl" //Effect if killed.
    local texttag text
    
    if (GetRandomInt(1, 100) <= (98 + GetUnitAbilityLevel (caster, rawcode))) then //Chanec to instantly kill.
        call AdjustPlayerStateBJ (bonusgold, casterowner, PLAYER_STATE_RESOURCE_GOLD) //Adding bonus gold.
        call DestroyEffect(AddSpecialEffectTarget (sfx, target, "chest")) //Creating a special effect when killed.
        set text = CreateTextTag()
        call SetTextTagText (text, "|cffff0000Fatal Death!|r", 10.00)
        call SetTextTagVisibility (text, true)
        call SetTextTagPos (text, x, y, 5.00)
        call SetTextTagVelocity (text, 0.061, 128)
        call KillUnit (target) //Killing the Target.
    else
    endif
    call TriggerSleepAction (1.5)
    //Removing leaks.
    call DestroyTextTag (text)
    set caster = null
    set target = null
    set casterowner = null
endfunction

//===========================================================================
function InitTrig_Fatal_Blow takes nothing returns nothing
    local trigger fatalblow = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ (fatalblow, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition (fatalblow, Condition( function Trig_Fatal_Blow_Conditions))
    call TriggerAddAction (fatalblow, function Trig_Fatal_Blow_Actions)
endfunction
 
Level 14
Joined
Jul 26, 2008
Messages
1,009
Well I'd assume it'd be with some of the constants you've inputed into it's position or velocity. It could even be with the textag being too small to even be visible. Not sure, but here is some of the values I'm using. They work very well.

JASS:
    local texttag tag = CreateTextTag()
        call SetTextTagText(tag, "POW!", 0.024)
        call SetTextTagPos(tag, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 0.00)
        call SetTextTagColor(tag, 244, 91, 0, 255)
        call SetTextTagVelocity(tag, 0, 0.04)
        call SetTextTagVisibility(tag, true)
        call SetTextTagFadepoint(tag, 1)
        call SetTextTagLifespan(tag, 1.5)
        call SetTextTagPermanent(tag, false)
    set tag = null
 
Status
Not open for further replies.
Top