Difference between revisions of "OnItemRemoved - ObjectReference"
Jump to navigation
Jump to search
imported>Plplecuyer |
imported>Scrivener07 (→Notes: Pointing to OnItemEquipped for those who come to this page seeking for a solution to catch the use consumable items.) |
||
(One intermediate revision by one other user not shown) | |||
Line 22: | Line 22: | ||
if !akDestContainer | if !akDestContainer | ||
Debug.Trace("I dropped " + aiItemCount + "x " + akBaseItem + " into the world") | Debug.Trace("I dropped " + aiItemCount + "x " + akBaseItem + " into the world") | ||
elseif | elseif akDestContainer == Game.GetPlayer() | ||
Debug.Trace("I gave the player " + aiItemCount + "x " + akBaseItem) | Debug.Trace("I gave the player " + aiItemCount + "x " + akBaseItem) | ||
else | else | ||
Line 31: | Line 31: | ||
== Notes == | == Notes == | ||
*You must use [[AddInventoryEventFilter - ObjectReference|AddInventoryEventFilter]] to receive this event, letting it know what items you care about. | *You must use [[AddInventoryEventFilter - ObjectReference|AddInventoryEventFilter]] to receive this event, letting it know what items you care about. | ||
*If you're looking to catch the use of consumable items, use [[OnItemEquipped - Actor]]. | |||
== See Also == | == See Also == |
Latest revision as of 16:15, 3 February 2021
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[edit | edit source]
Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
Parameters[edit | edit source]
- 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[edit | edit source]
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[edit | edit source]
- You must use AddInventoryEventFilter to receive this event, letting it know what items you care about.
- If you're looking to catch the use of consumable items, use OnItemEquipped - Actor.