GiveActorInventory

From ZDoom Wiki
Jump to: navigation, 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. 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);
        }
    }
}