A_SetDamageType

From ZDoom Wiki
Jump to navigation Jump to search


Actor

void A_SetDamageType(name newdamagetype)

Usage

Sets the specified damage type for the caller. This accepts the already-defined damage types supported by the engine as well as user-defined ones.

In ZScript this function is largely moot, since damagetype is a directly modifiable actor field.

Examples

This rocket will do two types of damage: Direct hit causes default non-elemental damage, but the explosion itself causes fire damage.

class RocketElement : Rocket
{
    States
    {
    Death:
        MISL B 8 Bright 
        {
            A_SetDamageType('Fire');
            A_Explode();
        }
        MISL C 6 Bright;
        MISL D 4 Bright;
        Stop;
    }
}

Note, the example above is for demonstration purposes only, because A_Explode already has a dedicated argument for passing a custom damage type.

ZScript definition

void A_SetDamageType(name newdamagetype)
{
    damagetype = newdamagetype;
}