OnItemRemoved - ObjectReference
Revision as of 22:32, 1 June 2016 by imported>Docclox (→Examples: it should of course be akDestContainer, not akSourceContainer. Please take care when copying examples from other Wiki pages!)
Member of: ObjectReference Script
Event received when an item is removed from this object's container. Only arrives if it matches an inventory filter in place on the script receiving the event.
Syntax
Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
Parameters
- akBaseItem: The base object for the item that was removed from this container.
- aiItemCount: The number of items removed from this container.
- akItemReference: The specific reference removed from the container, if any. Will be None if a non-persistant object is removed.
- akDestContainer: The container that the object(s) went to. If None, then the object was dropped into the world.
Examples
Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
if !akDestContainer
Debug.Trace("I dropped " + aiItemCount + "x " + akBaseItem + " into the world")
elseif akDestContainer == Game.GetPlayer()
Debug.Trace("I gave the player " + aiItemCount + "x " + akBaseItem)
else
Debug.Trace("I gave " + aiItemCount + "x " + akBaseItem + " to another container")
endIf
endEvent
Notes
- You must use AddInventoryEventFilter to receive this event, letting it know what items you care about.