DamageActor

From ZDoom Wiki
Jump to navigation Jump to search

int DamageActor (int targettid, int targetptr, int inflictortid, int inflictorptr, int damage, str damagetype);

Usage

Damages a single actor with a specific damage amount and damage type. You can optionally specify another actor as having done the damage, affecting the obituary and targeting of the target actor.

Parameters

  • targettid: the tid of the actor to damage. You may specify 0 to refer to the activator.
  • targetptr: the actor pointer to use on the target actor.
  • inflictortid: the tid of the actor inflicting the damage. You may specify 0 to refer to the activator.
  • inflictorptr: the actor pointer to use on the inflicting actor. AAPTR_NULL will make the damage originate from the world.
  • damage: the amount of damage the target actor will receive. Negative values are clamped to zero (you cannot heal with this function).
  • damagetype: the damagetype to use. See Damage types.

Return value

The function returns the amount of damage the target actor actually received, after all the factors have been processed (such as skill level and damage factors). If the damaging was cancelled (e.g. by invulnerability), or if no target actor was found, -1 is returned.

Examples

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.