I’m going nuts. I’ve looked for an hour now in the toolset for a function that checks if a certain NPC is in the party at the moment but I can’t find any. I might be blind…
I mean, he is not a companion so that must mean he’s not part of the roster…right?
What I’m trying to do is when, or if, the PC and the party tries to leave an area I want to do a script that checks that if the NPC is in the party I don’t want them to be able to leave.
Arrghh, this is so frustrating. This should be, and probably is, easy, but I’m about to give up now…
Gc_is_in_party(), takes npc tag. Might require an include in your script but I don’t think it does. It’s a stock game script.
int bIsInParty = GetIsObjectValid(oTarget)
&& GetIsObjectValid(GetFactionLeader(oTarget));
GetFactionLeader() gets a player-controlled creature, so if oTarget has a valid leader it’s in a PC-party.
Thank you guys! Honestly, I don’t know how I could forget to check all the gc scripts.
It probably works by now, but just to clarify… Will the gc_is_in_party distinguish between companion or other NPCs?
object oPC = GetPCSpeaker();
object oTarget = GetTarget(sTargetTag, TARGET_OWNER);
int bRet = GetFactionEqual(oPC, oTarget);
return (bRet);
it checks if the object w/ the tag that’s spec’d is in the party with the PCSpeaker.
GetFactionEqual(GetPCSpeaker(), GetTarget(sTag));
if sTag is left blank, it checks if the dialog-owner is in the party with PCSpeaker.
either way the PCSpeaker will be a controlled-character and hence pc-faction
not necessarily… sorta depends how you want to define “companion” and “NPC”
I guess companion = roster NPC. But it shouldn’t matter since it only checks tag.
If you are checking from a dialog, then use the “gc_is_in_party” script.
Otherwise make a script similar to this:
void main()
{
object oTarget = GetObjectByTag("place_companion_tag_here");
if (GetFactionEqual(GetFirstPC(), oTarget))
{
//companion is in party, so do this.
}
else
{
//companion is NOT in party, so do this.
}
}
How to extend this script to have companions give benefits when in party? And stays in effect throughout the whole OC.
Like having Neeshka increases gold from loot bags and chests etc. greedy am I