How to check if Unit target is player
View Single Post
10-20-18, 02:05 PM
A Pyroguard Emberseer
Join Date: Sep 2007
In your nameplate addon you will have a unitID associated with every nameplate that you're drawing.
When a nameplate is shown, the
event will fire, and provide the unitID as its first argument. This can be passed to
to get the frame associated with the nameplate unit. That frame is what your addon is attaching to in order to draw its own nameplate above the unit's head.
events are used to track when to create a new nameplate frame, when to show and hide your addon's frames, and to keep track of which unitIDs belong to which nameplates.
When coloring your nameplates you generally have a series of conditions that need to be checked in a certain order, so "unit is targeting me" which you want to represent with one color might be a higher priority than "unit is a hostile npc" which has a different color, and therefor needs to take precedence over it.
In my personal addon I just do this check OnUpdate because I don't particularly care about efficiency, but how you do this is up to you.
Last edited by semlar : 10-20-18 at
View Public Profile
Send a private message to semlar
Find More Posts by semlar