Page 1 of 1

what is the /script equivalent of player:target_NPC("X")

Posted: Sat Aug 31, 2013 4:51 pm
by Cindy
Trying my hand at an addon, can't seem to find what api the bot calls for target_NPC?

Re: what is the /script equivalent of player:target_NPC("X")

Posted: Sat Aug 31, 2013 7:33 pm
by kkulesza
Bot doesn't call rom api in this case.

If you want to do it with api then this two functions might be handy:
TargetNearestFriend()
UnitName("target")

Re: what is the /script equivalent of player:target_NPC("X")

Posted: Sat Aug 31, 2013 9:25 pm
by Cindy
Oh, I want to target a specifc NPC by name (to bring up their quest menu) and there may be other "friends" around...

Re: what is the /script equivalent of player:target_NPC("X")

Posted: Sat Aug 31, 2013 9:38 pm
by BlubBlab

Re: what is the /script equivalent of player:target_NPC("X")

Posted: Sun Sep 01, 2013 12:55 am
by rock5
kkulesza is correct. You would have to use those functions in a loop until you've targeted the desired target. Something like,

Code: Select all

local name = "wanted target name"
TargetNearestFriend()
local first = UnitName("target")
repeat
    TargetNearestFriend()
until UnitName("target") == name or UnitName("target") == first
if UnitName("target") == name then
    UseSkill(1,1)
else
    SendSystemChat("Target not found")
end