Thread Tools Display Modes
10-29-22, 03:43 PM   #1
fatal120
A Murloc Raider
Join Date: Oct 2022
Posts: 4
How to check when target/focus changes status

Hey,

I'm trying to work out how to monitor when my target or focus change status (i.e., from friendly to hostile or vice-versa), and also which of target/focus it was.

This occurs in a fair few situations, for example when beginning/ending a duel or when a boss goes friendly (instead of dying) when you finish the fight.

I have been using /etrace, but I can't find anything that seems consistent. There are some events like:
Code:
PLAYER_SOFT_FRIEND_CHANGED
PLAYER_SOFT_ENEMY_CHANGED
but I'm not even sure what they do.

The thing I'm trying to do is change the colours of the hostile/friendly nameplates. So if there isn't an event, perhaps someone can think of another method?

Would appreciate some help, thanks.

Last edited by fatal120 : 10-29-22 at 04:19 PM.
  Reply With Quote
10-29-22, 03:45 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
https://wowpedia.fandom.com/wiki/PLAYER_TARGET_CHANGED

https://wowpedia.fandom.com/wiki/PLAYER_FOCUS_CHANGED
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
10-29-22, 03:49 PM   #3
fatal120
A Murloc Raider
Join Date: Oct 2022
Posts: 4
Neither of those events fire when my existing target/focus change from friendly to hostile or vice-versa
  Reply With Quote
10-29-22, 04:33 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
https://wowpedia.fandom.com/wiki/UNIT_FLAGS
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
10-29-22, 04:34 PM   #5
fatal120
A Murloc Raider
Join Date: Oct 2022
Posts: 4
Originally Posted by Fizzlemizz View Post
What am I looking for? I don't see that event changing in /etrace
  Reply With Quote
10-29-22, 06:26 PM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
Originally Posted by fatal120 View Post
I'm trying to work out how to monitor when my target or focus change status (i.e., from friendly to hostile or vice-versa), and also which of target/focus it was.
The target frames use UNIT_FACTION to check when to update their "ReputationColor".

Originally Posted by fatal120 View Post
The thing I'm trying to do is change the colours of the hostile/friendly nameplates. So if there isn't an event, perhaps someone can think of another method?
A common problem with NamePlates is a lot of unit events don't fire for them. This is the reason for a long standing bug where existing NamePlates fail to update their state when a unit turns hostile or friendly.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » How to check when target/focus changes status


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off