Remove trash script
Posted: Sat Aug 23, 2003 9:38 am
Place this in an OnExit of an area. If a player triggers the OnExit, the function will check wether there are players in the area. If not, all the remains will be emptied and removed.
Code: Select all
/*
August 21 - 2003 - Raiko - zeiren@hotmail.com
This script removes remains on exiting an area
*/
void main(){
object oArea = GetArea(OBJECT_SELF);
object oRemains = GetFirstObjectInArea(oArea);
object oInventory;
while(oRemains != OBJECT_INVALID){
if(GetIsPC(oRemains)) return;
oRemains = GetNextObjectInArea(oArea);
}
oRemains = GetFirstObjectInArea(oArea);
while(oRemains != OBJECT_INVALID){
if(GetName(oRemains) == "Remains"){
SetPlotFlag(oRemains, FALSE);
oInventory = GetFirstItemInInventory(oRemains);
while(oInventory != OBJECT_INVALID){
DestroyObject(oInventory);
oInventory = GetNextItemInInventory(oRemains);
}
}
oRemains = GetNextObjectInArea(oArea);
}
}