How to tell Horde or Alliance?
This may have been asked before, but I tried finding it, and drew a blank...
What I'd like to know is what function to call to figure out if a character you play is Horde or Alliance. Basically, I'm saving skill information, but don't think it's very useful showing the skills for Alliance chars when playing a Horde char on the same server, so I'd like to differentiate between the two of them. Assistance would be appreciated. :) |
I think you have to make use of UnitRace("unit") and check for raceEN.
|
|
Fun facts:
UnitFactionGroup("player") is available only after PLAYER_LOGIN, whereas UnitRace("player") is always available. So if you need to check your own faction at the beginning, you'd have to check: local _,race = UnitRace("player") local faction = (race == "TAUREN" or race == "ORC" or race == "TROLL" or race == "SCOURGE") and FACTION_HORDE or FACTION_ALLIANCE |
Thanks for the tips. I haven't quite managed to get things working, but... I'll keep you posted. :)
|
It looks like I managed to get this to work. So thanks for all the help. :)
I was suprised though that: local faction = (UnitRace("player") == "TAUREN" or race == "ORC" or race == "TROLL" or race == "SCOURGE") and FACTION_HORDE or FACTION_ALLIANCE Doesn't seem to work. Must be my being new to LUA, is can anyone willing to explain to me why it doesnt'work? |
Quote:
Code:
local _, race = UnitRace("player") |
All times are GMT -6. The time now is 10:29 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI