Difference between revisions of "OnItemRemoved - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Sollar
imported>LukeH
Line 14: Line 14:
*akBaseItem: The base object for the item that was removed from this container.
*akBaseItem: The base object for the item that was removed from this container.
*aiItemCount: The number of items 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.
*akItemReference: The specific reference removed from the container, if any. Will be None if a non-persistant object is moved to a different container, used in crafting, (most likely) when consumed. If a non-persistant item is dropped from inventory into the world the generated reference is received.
*akDestContainer: The container that the object(s) went to. If None, then the object was dropped into the world.
*akDestContainer: The container that the object(s) went to. If None, then the object was dropped into the world, used in crafting or consumed.


== Examples ==
== Examples ==

Revision as of 07:42, 3 April 2013

Member of: ObjectReference Script

Event received when an item is removed from this object's container.

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 moved to a different container, used in crafting, (most likely) when consumed. If a non-persistant item is dropped from inventory into the world the generated reference is received.
  • akDestContainer: The container that the object(s) went to. If None, then the object was dropped into the world, used in crafting or consumed.

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

  • If you only care about certain kinds of objects, you should also use AddInventoryEventFilter to filter out any events for things you aren't interested in.

See Also