TakeSpecialDamage

From ZDoom Wiki
Jump to navigation Jump to search


Actor

virtual int TakeSpecialDamage(Actor inflictor, Actor source, int damage, Name damagetype)

Usage

Called from the damage taker when they're about to take damage but haven't yet. The return value is the new damage to be taken. This occurs after all forms of damage modifiers are applied. Called before DamageMobj.

NOTE: If the actor taking damage isn't damageable (e.g. they're dormant or invulnerable) this function will not be called.

Parameters

  • Actor inflictor
The actor dealing the damage. This is the missile for projectiles and the puff for hitscan attacks. For monster melee attacks this is the same as the source.
  • Actor source
The actor responsible for the inflictor.
  • int damage
The amount of damage to deal.
  • Name damagetype
The name of the damage type to apply.

Examples

This version of the Zombieman will take no damage from fire attacks:

class FireproofZombieman : Zombieman
{
	override int TakeSpecialDamage(Actor inflictor, Actor source, int damage, Name damagetype)
	{
		if (damagetype == 'Fire')
		{
			return 0;
		}
		
		return super.TakeSpecialDamage(inflictor, source, damage, damagetype);
	}
}