Thread Tools Display Modes
03-26-09, 08:21 AM   #1
Darthgnomer
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 7
How do you find out a NPC's faction?

How do you find out a NPC's faction?

If I mouse over a NPC in the Scryer area of Shatt or one of the many mage looking NPCs in Dalaran my cursor tooltip will reveal their faction such as 'The Scryers' or 'Kirin Tor' for these examples respectively.

How can I find out this information for an addon? I've looked around the APIs on WoWWiki and tried to reverse engineer CowTip but I am lost. Any information or simple examples would be very appreciated.
  Reply With Quote
03-26-09, 09:41 AM   #2
Tristanian
Andúril
Premium Member
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 279
I think UnitFactionGroup("unit") is what you are looking for.

http://www.wowprogramming.com/docs/api/UnitFactionGroup
__________________
  Reply With Quote
03-26-09, 12:26 PM   #3
Darthgnomer
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 7
No, this only returns Alliance or Horde; tested it out with a Night Elf armor merchant located in Darnassus and instead of coming back 'Darnassus' it came back 'Alliance'.
  Reply With Quote
03-26-09, 12:46 PM   #4
Gemini_II
A Molten Giant
 
Gemini_II's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 762
Be sure that the NPC you test against actually has a faction, as many of them do not.
__________________
Retired prior to 3.2, before all challenge was removed.

  Reply With Quote
03-26-09, 12:58 PM   #5
Darthgnomer
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 7
When I moused over the NPC the default Blizzard tooltip said 'Darnassus'. According to wowhead Cylania <Night Elf Armorer> has a Faction of 'Darnassus'.
Source: http://www.wowhead.com/?npc=4164

Also, I tried this with a vendor in Dalaran with a faction of 'Kirin Tor' and still got 'Alliance'.

I believe there is a different method I need to find what faction a NPC belongs to.
  Reply With Quote
03-26-09, 01:04 PM   #6
Gemini_II
A Molten Giant
 
Gemini_II's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 762
Looks like GetFactionInfo is what you want...
__________________
Retired prior to 3.2, before all challenge was removed.

  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How do you find out a NPC's faction?


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