Classes:WeaponPiece

From ZDoom Wiki

Jump to: navigation, search
Weapon piece
Actor type Internal Game
DoomEd Number None Class Name WeaponPiece

Classes: InventoryWeaponPiece

 →ClericWeaponPiece
 →FighterWeaponPiece
 →MageWeaponPiece


WeaponPieces are items that can be used to create weapons with multiple parts that have to be assembled, like the big weapons in Hexen. The base class WeaponPiece is never used directly. It is always the base class for items defined in DECORATE.


Using in DECORATE

There are a few points to observe when using weapon pieces:

  • The piece's pickup sound and message are only used when the weapon is still incomplete.
  • If picking up a piece that completes the weapon, the weapon's pickup sound and message are being used.
  • Picking up a piece the player already owns gives some ammo. The amount is taken from the respective fields in the weapon definition.
  • Any weapon used with weapon pieces must contain some special information.
  • This class is designed with the assumption that the whole weapon does not exist as a complete pickup item. It wouldn't do any harm to do it anyway but some messages would be obviously wrong.


WeaponPiece uses some of the basic Inventory properties to define their behavior as inventory items. They also define a few new properties:

  • weaponpiece.number number
The piece number. This can be a value between 1 and 32. To complete a weapon all available pieces as specified in the weapon must be picked up.
  • weaponpiece.weapon weapontype
The weapon this item helps to assemble.

See also:

Making weapon pieces

Example:

actor FerkWeaponPiece1 : WeaponPiece 10012
{
  inventory.pickupsound "misc/w_pkup"
  inventory.pickupmessage "A Piece of the Ferkulator"
  weaponpiece.weapon "Ferkulator"
  weaponpiece.number 1
  states
  {
  Spawn:
    FRK1 A -1
    stop
  }
}

actor FerkWeaponPiece2 : FerkWeaponPiece1 10013
{
  weaponpiece.number 2
  states
  {
  Spawn:
    FRK2 A -1
    stop
  }
}

actor FerkWeaponPiece3 : FerkWeaponPiece1 10016
{
  weaponpiece.number 3
  states
  {
  Spawn:
    FRK3 A -1
    stop
  }
}

DECORATE definition

Actor WeaponPiece : Inventory native {}
Personal tools