AddItem

From the Fallout3 GECK Wiki
Revision as of 04:52, 8 February 2009 by imported>Cipscis (→‎Notes: Added information about Effect Script bug)
Jump to navigation Jump to search

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

See Also

RemoveItem
AddItemHealthPercent

Reference

None provided.