- 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