From ZDoom Wiki
Jump to navigation Jump to search
Note: This function is for ACS. For the ZScript function of the same name see TakeInventory (ZScript).

void TakeInventory(str inventory_item, int amount);


This function will take the number of items specified from the activator. In the case of ammo, health and armor it will take the total number (so TakeInventory("Shells", 5) and TakeInventory("ShellBox", 5) will both take five shells from the player).

Unlike ClearInventory, TakeInventory can remove items that are flagged as undroppable.

If the function is run with no activator (for example an OPEN script or removing an existing activator with SetActivator), it will run for and affect all active players in the game.

See the Inventory page for a list of items in ZDoom.


This script randomly removes objects from the player. Sometimes it does not remove any object, though. It is due to how lucky the player is.

str weapons[8] = {"Pistol", "Shotgun", "SuperShotgun",
"Chaingun", "RocketLauncher", "PlasmaRifle", "BFG9000",

script 10 (void)
	int targ = random(0, 7);
	if (CheckInventory(weapons[targ]))
		TakeInventory(weapons[targ], 1);
		Print(s:"You have dropped a weapon!\ncareless player...");

Note that no inventory can be a negative amount.