ClearActorInventory

From ZDoom Wiki
Jump to navigation Jump to search

void ClearActorInventory(int tid);

Usage

This function will clear the specified actor's inventory in a similar fashion to ClearInventory.

Note: This will not remove an inventory item or weapon that is flagged with the INVENTORY.UNDROPPABLE flag. An explicit call to TakeActorInventory is required to remove such items.

Examples

This could be a very nasty piece of code if implemented into a deathmatch level. Every minute a player will be picked at random and stripped of their inventory.

#define NUM_PLAYERS     8
#define PLAYER_BASE_TID 1000
#define CLEAR_INTERVAL  2100 // 1 minute

script 1 ENTER
{
    Thing_ChangeTID(0, PLAYER_BASE_TID + PlayerNumber());
}

script 2 OPEN
{
    int p;

    while (TRUE)
    {
        delay(CLEAR_INTERVAL);

        do {

            p = random(0, NUM_PLAYERS-1);

        } until (PlayerInGame(p));

	ClearActorInventory(PLAYER_BASE_TID + p);

        HudMessageBold(n:p+1, s:" is begging for a quick death!";
            HUDMSG_FADEOUT, 1, CR_RED, 0.5, 0.5, 3.0, 1.0);
    }
}

See also