Classes:PowerDrain

From ZDoom Wiki
Revision as of 15:14, 2 May 2017 by Blue Shadow (talk | contribs) (Remove {{new}})
Jump to navigation Jump to search
Note: Wait! Stop! You do not need to copy this actor's code into your project! Here's why:
  1. This actor is already defined in GZDoom, there's no reason to define it again.
  2. In fact, trying to define an actor with the same name will cause an error (because it already exists).
  3. If you want to make your own version of this actor, use inheritance.
  4. Definitions for existing actors are put on the wiki for reference purpose only.
Health drain power
Actor type Power Game MiniZDoomLogoIcon.png (ZDoom)
DoomEd Number None Class Name PowerDrain


Classes: InventoryPowerupPowerDrain
   (more)


PowerDrain is an internal class. An item of this class is placed in the player's inventory while the Drain powerup is effective. During the time this effect is active, the player will be given health that amounts to 50% of the damage done to other monsters/players.

The strength of drain effect can be controlled with the Powerup.Strength property which acts as a multiplier. In addition, if multiple powerups of this type are in the inventory, the engine picks the one with the most strength yield to boost the amount of health drained.

Each time a drain event happens, the *drainhealth player sound is played. The sound is played on the item channel (CHAN_ITEM) at full volume and with normal attenuation (ATTN_NORM).

Like all other powerup items of this class are never used directly. Instead you have to create a new item that inherits from PowerupGiver to give it to the player.

Examples

This defines ZDoom's Drain item and is an example for an item that is put in the inventory:

ACTOR Drain : PowerupGiver
{
  Inventory.PickupMessage "Vampirism!!"
  Inventory.Icon "MEGAA0"
  Powerup.Color Red 0.25
  Inventory.MaxAmount 0
  Inventory.UseSound "pickups/slowmo"
  Powerup.Type "Drain"
  Powerup.Duration 1000
  Translation "128:143=176:191"
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.FANCYPICKUPSOUND
  States
  {
  Spawn:
    MEGA ABCD 4 Bright
    Loop
  }
}

ZScript definition

class PowerDrain : Powerup
{
    Default
    {
        Powerup.Strength 0.5;
        Powerup.Duration -60;
    }
}

DECORATE definition (deprecated)

ACTOR PowerDrain : Powerup native
{
  Powerup.Duration -60
}

See also