Aller au contenu

Photo

GetIsRosterNameInParty and IsInParty


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
andysks

andysks
  • Members
  • 1 650 messages

Hi all.

What would be the difference between these two functions existing in ginc_companion?

I'll post them here so that people won't have to go searching.

int GetIsRosterNameInParty(object oPC, string sRosterName)
{
    object oCompanion = GetObjectFromRosterName(sRosterName);
	return (GetFactionEqual(oPC, oCompanion));
}
// This function should only be used to check if roster members are in the party
// This function is unfortunately named (generic name for a specific funtion), 
// but is to entrenched to rename.
int IsInParty(string sRosterName)
{
	object oPC = GetFirstPC();
	return (GetIsRosterNameInParty(oPC, sRosterName));
	
/*
	object oFM = GetFirstFactionMember(oPC, FALSE);
    object oCompanion = GetObjectFromRosterName(sRosterName);
    
	while(GetIsObjectValid(oFM))
	{
		if(oFM == oCompanion)
		{
			return 1;
		}
		oFM = GetNextFactionMember(oPC, FALSE);
	}
	return 0;
*/
}

I can see that the IsInParty actually uses the GetIsRosterNameInParty, but I wonder why it even exists if the GetIsRosterNameInParty could do the job on its own, and which of these two would be better to use.

Thanks.



#2
rjshae

rjshae
  • Members
  • 4 491 messages

Perhaps the first is used for multi-player?



#3
4760

4760
  • Members
  • 1 207 messages
The way I understand them, "IsInParty" will only check in the player's party, with oPC being set to GetFirstPC() in the function body, whereas you could check someone else's party with the call to the other function after having set oPC yourself first (in which case it will tell if they belong to the same faction).

#4
andysks

andysks
  • Members
  • 1 650 messages

Thanks for the brainstorming :). I guess the best clue is that GetFirstPC();

So if I want to see if a companion is there with the FirstPC I have to call the second. IsInParty.