From ZDoom Wiki
Jump to navigation Jump to search

int CheckActorInventory(int tid, str inventory_item);


Checks the given actor's inventory for the item specified by inventory_item. For a list of possible inventory items, see Inventory.

This function does not treat tid 0 as the activator of the script. To check the script activator's inventory, see CheckInventory.

The function will return the number of items of the given type the actor carries.


This example will give any player a shotgun who does not have one at the time script 2 is activated, regardless of how script 2 is activated.

script 1 enter
    Thing_ChangeTID(0, 1000 + PlayerNumber());

script 2 (void)
    for (int p = 0; p < 8; p++)
        if (PlayerInGame(p) && !CheckActorInventory(1000 + p, "Shotgun"))
            GiveActorInventory(1000 + p, "Shotgun", 1);