Difference between revisions of "AddItem"
Jump to navigation
Jump to search
imported>Cipscis m (Formatting fix) |
imported>DragoonWraith (using HTML unordered list to include the code sample in the list) |
||
Line 17: | Line 17: | ||
=='''Notes'''== | =='''Notes'''== | ||
<ul><li>You can use a FormList as the item parameter - in this case, the function adds the count for each item in the list.</li> | |||
<li>Calling [[AddItem]] in an Effect Script will cause the target Actor's Weapon to toggle between being visible and usable and being invisible and unusable. To fix this, use something like this in the script of the item that is being added: | |||
<pre>ref rContainer | |||
Begin OnAdd | |||
set rContainer to GetContainer | |||
rContainer.AddItem Pencil01 1 1 | |||
rContainer.RemoveItem Pencil01 1 1 | |||
End</pre></li></ul> | |||
=='''See Also'''== | =='''See Also'''== | ||
[[RemoveItem]]<br> | [[RemoveItem]]<br> | ||
[[AddItemHealthPercent]] | [[AddItemHealthPercent]]<!-- | ||
Why is this even here? -- ~~~~ | |||
=='''Reference'''== | =='''Reference'''== | ||
None provided. | None provided. | ||
[[AddItem_Reference|List of functions that use AddItem]] (wiki) --> | |||
[[Category:Functions]] | [[Category:Functions]] |
Revision as of 13:37, 10 February 2009
Description
AddItem Adds Count items of object ObjectID to the calling container's inventory. It has two required parameters (the object to add and the quantity) and one optional parameter (whether to display a message on screen).
Syntax
[ActorID|ContainerID.]AddItem ObjectID, Count, MessageHiddenFlag
Examples
buddyref.additem Stimpack 11
Buddy now has 11 stimpacks
player.additem SuperStimpak 10
The player now has 10 super stimpacks and message displays like normal
player.additem SuperStimpak 10 1
The player now has 10 super stimpacks and no message would be displayed when these items are added
Notes
- You can use a FormList as the item parameter - in this case, the function adds the count for each item in the list.
- Calling AddItem in an Effect Script will cause the target Actor's Weapon to toggle between being visible and usable and being invisible and unusable. To fix this, use something like this in the script of the item that is being added:
ref rContainer Begin OnAdd set rContainer to GetContainer rContainer.AddItem Pencil01 1 1 rContainer.RemoveItem Pencil01 1 1 End