Difference between revisions of "AddItem - ObjectReference"
Jump to navigation
Jump to search
imported>Ianman11 (Added note about formlist not working) |
imported>Qazaaq m (Format notes section as unordered list.) |
||
Line 35: | Line 35: | ||
== Note == | == Note == | ||
Making ''akItemToAdd'' a form list does not work resulting in "error: (<formlistID>): cannot be put in a container." regardless if defined or cast as one. Using the console version "additem" does work however. | *Making ''akItemToAdd'' a form list does not work resulting in "error: (<formlistID>): cannot be put in a container." regardless if defined or cast as one. Using the console version "additem" does work however. | ||
== See Also == | == See Also == |
Latest revision as of 10:27, 6 April 2017
Member of: ObjectReference Script
Adds X of the specified item to this reference's inventory, possibly silently.
Syntax[edit | edit source]
Function AddItem(Form akItemToAdd, int aiCount = 1, bool abSilent = false) native
Parameters[edit | edit source]
- akItemToAdd: The form to 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 its place/container to this container. If it is a form list, then it will add aiCount of each item in the list.
- Note: This can accept non-persistent references in containers.
- aiCount: How many references to add. Note that this must be 1 if you are passing in an object reference.
- Default: 1
- abSilent: If true, no message will be printed to the screen
- Default: false
Return Value[edit | edit source]
None.
Examples[edit | edit source]
; Add 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)
Note[edit | edit source]
- Making akItemToAdd a form list does not work resulting in "error: (<formlistID>): cannot be put in a container." regardless if defined or cast as one. Using the console version "additem" does work however.