I can’t get my head around on how to make a NPC engaged in conversation with a PC, adress the pc with a different greeting if the PC is in a party with other PC’s or henchmen. Here is my attempt at making a script:
int StartingConditional() { return GetFactionLeader(GetObjectByTag("oPC")) == GetPCSpeaker(); }
Almost there, but you can’t refer to the PC by tag. The correct syntax is
int StartingConditional()
{
object oPC = GetPCSpeaker();
return GetFactionLeader(oPC) == oPC;
}
I’m not very familiar with GetFactionLeader() but on paper it should identify the lead PC.
If it matters whether the PC has henchmen, the additional test is
GetIsObjectValid(GetHenchman(oPC))
There are potentially 6 cases:
PC is alone
PC is the boss of other PCs
PC is with other PCs but not boss
each x PC has / has no henchmen
The logic depends on which of those cases you need to identify.
Yeah, GetFactionLeader()
identifies the “leader” PC in multiplayer who can control party membership (adds and boots other players). It also seems to be the only way to tell if two PCs are in such party. In singleplayer its the fastest way to find the topmost PC master of an NPC (master of master’s master, etc).
This means that the easiest way to do a binary “PC alone” / “PC not alone” check is to loop all members of PC faction and compare their “leader” with the “leader” of GetPCSpeaker()
(with an extra check if only henchmen are to be counted rather than all assoc types).
EDIT: see x0_i0_partywide
for reference. Be aware however that those functions apply to PCs only and to all PCs on the server regardless of their party association.