Open main menu

UESPWiki β


                RemoveItem, ObjectID, Count

       Where:   ObjectID = Object to remove from the calling item's inventory.
                Count    = Number of the object to remove (short).

        Type:   Object

     Returns:   none

     Example:   Player->RemoveItem, "Daedric_special", 1
                Fargoth->RemoveItem, "ring_keley", 1

     Scripts:   lookoutScript

Removes the given number of the item from the calling object but does not drop it. There is a potential for crashing the game if you attempt to remove an item within its own script, i.e.,

begin test_CrashScript
        if (OnActivate == 1)
                MessageBox "The item disappears before your eyes"
                player->RemoveItem, "some_unique_item", 1

If this script was attached to the some_unique_item and the only instance of it was removed from the player's inventory, the game would crash. In order to successfully remove the item you will have to use a global script or from another object. You can successfully remove items that do not exist in the calling object's inventory. The RemoveItem function accepts a short count value which limits the number of items you can remove at a time to 65535 (or possibly 65534).

It appears that if you use RemoveItem from the player, the player's encumbrance is modified, whether or not they actually have the object. An interesting way to modify the amount the player can carry, especially in situations where uninstalled mods have caused the player to carry around 'missing items' (i.e., the player's encumbrance does not reach 0 when naked). Generally, though, you will not want to modify the player's encumbrance so check for the existence of items with the GetItemCount before you remove them.

There is a bug related to this function when adding/removing items from a container causing the container's contents to not be updated the second time items are added/removed. See AddItem for information on this.

Note that this function does accept global variables but only in dialogue results, not scripts.

See Also: AddItem