Classes:WeaponPiece

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.
Weapon piece
Actor type Internal Game MiniZDoomLogoIcon.png
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 use the Health property to define the number of pieces the weapon has.
  • 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.

DECORATE definition

ACTOR WeaponPiece : Inventory native
{
  +WEAPONSPAWN
}

Examples

ACTOR Ferkulator : Weapon
{
  Health 3 
  ...
}

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

See also