OnClose

The script attached to this event fires when the object is closed and can be used to analyze the contents of the container and open a nearby door or raise an alarm after the PC thinks they they have gotten away with the gold scott free.


Trigger

When a door or placeable object has been closed.


Function(s)

GetLastClosedBy() returns the object that closed OBJECT_SELF.


Remarks

Not all placeable objects fire this event; only those that can actually be closed do.


Example

// put in a chest (obviously this will not work on a door)
// if the chest's inventory is empty, give it 100 gold pieces
void main()
{
     // see if we have an item
     object oItem = GetFirstItemInInventory();
     if (!GetIsObjectValid(oItem))
     {
          CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 100);
     }
}

See Also

Objects with Events | Door | Placeable Object
functions: GetLastClosedBy