34 lines
1.0 KiB
Plaintext
34 lines
1.0 KiB
Plaintext
// see if cleanup ok
|
|
void main()
|
|
{
|
|
object oPC=GetExitingObject();
|
|
object oArea=OBJECT_SELF;
|
|
object oFirst=GetFirstObjectInArea(oArea);
|
|
object oH;
|
|
int nC;
|
|
if (GetObjectType(oFirst)!=OBJECT_TYPE_WAYPOINT) oFirst=GetNearestObject(OBJECT_TYPE_WAYPOINT,oFirst,1);
|
|
if (GetIsPC(oPC)==TRUE)
|
|
{ // PC left
|
|
oH=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oFirst,1,CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC);
|
|
if (oH==OBJECT_INVALID)
|
|
{ // cleanup
|
|
nC=1;
|
|
oH=GetNearestObject(OBJECT_TYPE_ITEM,oFirst,nC);
|
|
while(oH!=OBJECT_INVALID)
|
|
{ // destroy items
|
|
DelayCommand(1.0,DestroyObject(oH));
|
|
nC++;
|
|
oH=GetNearestObject(OBJECT_TYPE_ITEM,oFirst,nC);
|
|
} // destroy items
|
|
nC=1;
|
|
oH=GetNearestObjectByTag("PIRATE",oFirst,nC);
|
|
while(oH!=OBJECT_INVALID)
|
|
{ // destroy pirates
|
|
DelayCommand(1.0,DestroyObject(oH));
|
|
nC++;
|
|
oH=GetNearestObject(OBJECT_TYPE_ITEM,oFirst,nC);
|
|
} // destroy pirates
|
|
} // cleanup
|
|
} // PC left
|
|
}
|