Tassie Wombat wrote...
Thanks for the responses. Lightfoot8 I completely missed that I had removed the check for oPC being the exiting object ... that's what I get for cobbling several scripts together at 2am.
Is this version any better?
void main()
{
object oExiting = GetExitingObject();
object oTarget = GetFirstObjectInArea();
if (GetIsPC(oExiting))
{
while (GetIsObjectValid(oTarget) == TRUE)
{
if (GetIsPC(oTarget))
{
return;
}
if (GetIsEncounterCreature(oTarget) == TRUE)
{
DestroyObject(oTarget);
}
if (GetObjectType(oTarget) == OBJECT_TYPE_ENCOUNTER)
{
SetEncounterActive(TRUE, oTarget);
}
}
oTarget = GetNextObjectInArea();
}
}
Nope, That one is worse.
You will get a TMI error when the script runs. The changing of oTarget is out side of the while loop.
It will destroy encounter creatures untill it hits a PC even if the oTarget is inside of the loop. You need to verify that a PC is not in the area before you start destroying any creatures.