GetFactionMostFrequentClass(object)

Returns a constant representing the most common type of class amongst the members of a faction (party).

int GetFactionMostFrequentClass(
    object oFactionMember
);

Parameters

oFactionMember

The object whose faction you wish to compare.


Description

Returns the most frequent class in the faction - this can be compared with the constants CLASS_TYPE_*.

Return value on error: -1



Remarks

Might be good for statistics reporting or odds averaging. It could also be used to analyse if there was a greater amount of a cirtain class to another class, although not very well as usually multiclassed characters can skew what primary classes PC's take - with this function, if everyone had 1 fighter level (yet several of a different level, eg mage or rogue) then it would return the fighter class regardless.

This will work exactly the same was as using GetFirst/NextFactionMemeber() and using GetClassByPosition(), adding it up for all different classes in all different slots, only is much easier to code and probably better on performance.

Try to never use this on an NPC faction, only a PC's party faction, because NPC factions usually have dozens of NPC's, and thus may cause a lot of high CPU usage with faction calls such as this.


Version

1.62

Example

// If the most common class in a PC's party is that of "Fighter", then
// say so, else don't.

void main()
{
    // Get PC speaker
    object oPC = GetPCSpeaker();

    // Check frequent class
    if(GetFactionMostFrequentClass(oPC) == CLASS_TYPE_FIGHTER)
    {
         // Say something
         SpeakString("Woah, a lot of fighters we have here");
    }
}

See Also

functions: GetFactionAverageLevel
categories: Get Data from Creature Functions | Party Functions | Reputation/Faction Functions
constants: CLASS_TYPE_* Constants


 author: John Shuell, editor: Jasperre, additional contributor(s): Jasperre