GetNextFactionMember(object, int)
Obtains the next member of the faction that a creature is a member of.
object GetNextFactionMember( object oMemberOfFaction, int bPCOnly = TRUE );
Parameters
oMemberOfFaction
Creature to determine which faction we want.
bPCOnly
If TRUE then the returned faction member will be a PC, if FALSE then the search will include both PCs and NPCs. (Default: TRUE)
Description
Returns the next member of oMemberOfFaction's faction and OBJECT_INVALID if oMemberOfFaction or oMemberOfFaction's faction is invalid.
Remarks
You must call GetFirstFactionMember with the same parameters before using this function.
If bPCOnly is TRUE the returned faction member will be a PC. If bPCOnly is FALSE, it will only do non-PC faction members.
Never use this on an NPC faction! There would be dozens more objects in even the smallest custom faction compared to a PC party. If used, use with caution!
Version
1.29
Example
// This code shows how you can cycle through all the party // members of the first PC in the module. // This will ONLY get PC members - any associates (Henchmen, // familiars, summoned creatures and so on) will not be got by // this loop. If the bPCOnly was FALSE in this script, it would ONLY // get henchmen, familiars and so on for the faction. void main() { // We alway use the SAME object for the GetFirst/Next faction // member calls - always define it first. Here it is the first PC. object oPC = GetFirstPC(); // Get the first PC party member object oPartyMember = GetFirstFactionMember(oPC, TRUE); // We stop when there are no more valid PC's in the party. while(GetIsObjectValid(oPartyMember) == TRUE) { // Do something to party member // Get the next PC member of oPC's faction. // If we put anything but oPC into this, it may be a totally // unreliable loop! oPartyMember = GetNextFactionMember(oPC, TRUE); } }
See Also
functions: | GetFirstFactionMember |
categories: | Reputation/Faction Functions |
author: Tom Cassiotis, editor: Jasperre, additional contributor(s): Tom Smallwood, Mike Daneman