View Single Post
10-20-18, 09:52 AM   #1
neheri
A Murloc Raider
Join Date: Oct 2018
Posts: 5
How to check if Unit target is player

Hello,

I would like to edit nameplate addon to change colour when unit targets a player. For example there are 4 units attacking a player and 2 of them not. 4 units should have one colour and other different one.

if UnitTarget == Player then
-- player targeted colour stuff
else
-- player not targetted

How to achieve that?

I was trying with if UnitIsPlayer(UnitName("targettarget")) then

however it works only with unit you target. If you switch a target to some other unit, it works as if player was not targetted, while he is.