Get the object faction member with the lowest armor class.
The object whose faction you wish to search through (Default: OBJECT_SELF)
Does the returned object have to be visible to the caller? (Default: TRUE)
Returns an object representing the faction (or party) member with the lowest armor class. Will only return the member with the lowest AC that is visible to the object calling the function if bMustBeVisible is set to TRUE (default).
Return OBJECT_INVALID if oFactionMember's faction is invalid.
Again, a great function to use in your NPC Combat scripts. This one can sic your creatures on the easiest to hit target, or even use with a henchman spellcaster to determine which member of his master's party needs more protection.
It can also be used to attack the lowest AC, but noting that range is not taken into account and thusly possibly only ranged attackers could use it wisely.
This will work exactly the same was as using GetFirst/NextFactionMemeber() and using GetAC(), to find the lowest, only is much easier to code and probably better on performance.
Try to never use this on an NPC faction unless bMustBeVisible is TRUE, 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.
This used to cause a crash pre-1.64, and now it should not.
// how bad in combat they must do.
// Get faction to check
object oPC = GetPCSpeaker();
// Get the lowest (Seen) AC member
object oHighest = GetFactionWorstAC(oPC, TRUE);
// Speak to them
SpeakString("Ho ho! " + GetName(oHighest) + " looks like a right pin cushion!");
author: John Shuell, editor: Jasperre, additional contributor(s): Jasperre