Page 1 of 1

Remove trash script

Posted: Sat Aug 23, 2003 9:38 am
by Neve
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);
    }
}

Posted: Sat Aug 23, 2003 4:13 pm
by The Gray
But then we can't wander into areas and loot the bodies of enemies the characters who were there before us missed.

Posted: Sat Aug 23, 2003 4:24 pm
by Jordicus
that's why the one that Avlis uses waits 5 minutes after the last PC exits the area before it cleans uo...

Posted: Sat Aug 23, 2003 4:59 pm
by Neve
that's why the one that Avlis uses waits 5 minutes after the last PC exits the area before it cleans uo...
Whoops... I didn't know that Avlis has one now =)

Well, just put a localint on the lootbag with the time at that moment, and check for that time at the moment you cleanup if you'd like them to stay there for x hours.