Difference between revisions of "OnAdd"
imported>Elei-Mi-Shill m |
imported>Elei-Mi-Shill |
||
Line 19: | Line 19: | ||
''Using GetContainer in an OnAdd block will return the container in which the object or the npc whom the object was added to (tested, it works)'' | ''Using GetContainer in an OnAdd block will return the container in which the object or the npc whom the object was added to (tested, it works)'' | ||
''Using GetSelf in an OnAdd is ignored (ie, does not change the value of the variable if already assigned).'' | ''Using GetSelf in an OnAdd is ignored (ie, does not change the value of the variable if already assigned).'' | ||
Revision as of 20:19, 1 August 2009
Syntax:
begin OnAdd ContainerRefID
Example:
begin OnAdd begin OnAdd player
This block will be run once when the scripted object is added to the Container's inventory. If no parameter is used, the block will be run whenever the object is added to anything's inventory.
When the target container isn't in the current cell (or within the 5x5 exterior-cell square), the OnAdd block doesn't run until you enter the cell with the container. However, the onAdd block won't run if you've saved and reloaded before entering the remote cell.
If you add an item to a container and then remove it later in the same block of code, the OnAdd block will not run. The item must remain in the new container for at least one frame after it is added in order for the block to trigger.
PLZ, I need to know how it works with some functions as GetSelf, GetContainer, GetActionRef
In example:
Using GetContainer in an OnAdd block will return the container in which the object or the npc whom the object was added to (tested, it works)
Using GetSelf in an OnAdd is ignored (ie, does not change the value of the variable if already assigned).
This would be needed to all the Blocktypes in order to let ppl know how to obtain certain infos (in example I need to know the REF of the object I'm adding, and that seems impossible right now)
Delete this few lines I wrote when you have updated this entry PLZ.