Hoping to get a little help because I’ve been struggling with this one for a while now.
function()
local region = aura_env.region
local plate = C_NamePlate.GetNamePlateForUnit(“target”)
local start, duration, enabled = GetSpellCooldown(“Shield Block”)
local defend = UnitAura(“player”, “Defensive Stance”)
if plate then
region:ClearAllPoints()
region:SetPoint(“CENTER”, plate, “CENTER”, 84,0)
if duration == 0 then
region:Show()
if defend then
region:Show()
else
region:hide()
end
else
region:Hide()
end
else
region:Hide()
end
return true
end
Adding the defend variable and placing a dependency on it to show the region ensures it currently never will appear. (Sorry about the egregious nested if statements. I wanted an explicit hide command for any of the possible reasons NOT to show the region/texture.)
Using Weakauras, of course.
You should be getting an error.
Usage: UnitAura("unit", [index][, "filter"])
https://wow.gamepedia.com/API_UnitAura
I am getting an error but not sure what to do about it. Please forgive me for my lack of know how. I have looked at that url and not sure what Im doing wrong.
Probably better to use:
local defend = AuraUtil.FindAuraByName("Defensive Stance", "player")
A few months ago weakauras added an option for anchoring to a custom frame. I would use that instead of using the trigger to mess with the anchor.
Set Display > Position Settings > Anchored to to custom and put this in the code box
function()
return C_NamePlate.GetNamePlateForUnit("target")
end
Then you can use the built in aura and cooldown triggers.
https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Anchor
Thank you very much. That worked. There are two things, though, that seem a bit wonky with using the built-in anchoring approach:
- No matter what frame strata I place the aura in, all nameplates appear in front of these textures. That means with multiple mobs, I can’t see it. That problem didnt exist with the custom trigger approach.
- switching targets doesnt always switch the texture. The custom trigger always kept the textures on the currently selected target.