Custom damage types
Users can specify custom damage types using the DamageType actor property along with custom states. A number of damage types are predefined, but you can create more.
You can specify the type of damage a projectile or monster actor inflicts using the DamageType property:
Actor Fireball
{
Projectile
DamageType Fire
...
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 "Fire", 255
States {
Pain.Fire:
ZMBF AB 3
ZMBF C 5 A_PlaySound("myzombie/Burn")
ZMBF D 3
goto See
Death.Fire:
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 pain chance 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.
Note that ZDoom does NOT currently support custom XDeath states. However, since a custom Death state supersedes the XDeath state, you can use this to your advantage to simulate the effect.
actor GibZombie : ZombieMan
{
States {
Death.Gib:
POSS G 0 A_JumpIfHealthLower(-20,"SuperGibDeath")
goto Death
}
}
Here A_JumpIfHealthLower is used to check if the damage incurred on the Zombie has passed its GibHealth value (in this case, 20). If it has, it jumps to a new gib sequence; if not, it goes to a normal death. Via this method, custom gib states that behave the same way as the original Doom ones can be created.
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! }