Difference between revisions of "AddItem"

259 bytes added ,  08:30, 15 June 2007
no edit summary
imported>Haama
(Added save/load info to remote cell onAdd)
imported>Haama
Line 22: Line 22:
* 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.


*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:
*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 " "
player.AddItem "item ID" 1</pre>
Message " "
player.RemoveItem "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.


----
----
Anonymous user