Classes:PowerDrain

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.
Health drain power
Actor type Power Game MiniZDoomLogoIcon.png
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