A_CallSpecial
Jump to navigation
Jump to search
bool A_CallSpecial (int special, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0, int arg5 = 0)
Usage
Used to call an actor special directly in ZScript or DECORATE. The special activated this way can be any special (not necessarily the one attached to the actor), and it gets activated as soon as the function is called, without the need for a usual activation trigger like killing/using/bumping into the actor.
Functions as a wrapper for level.ExecuteSpecial().
Parameters
- int special
- The special to activate. Pass
<pointer to actor>.special
here if you want to activate the special attached to the actor.
- int arg1
- int arg2
- int arg3
- int arg4
- int arg5
- The arguments to pass to the special.
Return value
- bool — returns
true
if the special was successfully activated.
ZScript definition
Note: The ZScript definition below is for reference and may be different in the current version of GZDoom.The most up-to-date version of this code can be found on GZDoom GitHub. |
bool A_CallSpecial(int special, int arg1=0, int arg2=0, int arg3=0, int arg4=0, int arg5=0)
{
return Level.ExecuteSpecial(special, self, null, false, arg1, arg2, arg3, arg4, arg5);
}
Examples
This code will make the actor call Floor_LowerToLowest upon death:
Death: BOSS I 8; BOSS J 8 A_Scream; BOSS K 8; BOSS L 8 A_NoBlocking; BOSS M 0 A_CallSpecial (Floor_LowerToLowest, 17, 64); // tag 17, speed 64 BOSS MN 8; BOSS O -1; stop;
This version of the Zombieman will trigger its attached special every time it's damaged rather than when it's killed:
class TriggerfulZombieman: Zombieman
{
override int DamageMobj (Actor inflictor, Actor source, int damage, Name mod, int flags, double angle)
{
int dmg = super.DamageMobj(inflictor, source, damage, mod, flags, angle);
if (dmg > 0)
{
// Pass its own special and arguments:
A_CallSpecial(special, args[0], args[1], args[2], args[3], args[4]);
}
return dmg;
}
}
See DamageMobj.