DoMissileDamage

From ZDoom Wiki
Jump to navigation Jump to search

void DoMissileDamage (Actor target)

Usage

Causes the calling actor to inflict damage to the specified actor in the same way projectiles inflict damage to actors on impact (if defined, this also includes poison). This means that damage-related information the function needs to perform, such as base damage and flags, are obtained from the calling actor.

While this function can be called by non-projectile actors, it is assumed that the calling actor is a projectile, and the function's usage should generally be restricted to that.

Parameters

  • target: a pointer to the actor to damage. This must not be null.

Examples

This "nice" plasma ball damages its shooter when it explodes.

class NicePlasmaBall : PlasmaBall
{
    States
    {
    Death:
        PLSE A 0
        {
            // Does the shooter exist?
            // (for projectiles, their shooter is stored in their 'target' field).
            if (target)
            {
                // Yes, it does. Then damage it.
                DoMissileDamage(target);
            }
        }
        Goto Super::Death;
    }
}