Are both objects in the same faction?
First object to compare.
Second object to compare against. (Default: OBJECT_SELF)
Returns TRUE if the Faction Ids of the two objects are the same.
Remember, each new PC party has a separate Id, as does each separate faction for NPC's.
It doesn't matter which way round oFirstObject and oSecondObject are used.
A great way to tell if another approaching creature is in the same faction as the calling object.
This is best used, in the upmost sense, to make sure NPC's do not attack their actual allies that they should never go hostile to. It is a shame the default AI therefore doesn't use it.
It can also be used by NPC's in a PC's party to, for example, check if they are being attacked by their masters friends, or for example, should help one being over another because they are in their party (faction).
// creature is in our faction, but *not* our master, we will not
// allow them to change anything but we will allow them to talk
// normally to us.
// Get the PC speaker
object oPC = GetPCSpeaker();
// Get our master
object oMaster = GetMaster(OBJECT_SELF);
// Check faction and master status
// * Will return TRUE if they are equal, but not our master
if(GetFactionEqual(oTarget, OBJECT_SELF) == TRUE &&
oMaster != oPC)
// Return TRUE
// Nope, just some guy - who still might be our master, however.
author: John Shuell, editor: Jasperre, additional contributor(s): Jasperre