Difference between revisions of "AddItem"

7 bytes removed ,  20:07, 10 December 2007
m
Standardized
imported>Haama
(→‎Notes: Script still runs in remote cells, however)
imported>Haama
m (Standardized)
Line 17: Line 17:


==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''.  
* 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:
*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:
<pre>Message " "
<pre>Message " "
Line 29: Line 26:
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.
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==
 
When using AddItem with the console, you must use the desired item's FormID, not the EditorID.
Console UsageWhen using AddItem with the console, you must use the desired item's FormID, not the EditorID.


So, instead of using
So, instead of using
Anonymous user