Inventory

Handles an NPC's inventory.

Postal III Ultrapatch+Angel v1.3.0+ Feature

The following function will only work in Postal III Ultrapatch+Angel v1.3.0 or higher.

Note

This feature only works with Angel's inventory item manifest.

Use Object:inventory to check if there's a valid selected inventory item.

Recommended to use IfHasItem if you want to do complex behavior.

Syntax

Inventory select,first -- Selects the first item from the NPC's inventory, if there's any.

Inventory select,last -- Selects the last item from the NPC's inventory, if there's any.

Inventory select,random -- Selects a random item from the NPC's inventory, if there's any.

Inventory select,[namespace::name] -- Selects a specified item from the NPC's inventory, if there's any.

Inventory equip -- Equips selected item, places it onto the NPC's hand, and removes the item from their inventory.

Inventory add,[namespace::name],[amount] -- Adds specified item X amount into NPC's inventory.

Inventory remove,[namespace::name],[amount] -- Removes specified item X amount from NPC's inventory.

Examples


// Selects pizza item from the inventory, if there's any
xpt_selectitem
{
    actions
    {
        Inventory select,angel::pizza
        IfAttr "Object:inventory != Object:null Block begin"
            Inventory equip
        Block end
    }
}


// Adds 20 pizzas, just for fun
xpt_additems
{
    actions
    {
        Inventory add,angel::pizza,20
    }
}