CheckInventory

From ZDoom Wiki
Jump to navigation Jump to search

int CheckInventory(str inventory_item);

Usage

Checks the inventory of the actor who activated the script for the item specified by inventory_item. For a list of possible inventory items, see Inventory.

The function will return the number of items the actor carries. Keep in mind that for active powerups, you cannot check for the pickup item. You have to check for the internal powerup item.

Examples

An example of a script which for no good reason gives terrible advice to the player:

script 52 (void)
{
	if (CheckInventory("Shotgun") && CheckInventory("Shell") > 20)
		Print(s:"Use the shotgun to take out those 20 imps!");
	else
		Print(s:"Run away from the imps you loser!");
}

If the player has the shotgun and 20 shells, it tells them to use the shotgun on some imps. Otherwise it tells the player to run away.

See also