• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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 13
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