Classes:Ammo

From ZDoom Wiki

Jump to: navigation, search
Ammo
Actor type Internal Game
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.

DECORATE definition

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

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 dialog scripts.


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
  }
}

See also

Personal tools