Classes:Ammo

From ZDoom Wiki
Jump to: navigation, 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.
Ammo
Actor type Internal Game MiniZDoomLogoIcon.png
DoomEd Number None Class Name Ammo


Classes: InventoryAmmo
 →BlasterAmmo
 →Cell
 →Clip
 →ClipOfBullets
 →CrossbowAmmo
 →ElectricBolts
 →EnergyPod
 →GoldWandAmmo
 →HEGrenadeRounds
 →MaceAmmo
 →Mana1
 →Mana2
 →MiniMissiles
 →PhoenixRodAmmo
 →PhosphorusGrenadeRounds
 →PoisonBolts
 →RocketAmmo
 →Shell
 →SkullRodAmmo

An Ammo item defines ammunition for use by weapons. For the most part ammo acts like a normal inventory item but there are some differences:

  • Only items that inherit directly from Ammo are separate types. All items that inherit from a subclass of Ammo define new pickup items for that ammo type.
  • The amount of ammo the player can carry can be affected by picking up a subclass of BackpackItem.
  • The amount of ammo each item gives the player can be increased for the easiest and hardest skill level in the game.
  • Ammunition is never placed in the inventory bar. Instead, it is shown in its own place on the HUD or status bar.

Using in DECORATE

Ammo items support all the basic Inventory properties. In addition they define:

  • Ammo.BackpackAmount amount
The amount of this ammo type received from a backpack.
  • Ammo.BackpackMaxAmount amount
The maximum amount of this ammo type that can be carried with a backpack.
  • Ammo.DropAmount amount
Specifies the amount of ammo a dropped item without any explicit amount given contains. Since you can specify the amount with DropItem this is mainly to customize the amount of items dropped by Strife dialogue scripts.

Note that ammo capacity (Inventory.MaxAmount, Ammo.BackpackAmount and Ammo.BackpackMaxAmount) are only relevant for a type derived directly from Ammo, such as Clip. Types with further derivation (such as ClipBox which is derived from Clip) use their parent class's amounts.

Examples:

This defines a new ammo type:

actor LaserRecharge : Ammo 10471
{
  Inventory.PickupMessage "Laser recharge unit"
  Inventory.Amount 10
  Inventory.MaxAmount 200
  Inventory.Icon "AAMOA0"
  Ammo.BackpackAmount 10
  Ammo.BackpackMaxAmount 400
  states
  {
  Spawn:
    ZCLP A -1
    stop
  }
}

This defines a second pickup item for the same ammo type:

actor LargeLaserRecharge : LaserRecharge 10472
{
  Inventory.PickupMessage "Large laser recharge unit"
  Inventory.Amount 50
  states
  {
  Spawn:
    AAMO A -1
    stop
  }
}

DECORATE definition

ACTOR Ammo : Inventory native
{
  +INVENTORY.KEEPDEPLETED
  Inventory.PickupSound "misc/ammo_pkup"
}

See also