generated from Jaysyn/ModuleTemplate
67 lines
1.5 KiB
Plaintext
67 lines
1.5 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Name: Cleanup - On Area Exit
|
|
//:: sc_acleanup_oex
|
|
//:: Copyright (c) 2002 Jeff Narucki
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
This script removes all body bags when the last player
|
|
leaves an area.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Jeff Narucki
|
|
//:: Created On: 8/4/02
|
|
//:://////////////////////////////////////////////
|
|
/* Pc_in_area
|
|
Checks all objects to see if they are PCs in
|
|
the current area.
|
|
|
|
returns:
|
|
TRUE: PC in area
|
|
FALSE: No PC in area
|
|
|
|
*/
|
|
int Pc_in_area() {
|
|
object oPerson=GetFirstObjectInArea();
|
|
|
|
while(oPerson !=OBJECT_INVALID) {
|
|
if(GetIsPC(oPerson))
|
|
return TRUE;
|
|
oPerson=GetNextObjectInArea();
|
|
}
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
/* Delete_bodybags
|
|
Description: Delete all Body Bags left behind
|
|
by monsters and all of their contents.
|
|
*/
|
|
void Delete_bodybags() {
|
|
object obodybag=GetFirstObjectInArea();
|
|
object oInventory;
|
|
|
|
while(obodybag!=OBJECT_INVALID) {
|
|
if(GetTag(obodybag)=="Body Bag") {
|
|
oInventory=GetFirstItemInInventory(obodybag);
|
|
while(oInventory != OBJECT_INVALID) {
|
|
DestroyObject(oInventory);
|
|
oInventory=GetNextItemInInventory(obodybag);
|
|
}
|
|
DestroyObject(obodybag);
|
|
}
|
|
obodybag=GetNextObjectInArea();
|
|
}
|
|
}
|
|
|
|
/******************************************************/
|
|
|
|
int Pc_in_area();
|
|
void Delete_bodybags();
|
|
|
|
void main()
|
|
{
|
|
|
|
if(!Pc_in_area())
|
|
Delete_bodybags();
|
|
}
|