A_RemoteDamage is an action that is used to deal damage to an Object remotely – alternatively, this action can kill or remove the Object instead.
Var1 determines the Object affected by this action, as well as the Object acting as the source and inflictor of any damage dealt:
- 0 – the actor; if damaged or killed, no source or inflictor Object is used
- 1 – the actor's target; if damaged or killed, the actor is set as the source and inflictor of the damage
- 2 – the actor's tracer; if damaged or killed, the actor is set as the source and inflictor of the damage
Var2 determines the action performed on the affected Object:
- 0 – damages the Object
- 1 – kills the Object
- 2 – removes the Object (does not work if used on players)
This action will do nothing if the selected Object to damage, kill or remove does not exist.
Code – A_RemoteDamage
// Function: A_RemoteDamage
// Description: Damages, kills or even removes either the actor or its target/tracer. Actor acts as the inflictor/source unless harming itself
// var1 = Mobj affected: 0 - actor, 1 - target, 2 - tracer
// var2 = Action: 0 - Damage, 1 - Kill, 2 - Remove
void A_RemoteDamage(mobj_t *actor)
INT32 locvar1 = var1;
INT32 locvar2 = var2;
mobj_t *target; // we MUST have a target
mobj_t *source = NULL; // on the other hand we don't necessarily need a source
if (LUA_CallAction("A_RemoteDamage", actor))
if (locvar1 == 1)
target = actor->target;
else if (locvar1 == 2)
target = actor->tracer;
else // default to yourself!
target = actor;
if (locvar1 == 1 || locvar1 == 2)
source = actor;
CONS_Printf("A_RemoteDamage: No target!\n");
if (locvar2 == 1) // Kill mobj!
if (target->player) // players die using P_DamageMobj instead for some reason
P_DamageMobj(target, source, source, 1, DMG_INSTAKILL);
P_KillMobj(target, source, source, 0);
else if (locvar2 == 2) // Remove mobj!
if (target->player) //don't remove players!
else // default: Damage mobj!
P_DamageMobj(target, source, source, 1, 0);