Thread: Scripting Help
View Single Post
Old 11-29-2004, 08:52 AM   #2
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 41
Posts: 5,459
I'm not 100% certain of the intent, but I assume you mean it should fire once for each party as opposed to once for each PC.

Quote:
int DoOnce = GetLocalInt(oPC, GetTag(OBJECT_SELF));

if (DoOnce==TRUE) return;

SetLocalInt(oPC, GetTag(OBJECT_SELF), TRUE);
This bit is used to remember whether or not the event has already fired for a PC. It sets a variable with the name of the area's tag to 1 on the PC. One thing you could do then is to cycle through the PC's party members to see if someone else already has this variable set to 1, and if so, not to fire the script.

To do that, add something like this above the quoted area.

Quote:
object oTest = GetFirstFactionMember(oPC);
while(GetIsObjectValid(oTest))
{
if(GetLocalInt(oTest, GetTag(OBJECT_SELF)))
{
return;
}
oTest = GetNextFactionMember(oPC);
}
The creature will still spawn if the other player enters at a time when he/she is not in a party with the player who triggered the spawn.

Alternatively, if you only want to have one creature spawning at a time regardless of party, set the variable on the area (OBJECT_SELF) instead of on the PC. You can always reset it later on by setting the variabnle to 0.
Legolas is offline   Reply With Quote