#Pet Spell Range Weakaura

7 messages · Page 1 of 1 (latest)

dull obsidian
#

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.

pallid token
#

Spell lock is weird and has multiple different spellId's that are associated with it. 19647, 132409, 119910, and 251922. You probably need to check for all variations of the spell Id because depending on how it gets activated the spellId might be different.

dull obsidian
#

It's not working. The IsSpellInRange function returns “empty result” for any pet ability using /dump. Not sure what to do. Is there some other function I could use to get the spell range?

pallid token
#

Might could use GetPetActionSlotUsable(slot) not sure if the pet action shows as usable if it's not in range.

#

could also try IsActionInRange(actionSlot)

dull obsidian
#

IsActionInRange(actionSlot) only assesses whether an action is in range of my target right? How could I use this function to tell me whether the action is in range of a specific unit, such as arena1?

dull obsidian
#

I figured it out. Thanks for your help. Do you know if there API's to check whether a unit is in LoS?