Thread Tools Display Modes
12-28-19, 07:11 PM   #1
BryanM42
A Defias Bandit
Join Date: Dec 2019
Posts: 3
Target of Target's name?

Currently, I have the following snippet of code that works perfectly and tells me what I want to know:

if UnitExists("target") and (UnitIsUnit("targettarget", "player") or UnitIsUnit("targettarget", "pet")) then

I'd like to add functionality that would also return true if the target of my target is a specific name (for example, "Vim Brineheart"). Is that a possibility? I tried using UnitName, but I must have messed up the code somewhere because it broke the originally working bit. Here's what I tried though:

if UnitExists("target") and (UnitIsUnit("targettarget", "player") or UnitIsUnit("targettarget", "pet") or UnitIsUnit(UnitName("targettarget", "Vim Brineheart"))) then
  Reply With Quote
12-28-19, 09:26 PM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
You only feed units into those functions. UnitName returns the name.

if UnitName("targettarget") == "Vim Brineheart" then
  Reply With Quote
12-29-19, 12:34 AM   #3
BryanM42
A Defias Bandit
Join Date: Dec 2019
Posts: 3
Originally Posted by Kanegasi View Post
You only feed units into those functions. UnitName returns the name.

if UnitName("targettarget") == "Vim Brineheart" then
ahhhh ... okay. That makes sense. Thank you!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Target of Target's name?

Thread Tools
Display Modes

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