Difference between revisions of "AddItem - ObjectReference"
Jump to navigation
Jump to search
imported>Scornett m (Reverted edits by Scornett-Bot (talk) to last revision by Jlundin) |
imported>Thepal |
||
Line 31: | Line 31: | ||
Chest.AddItem(SpecialGemRef) | Chest.AddItem(SpecialGemRef) | ||
</source> | </source> | ||
== Notes == | |||
Don't call this function immediately when a game is started/loaded as it does not seem to work. You can have the game [[Wait_-_Utility|Wait]] a second before doing it which should correct this problem. | |||
== See Also == | == See Also == |
Revision as of 20:33, 7 February 2012
Member of: ObjectReference Script
Adds X of the specified item to this reference's inventory, possibly silently.
Syntax
Function AddItem(Form akItemToAdd, int aiCount = 1, bool abSilent = false) native
Parameters
- akItemToAdd: 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.
- aiCount: How many references to add. Note that this must be one 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
None.
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)
Notes
Don't call this function immediately when a game is started/loaded as it does not seem to work. You can have the game Wait a second before doing it which should correct this problem.