Custom damage types

From ZDoom Wiki

Jump to: navigation, search

Users can specify custom damage types using the DamageType actor property along with custom states.

You can specify the type of damage a projectile or monster actor inflicts using the DamageType property:

actor Fireball
{
    PROJECTILE
    DamageType Flame
    ...

You can then create corresponding custom Pain, Death, Wound and Crash states in your actors that are called instead of the normal states when this type of damage is inflicted. You do this by using the form State.DamageType:

actor MyZombie : ZombieMan
{
    painchance "Flame", 255

    States {
         Pain.Flame:
              ZMBF AB 3
              ZMBF C 5 A_PlaySound("myzombie\Burn")
              ZMBF D 3
              goto See
         Death.Flame:
              ZMBF EFG 3
              ZMBF H 2 A_PlaySound("myzombie\BurnDeath")
              ZMBF IJ 3
              ZMBF K 3 A_NoBlocking
              ZMBF L -1
              stop
     }
}

As you can see in the above example, you can also specify a painchance for each type of custom damage you have defined. This can allow enemies that will always be affected by fire damage (as above) but never by ice damage, for example.

In addition to the above, you can also create monsters that are resistant, or vulnerable, to a particular type of custom damage. You do this with the DamageFactor property, using the format damagefactor "damagetype", multiplier.

actor RaiDoom : DoomImp replaces CellPack 
{ 
  health 200 
  +missilemore 
  +missileevenmore 
  speed 16 
  damagefactor "Pikachu", 0.2  //it's not very effective... 
  damagefactor "Squirtle", 1.8  //it's super effective! 
}
Personal tools