GiveActorInventory

From ZDoom Wiki
Jump to navigation Jump to search

void GiveActorInventory(int tid, str inventory_item, int amount);

Usage

This function will give the amount of items to the specifed actor.

This function does not treat tid 0 as the activator of the script. If 0 is given as tid then the items will be given to ALL players. To give items to the script's activator, use GiveInventory.

Examples

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);
        }
    }
}

See also

Info on ZDoom forum about tid 0