HoS_PRC8/_mod/_module/nss/ox_maze.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

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
}