Difference between revisions of "AddItem"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>JOG
(You can use reference-variables for ObjectID !)
imported>JOG
Line 1: Line 1:
=='''Description'''==
Adds ''Count'' items of object ''ObjectID'' to the calling container's inventory.


Adds ''Count'' items of object ''ObjectID'' to the calling container's inventory.


<br>
'''Syntax:'''
=='''Syntax'''==
  AddItem ''ObjectID'', ''Count''  
  AddItem ''ObjectID'', ''Count''  


<br>
 
=='''Examples'''==
'''Examples:'''
  AddItem MyObject, 1
  AddItem MyObject, 1


Line 18: Line 16:
  player.additem MyItem Count
  player.additem MyItem Count


<br>
 
=='''Notes'''==
'''Notes:'''


* You can use a [[Variable_types:_reference_variables|reference variable]] as ''ObjectID'' and a [[Variable_types:_shortint|short]] variable for ''count''.  
* You can use a [[Variable_types:_reference_variables|reference variable]] as ''ObjectID'' and a [[Variable_types:_shortint|short]] variable for ''count''.  
Line 47: Line 45:




==Reference==


[[AddItem_Reference|List of functions that use AddItem]] (wiki)
==See Also==
[[RemoveItem]]
 
[[AddItem_Reference|List of functions that use AddItem]]




[[Category: Functions]]
[[Category: Functions]]
[[Category: Object Functions]]
[[Category: Object Functions]]

Revision as of 12:52, 6 June 2006

Adds Count items of object ObjectID to the calling container's inventory.


Syntax:

AddItem ObjectID, Count 


Examples:

AddItem MyObject, 1
Ref MyItem
Short count

set MyItem to ArenaAkaviriLongSword
set count to 1
player.additem MyItem Count


Notes:

  • This will not trigger OnAdd blocks, because the item is created inside the inventory rather than actually being added. For creating items from the console that you need to trigger OnAdd, use PlaceAtMe instead and pick the item up from the ground.

Console Usage: When using AddItem with the console, you must use the desired item's FormID, not the EditorID.

So, instead of using

player.additem lockpick 1

to give yourself a lockpick, you must use

player.additem 00000A 1

Kedrigh wrote: [1]

Form id is in the cs and looks like this: yyxxxxxx.

yy is used to reference the plugin, xxxxxx to reference the item inside the plugin (and does not change). So if you load the oblivion master in the cs, and create something, it will have 01xxxxxx as the form id.

The yy part of the formid changes depending on the mods you load up, in the order in which they load.




See Also

RemoveItem

List of functions that use AddItem