RATDOG/_module/nss/sparky_exit.nss
Jaysyn904 6195a6cf23 Bugfixing pass
Bugfixing pass.  Spawn swapovers.  Broom!
2021-09-25 14:13:00 -04:00

38 lines
1.1 KiB
Plaintext

/* Generic area onExit script for use with the Sparky Spawner scripting
Created By: The Amethyst Dragon (www.amethyst-dragon.com/nwn)
Can be used for the onExit script for all areas of a module. If you already
have your own area enter script, you can add just the include and the
"Sparky Spawner" Sections of code (one function, one bit of code to execute).
This searches the area for remaining PCs, and if it doesn't find any, it
despawns all the things in the area created by the Sparky spawner.
*/
#include "sparky_inc"
//////////////////////////////////////////////// Sparky Spawner Section 1 of 2
int CheckForPCs()
{
object oPC = GetFirstPC();
while (oPC != OBJECT_INVALID)
{
if (GetArea(oPC) == OBJECT_SELF) { return TRUE; }
oPC = GetNextPC();
}
return FALSE;
}
//////////////////////////////////////////////// End Sparky Section 1 of 2
void main()
{
object oArea = OBJECT_SELF;
//////////////////////////////////////////////// Sparky Spawner Section 2 of 2
if (CheckForPCs() == FALSE) { Despawn(oArea); }
//////////////////////////////////////////////// End Sparky Section 2 of 2
}