Difference between revisions of "AddItem"

1,110 bytes removed ,  19:40, 28 March 2010
→‎Console Usage: Moved some text to the discussion page
imported>Haama
(More standardizing)
imported>Shademe
(→‎Console Usage: Moved some text to the discussion page)
 
(5 intermediate revisions by 5 users not shown)
Line 20: Line 20:
* This function will trigger an [[onAdd]] block in a script attached to the target container, as long as the container is in a loaded cell. When used on a container in a remote cell, the [[onAdd]] block won't run until the player enters that container's cell. However, if the player enters the remote cell after saving and loading, the onAdd block won't run.
* This function will trigger an [[onAdd]] block in a script attached to the target container, as long as the container is in a loaded cell. When used on a container in a remote cell, the [[onAdd]] block won't run until the player enters that container's cell. However, if the player enters the remote cell after saving and loading, the onAdd block won't run.
** Note that this is only true for the onAdd block, the rest of the script will still run if applicable (GameMode block will run if it's GameMode, MenuMode if MenuMode, etc.). The script will run once, as if it were loaded. If you have any variables set on the script, it will run the next frame as well and will continue to run until no variables are set.
** Note that this is only true for the onAdd block, the rest of the script will still run if applicable (GameMode block will run if it's GameMode, MenuMode if MenuMode, etc.). The script will run once, as if it were loaded. If you have any variables set on the script, it will run the next frame as well and will continue to run until no variables are set.
*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 pair of blank [[Message]] calls to prevent it from happening, like so:
* See [[Message Spam]] for techniques to avoid unwanted "Item Added" messages.
<pre>Message " "
Message " "
player.AddItem "item ID" 1</pre>
This seems to shortcircuit the message display and will prevent any other messages from being queued or displayed for a couple of seconds. [[Avoiding Message Spam|Here]] are some alternative methods that don't disrupt other messages.


==Console Usage==
==Console Usage==
Line 34: Line 30:
to give yourself a lockpick, you must use
to give yourself a lockpick, you must use
  player.additem 00000A 1
  player.additem 00000A 1
Kedrigh wrote: [http://www.elderscrolls.com/forums/index.php?showtopic=323641&hl=#]
''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==
==See Also==
*[[AddItemNS]] - Spamless version of command (OBSE 15).
*[[GetItemCount]]
*[[RemoveItem]]
*[[RemoveItem]]
*[[GetItemCount]]
*[[Message Spam]] - Techniques for avoiding message spam.
*[[Preventing messages]]
 


==Reference==
==Reference==
Line 59: Line 42:


[[Category: Functions]]
[[Category: Functions]]
[[Category:Functions (CS)]]
[[Category: Functions (CS 1.0)]]
[[Category: Functions (CS 1.0)]]
[[Category: Inventory Functions]]
[[Category: Inventory Functions]]
Line 64: Line 48:
[[Category: Actor Functions]]
[[Category: Actor Functions]]
[[Category: Actor Functions (CS 1.0)]]
[[Category: Actor Functions (CS 1.0)]]
<!-- Begin Search Terms
Add
Item
End Search Terms -->
Anonymous user