Hi,
I am trying to make a weakaura that shows the cooldown of my pet's ability Spell Lock, and importantly I want it to change to the colour red when it is out of range of arena1. I am using this custom code in the colour section:
function(progress,r1,g1,b1,a1)
local name = GetSpellInfo(6215) -- Change to spell ID of respective ability.
local isRange = IsSpellInRange(name,'arena1')
if (UnitExists('arena1') and not UnitIsFriend('arena1','player') and not UnitIsDead('arena1')) then
if (isRange == 1) then
return r1,g1,b1,a1
else
return 1,0,0,1
end
end
end
The weakaura works perfectly fine when the spellID is for Fear. But when I change the spellID from Fear to Spell Lock, (so I change 6215 to 19647), the colour changing part of the weakaura just doesn't work properly.
Is it failing because of the fact that it's a pet spell or something?
Any help would be appreciated.