A_SetObjectState is an action that changes the state of the actor's target or tracer to the one specified by Var1 – refer to list of states for reference. Var2 determines whether the actor's target (0) or the actor's tracer (1) will be made to change state by this action. If the chosen Object does not have any health or does not exist, this action will do nothing. Note that changing the chosen Object's state to
S_NULL will remove the Object from existence.
This action originates from the v2.0 modification SRB2Morphed and was added to SRB2 itself in v2.1.
Code – A_SetObjectState
// Function: A_SetObjectState
// Description: Changes the state of an object's target/tracer.
// var1 = state number
// 0 = target
// 1 = tracer
void A_SetObjectState(mobj_t *actor)
INT32 locvar1 = var1;
INT32 locvar2 = var2;
if (LUA_CallAction("A_SetObjectState", actor))
if ((!locvar2 && !actor->target) || (locvar2 && !actor->tracer))
CONS_Printf("A_SetObjectState: No target to change state!\n");
if (!locvar2) // target
target = actor->target;
else // tracer
target = actor->tracer;
if (target->health > 0)