40 lines
1.6 KiB
Plaintext
40 lines
1.6 KiB
Plaintext
|
/*Starting conditional to test to make sure party members are close by in MP
|
||
|
games. Thanks to Warleader_6 for bringing this to my attention, and to Jack
|
||
|
Gorman for some of the scripts that were part of his Legs-of-the-trip script*/
|
||
|
|
||
|
//This is the inverse of otres_cond for the "cannot travel" dialog
|
||
|
//Custom tag functionality not needed since tags are not used in the dialog this shows
|
||
|
|
||
|
|
||
|
int StartingConditional()
|
||
|
{
|
||
|
object oTalker=GetPCSpeaker();
|
||
|
int bEncounterDone=GetLocalInt(oTalker,"bEncounterDone");
|
||
|
if (!(bEncounterDone)) //Allows for a flag to keep the PC in the random encounter - set it to false in the OnEnter event for the area or encounter
|
||
|
return FALSE;
|
||
|
object oFM=GetFirstFactionMember(oTalker);
|
||
|
oFM=GetNextFactionMember(oTalker);
|
||
|
if (oFM==OBJECT_INVALID) //single player
|
||
|
return FALSE;
|
||
|
|
||
|
// Loop to check each party members distance from the PC.
|
||
|
while (GetIsObjectValid(oFM))
|
||
|
{//begin while loop
|
||
|
// Skip dead party members
|
||
|
if (!GetIsDead(oFM))
|
||
|
{//begin not dead if
|
||
|
int iDistanceCheck = FloatToInt(GetDistanceToObject(oFM));
|
||
|
// Check to see if oPartyMember is within 10 meters. If not, send
|
||
|
// the message and exit the conditional as TRU.
|
||
|
if (iDistanceCheck > 10)
|
||
|
{//begin distance check if
|
||
|
// If all party members are not present do not show travel dialog
|
||
|
return TRUE;
|
||
|
}//end distance check if
|
||
|
}//end not dead if
|
||
|
oFM = GetNextFactionMember(oTalker);
|
||
|
}//end while loop
|
||
|
//if all within 10 m show the travel dialog
|
||
|
return FALSE;
|
||
|
}
|