Classes:BackpackItem

From ZDoom Wiki
Jump to navigation Jump to search
Note: Wait! Stop! Before you copy this actor's definition into your mod, remember the following things:
  1. You do not need to copy that actor, since it is already defined.
  2. In fact, it's not just useless, it's actually harmful as it can cause problems.
  3. If you want to modify it, or use a modified version, using inheritance is the way to go.
  4. The actor definitions here are put on the wiki for reference purpose only. Learn from them, don't copy them.
  5. There is only one exception: if what you want is changing Ammo capacity, you need to create a new type from Ammo.
Backpack item
Actor type Internal Game MiniZDoomLogoIcon.png (ZDoom)
DoomEd Number None Class Name BackpackItem


Classes: InventoryBackpackItem
 →AmmoSatchel
 →Backpack
 →BagOfHolding

BackpackItem is the base class for all backpack-like items. This class itself is never used directly. Its only purpose is to be a base class for other items.

A child of this class contains a sample of each ammunition type and extends the carrying capacity of each ammunition type. However, the quantity of contained ammunition, and the size of the increase are qualities of the ammunition, not of the backpack. Therefore, it is not possible to make several different types of backpacks, such as a "regular backpack" that would double the basic carrying capacity and a "super backpack" that would triple it, for example. Or a "cursed backpack" that would reduce carrying capacity. Likewise, if you place a BagOfHolding (Heretic item) in Doom, you will find Doom-specific ammunitions in it!


Note that when a backpack is first picked up, it is added to the inventory. Backpacks picked up afterwards are not added to the inventory, their content is merely transferred to the first. (Or, more technically, the one already in the inventory intercepts the pickup attempt and just adds ammo to the inventory.) Picking up an AmmoSatchel, then a Backpack and finally a BagOfHolding will give you only the AmmoSatchel in your inventory, as the printinv console command will tell you. If you want to have several different graphics for backpack pickups and need to check whether the player has a backpack or not, you should probably use instead CustomInventory items that give backpacks.

DECORATE definition

ACTOR BackpackItem : Inventory native {}