RemoveAllItems - ObjectReference

Member of: ObjectReference Script

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

SyntaxEdit

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

ParametersEdit

  • 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 ValueEdit

None.

ExamplesEdit

; 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)

NotesEdit

  • 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 AlsoEdit