Difference between revisions of "RemoveAllItems - ObjectReference"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>RobinHood70
(Undo revision 28038 by Cwalton (talk))
 
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.)
Line 29: Line 29:
Game.GetPlayer().RemoveAllItems(abKeepOwnership = true)
Game.GetPlayer().RemoveAllItems(abKeepOwnership = true)
</source>
</source>
== Notes ==
*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.


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

Revision as of 08:16, 25 September 2016

Member of: ObjectReference Script

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

Syntax

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

Parameters

  • 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

None.

Examples

; 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

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

See Also