Classes:Inventory

From ZDoom Wiki

Jump to: navigation, search

Classes: Inventory
 →Ammo
 →Armor
 →BackpackItem
 →CustomInventory
 →FakeInventory
 →Health
 →HealthPickup
 →MapRevealer
 →Powerup
 →PowerupGiver
 →PuzzleItem
 →Weapon
 →WeaponPiece
   (more)


Inventory is the base class for all items that can be picked up or placed into the inventory by other means. This class itself has no special functionality and is never used directly. Its only purpose is to be a base class for other items. Any item derived directly from Inventory won't do anything even though it is a fully working inventory item. Such items may be used as counters or status markers.


Using in DECORATE

The Inventory base class defines the following properties which are available to all inventory subclasses:

  • inventory.amount value
Sets the amount of inventory items given by this item. Mostly used for item types that give larger quantities.
  • inventory.defmaxamount
Sets the maximum amount the player can carry of this item to the game's default. That is 16 for Heretic and 25 for the other games.
  • inventory.maxamount value
Sets the maximum amount the player can carry of this item.
  • inventory.icon sprite
Defines the icon this item used when displayed in the HUD or status bar.
  • inventory.pickupmessage message
Defines the message that is printed when the player picks up this item. Strings from the LANGUAGE lump can be used by passing the string's identifier prefixed with '$'.
  • inventory.pickupsound sound
Defines the sound that is played when a player picks up this item.
Defines what actor should appear when the item is picked up; normally this would be used with the PickupFlash actor to make a flash appear as the player picks up the item. If this is not specified there will be no flash when the item is picked up.
  • inventory.usesound sound
Defines the sound that is played when a player uses this item.
  • inventory.respawntics value
Defines the time it takes until this item respawns (if respawn is enabled) in 1/35 of a second.
  • inventory.givequest value
Also give a quest item for controlling Strife's dialogs when picking up this one. value can be in the range of [1..31]

The Inventory base class also defines some new flags (note: The INVENTORY. prefix is not necessary. However, to make things easier to read it is recommended to be used):

  • INVENTORY.QUIET
When being picked up this item doesn't make any sound.
  • INVENTORY.AUTOACTIVATE
This item activates automatically when being picked up.
  • INVENTORY.UNDROPPABLE
This item cannot be dropped once it has been picked up.
  • INVENTORY.INVBAR
This item is placed into the visible inventory when picked up.
  • INVENTORY.HUBPOWER
This item is kept when travelling between levels of the same hub.
  • INVENTORY.INTERHUBSTRIP
This item is taken away when travelling between hubs or single levels.
When being picked up a PickupFlash actor is spawned. This is the blue effect you can observe on Heretic and Hexen. This flag has been deprecated and it is recommended that you use the Inventory.PickupFlash property instead. (development version only)
  • INVENTORY.ALWAYSPICKUP
This item is always picked up no matter whether the player can use it or not. This only applies to items that activate automatically.
  • INVENTORY.FANCYPICKUPSOUND
The pickup sound is played in surround mode.
  • INVENTORY.BIGPOWERUP
Marks this item as a 'powerful' item which is controlled by the 'mega powerups respawn' dmflag option
  • INVENTORY.KEEPDEPLETED
This item will remain in the player's inventory bar even after the last one is used. If the item also has an inventory icon, it will be drawn darkened when the quantity is 0.
  • INVENTORY.IGNORESKILL
Normally, the amount of ammo picked up from an inventory item is doubled on the easiest and hardest skill levels. If this flag is set, the item will ignore the skill setting and only give the specified ammo amount.
If set, when a player picks up a second powerup of this type before the first has worn off, the new powerup's duration will be added to the old, rather than overwriting it. For example, if a powerup has a duration of 60 seconds, and a player who currently has the powerup with 21 seconds left picks up a second one, normally the new powerup will override the old and the duration will be reset to 60 seconds. With this flag set, the duration would be extended to 81 seconds instead.

To create items that automatically activate when being picked up set inventory.maxamount to 0 and add the +INVENTORY.AUTOACTIVATE flag.

Personal tools