GiveInventory

From ZDoom Wiki

Jump to: navigation, search

void GiveInventory(str inventory_item, int amount);

Usage

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

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

Examples

This script gives the player some equipment. It could be run some time after script 50 in ClearInventory, as an example.

script 51 (void)
{
	PrintBold(s:"Security issues the standard kit.\n");
	GiveInventory("Pistol", 1);
	GiveInventory("Clip", 50);
	GiveInventory("Armor", 75);
}

This will result in the player gaining 70 bullets, as the pistol comes with 20. To set an exact number of ammo after giving a weapon, either use TakeInventory to remove all the player's ammo, or subtract the amount given with the weapon.

Personal tools