RemoveItem - ObjectReference

From the CreationKit Wiki
Revision as of 17:56, 24 October 2011 by imported>Jlundin
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Member of: ObjectReference Script

Removes X of the specified item from this reference's inventory, possibly silently.

Syntax

Function RemoveItem(Form akItemToRemove, int aiCount = 1, bool abSilent = false, ObjectReference akOtherContainer = None) native

Parameters

  • akItemToRemove: The item (or base form) to remove from this reference's inventory. If a reference is passed, the reference is deleted once it's removed.
  • aiCount: How many references to remove.
    • Default: 1
  • abSilent: If true, no message will be printed to the screen
    • Default: false
  • akOtherContainer: If not None, the removed item(s) will be moved into this ref's inventory
    • Default: None

Return Value

None.

Examples

; Take away an apple
Chest.RemoveItem(Apple)


; Remove 50 gold from the player
Game.GetPlayer().RemoveItem(GoldBase, 50)

Notes

  • The function accepts a form object, however you can't make a property to a form object, you need to create a property to another type of object that extends form. Most often a MiscObject, or Weapon, etc.
  • If you pass in a form list, it will remove aiCount of each item in the form list from the container. If there isn't aiCount of a particular item in the container, it will remove all of them.

See Also