GetFactionLeader(object)
Gets the leader of a players party or the highest CR of a NPC faction.
Parameters
- oMemberOfFaction
- Creature object that is in the party of the leader you are seeking.
Description
Returns the leader of the faction (party) of which oMemberOfFaction is a member.
A leader of a PC party is the one with the crown (which players can change).
A leader of an NPC faction is the highest Challenge Rating member of that faction, even if that creature is in another area or in limbo.
Return value is OBJECT_INVALID if oMemberOfFaction is not a valid creature or some other issue occurs.
Remarks
Mainly to be used to get the leader of a player run party. Usually, the "leader" is hardly ever used, and is merely the person who has control of who to kick from a party more then anything else.
This cannot be reproduced using anything else, and is one of the few totally unique GetFactionXXX() function calls.
If used on an NPC faction it essentially loops all members looking at the CR and the highest CR one is returned (which is reasonably random if multiple creatures have identical CR values).
Version
1.62
Example
// message to the player's party leader, informing them that
// this player has died.
void main()
{
// Get the last player who died
object oPC = GetLastPlayerDied();
// Get their "leader", the one with a little crown
object oLeader = GetFactionLeader(oPC);
// Get the name of the player who died
string sName = GetName(oPC);
// Now, if the leader is valid and NOT the person who died (um,
// duh, who'd want a message about their own death?) then
// send the message.
if(GetIsObjectValid(oLeader) == TRUE &&
oLeader != oPC)
{
SendMessageToPC(oLeader, sName + " has died!");
}
}
See Also
functions: |
author: John Shuell, editor: Jasperre, additional contributor(s): Nils Jeppe, Charles Feduke, Jasperre