Difference between revisions of "RemoveAllItems - ObjectReference"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>Goggle
m (→‎Examples: Notes about calling this on objects that aren't loaded, and the function deleted all items if akTransferTo is in a different cell.)
imported>Illyism
 
(One intermediate revision by one other user not shown)
Line 32: Line 32:
== Notes ==
== Notes ==
*The calling object and akTransferTo must be loaded.  
*The calling object and akTransferTo must be loaded.  
*If akTransferTo is in a different cell from the calling object, this function will still remove all items, but they are not transferred to the new container. They will be deleted instead.
*If akTransferTo is not loaded in memory, for example if not persisted and in an unloaded cell, the items will be deleted instead.
*If (akTransferTo = None) is specified, the container will silently clear/empty/remove all contents.


== See Also ==
== See Also ==

Latest revision as of 14:55, 20 March 2020

Member of: ObjectReference Script

Removes all items from this object's inventory, optionally transferring them to another object.

Syntax[edit | edit source]

Function RemoveAllItems(ObjectReference akTransferTo = None, bool abKeepOwnership = false) native

Parameters[edit | edit source]

  • akTransferTo: The object to transfer the items we removed to.
    • Default: None
  • abKeepOwnership: Should the item's ownership be kept when moved to the other object?
    • Default: False

Return Value[edit | edit source]

None.

Examples[edit | edit source]

; Remove all items from the chest
ChestProperty.RemoveAllItems()


; Remove all items from the player's inventory, but keep ownership information
Game.GetPlayer().RemoveAllItems(abKeepOwnership = true)

Notes[edit | edit source]

  • The calling object and akTransferTo must be loaded.
  • If akTransferTo is not loaded in memory, for example if not persisted and in an unloaded cell, the items will be deleted instead.
  • If (akTransferTo = None) is specified, the container will silently clear/empty/remove all contents.

See Also[edit | edit source]