From ZDoom Wiki
Jump to navigation Jump to search

bool A_GiveInventory (string type [, int amount [, pointer giveto]])


Adds amount items of type type to the calling actor's inventory. This function will not add more items than can be carried. This is only really useful for weapons and custom inventory.

If type is an item derived from Health, then the amount received is the result of multiplying amount by the item's amount, e.g. if type is Medikit and amount is 2, then the amount of health received would be 50 points, not 2.


  • type: the item to give. This should be a valid inventory item.
  • amount: the number of samples of this item to give. Default is 0, which is interpreted as 1.
  • giveto: the actor to give the item to. This is an actor pointer selector. Default is AAPTR_DEFAULT, which corresponds to the caller of the function.

Return value

The function returns true if the item is successfully received, otherwise it returns false.


Actor BigBoost : CustomInventory 10492
  Inventory.PickupMessage "Energy Boost!!!"
  Inventory.PickupSound "misc/p_pkup"
    AWI3 A -1
    TNT1 A 0 A_GiveInventory ("Soulsphere", 2)
    TNT1 A 0 A_GiveInventory ("BFG9000")

This actor uses the CustomInventory's special behavior to give two inventory items with one pickup using A_GiveInventory.