50 lines
1.4 KiB
Plaintext
50 lines
1.4 KiB
Plaintext
////////////// Maze Exit
|
|
void fnPurgeItems(object oNear)
|
|
{ // cleanup items
|
|
int nC;
|
|
object oOb;
|
|
nC=1;
|
|
oOb=GetNearestObject(OBJECT_TYPE_ITEM,oNear,nC);
|
|
while(oOb!=OBJECT_INVALID)
|
|
{
|
|
DelayCommand(1.5,DestroyObject(oOb));
|
|
nC++;
|
|
oOb=GetNearestObject(OBJECT_TYPE_ITEM,oNear,nC);
|
|
}
|
|
nC=1;
|
|
oOb=GetNearestObject(OBJECT_TYPE_PLACEABLE,oNear,nC);
|
|
while(oOb!=OBJECT_INVALID)
|
|
{
|
|
DelayCommand(1.5,DestroyObject(oOb));
|
|
nC++;
|
|
oOb=GetNearestObject(OBJECT_TYPE_PLACEABLE,oNear,nC);
|
|
}
|
|
} // fnCleanup()
|
|
|
|
|
|
void main()
|
|
{
|
|
object oPC=GetExitingObject();
|
|
object oArea=OBJECT_SELF;
|
|
object oNear=GetWaypointByTag("MAZE_SPAWN1");
|
|
object oTest;
|
|
int bDestroyDoor=FALSE;
|
|
int nC;
|
|
if (GetIsPC(oPC)==TRUE)
|
|
{ // PC exited
|
|
oTest=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oNear,2,CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC);
|
|
if (oPC==OBJECT_INVALID)
|
|
{ // not a second PC
|
|
oTest=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oNear,1,CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC);
|
|
if (oTest==OBJECT_INVALID||oTest==oPC) bDestroyDoor=TRUE;
|
|
} // not a second PC
|
|
if (bDestroyDoor==TRUE)
|
|
{ // destroy the door
|
|
oTest=GetLocalObject(oArea,"oDoor");
|
|
if (oTest!=OBJECT_INVALID) DestroyObject(oTest);
|
|
DeleteLocalObject(oArea,"oDoor");
|
|
fnPurgeItems(oNear);
|
|
} // destroy the door
|
|
} // PC exited
|
|
}
|