How do I get the unit the player has targeted?

I’m looking for a way to find out what unit the player has targeted.

Right now you can use GetVictim() but that requires the player to have actually attacked something. What I’m trying to do is just find out what the player has targeted (either by tab-target or clicking) but may not actually be in combat with.

I plan on using the result in some comparison logic in the PetAI.



Please note that this relies entirely on the client’s CMSG_SET_SELECTION and can be misleading sometimes (its usually right, tho).

Wow, can’t believe I missed that one. Thanks.

Please mark my post as the “Best answer” please :>


The only options I have are “Report”, “Edit”, “Multiquote”, “Quote”, “Selective Quote”