GetAmount

From ZDoom Wiki
Jump to navigation Jump to search

BaseStatusBar

int, int GetAmount(class<Inventory> item)

Usage

Can be used in a ZScript HUD to obtain amount and maxamount of the specified Inventory class type.

Return values

Has 2 return values:

  1. int - the amount of this item in the player's inventory. If the player doesn't have that item, returns 0.
  2. int - the maximum of this item. If the player has this item in their inventory, returns its maxamount field (accounting for possible dynamic modifications); otherwise returns the default maxamount value for this class.

Examples

int am, maxam;
[am, maxam] = GetAmount('BloodVial');
DrawString(mHUDfont, String.Format("Blood vials: %d/%d", am, maxam), (4, 4));