AddItem

Revision as of 06:20, 11 May 2007 by imported>DragoonWraith (forgot to change some stuff from c'n'p)

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


Syntax:

[ActorID|ContainerID.]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.
  • By default, using this function on the player will display a message informing the player that the item in question has been added. In many situations, this is very annoying, but you can use a blank Message call to prevent it from happening, like so:
Message ""
player.AddItem "item ID" 1

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.

Appler: FormID is also listed in Oblivion Mod Manager. This saves you the trouble of counting all your mods, and translating that into hex.

  • Note: The yy part of the formID is only relevent in user-created plugins, not offical plugins, offical plugins "use" the same yy part of the form ID as the main data file(oblivion.esm) - 00.




See Also

RemoveItem

GetItemCount


Reference

List of existing scripts that use AddItem