Classes:PowerProtection

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.
Damage protection power
Actor type Power Game MiniZDoomLogoIcon.png
DoomEd Number None Class Name PowerProtection


Classes: InventoryPowerupPowerProtection

PowerProtection is an internal class. An item of this class is placed in the player's inventory while the Protection powerup is effective. During the time this effect is active, the player will be given a multiplier to their damage resistance done from monsters/players, indicated by the DamageFactor amount.

Like all other powerups, items of this class are never used directly. Instead you have to create a new item that inherits from PowerProtection specifying the resistance multipliers in here, then creating an item inheriting from PowerupGiver with the Powerup.Type property named as the previous item you just created.

Protection flags

If present in the powerup's definition, the following flags are passed to the user of the powerup upon its activation, granting them the benefits that come from having the flags set. The flags are cleared once the powerup's effect wears off:

Sounds

If present in the powerup's definition, the following sounds are played:

  • ActiveSound — Plays each time damage is received while the powerup is active.
  • DeathSound — Plays once the powerup's effect wears off.
  • SeeSound — Plays when the powerup is first activated.

The sounds are played on the auto channel (CHAN_AUTO) with no attenuation (the sound is heard at full volume regardless of distance).

DECORATE definition

ACTOR PowerProtection : Powerup native
{
  Powerup.Duration -25
}

Examples

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

A half damage item:

ACTOR PowerHalfDamage : PowerProtection
{
  DamageFactor "Normal", 0.5
  Inventory.Icon "MEGAA0"
}

ACTOR HalfDamage : PowerupGiver
{
  Inventory.PickupMessage "Half Damage!!"
  Powerup.Color Grey4 0.25
  Inventory.MaxAmount 0
  Inventory.UseSound "pickups/slowmo"
  Powerup.Type "HalfDamage"
  Powerup.Duration 1000
  Translation "128:143=96:103"
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.FANCYPICKUPSOUND
  States
  {
  Spawn:
    MEGA ABCD 4 Bright
    Loop
  }
}

A quarter damage item that provides the user of the powerup protection against splash damage. When damage is received, the "imp/active" sound is played; upon the powerup's activation, the "imp/sight" sound is played, and once its effect wears off, the "imp/death" sound is played:

ACTOR PowerQuarterDamage : PowerProtection
{
  DamageFactor "Normal", 0.25
  Inventory.Icon "MEGAA0"
  SeeSound "imp/sight"
  DeathSound "imp/death"
  ActiveSound "imp/active"
  +NORADIUSDMG
}

ACTOR QuarterDamage : PowerupGiver
{
  Inventory.PickupMessage "Quarter Damage!!"
  Powerup.Color Grey4 0.25
  Inventory.MaxAmount 0
  Inventory.UseSound "pickups/slowmo"
  Powerup.Type "QuarterDamage"
  Powerup.Duration 1000
  Translation "128:143=104:111"
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.FANCYPICKUPSOUND
  States
  {
  Spawn:
    MEGA ABCD 4 Bright
    Loop
  }
}