Background for Skyrim SE
Member of the ObjectReference script
voidfunctionAddItem(FormakItemToAdd, intaiCount=1, boolabSilent=false)Native

[DEV SERVER] Loading description...


Caveats

CK Wiki - Notes

  • An item added to a respawning chest using AddItem will most likely not appear. This is due to the chest resetting its contents every day or so. If the player has not talked to the merchant recently, their inventory will reset before they see the item in it.
  • Don't call this function immediately when a game is started/loaded as it does not seem to work. You can have the game Utility.Wait(...) a second before doing it which should correct this problem.
  • akItemToAdd can be a LeveledItem. Removal of a LeveledItem, however won't work with ObjectReference.RemoveItem(...) and the members of the LeveledItem must be passed individually as akItemToRemove.
  • As of Skyrim version 1.6, it is no longer possible to use AddItem to add an Object or ObjectReference of type Container to the player's inventory.

Parameters

FormakItemToAdd

CK Wiki Description

The base form add to this reference's inventory. If this is a base object, it will add a newly-created item. If it is a reference, it will move/remove it from own place/container to this container. If a form list, then it will add aiCount of each item in the list.

intaiCount=1

CK Wiki Description

How many references to add. Note that this must be one if you are passing in an object reference.

boolabSilent=false

CK Wiki Description

If true, no message will be printed to the screen


Examples

; Add a two diamonds to the player's inventory, silently
Game.GetPlayer().AddItem(Diamond, 2, true)
; Move the special gem reference from wherever it is into the chest
Chest.AddItem(SpecialGemRef)

Auto-Generated Example

Form myForm__akItemToAdd
int myInt__aiCount
bool myBool__abSilent

myObjectReference__toCallFunctionOn.AddItem(myForm__akItemToAdd, myInt__aiCount, myBool__abSilent)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.