Clears currently queued actions from the calling object.

void ClearAllActions(
    int nClearCombatState = FALSE



Stop all current actions, combat optional. (Default: FALSE)


Clears all current and queued actions from the calling object. Note that unless TRUE is passed for nClearCombatState, any current fighting involving the caller of ClearAllActions will continue.


Commonly used to stop and immediately redirect the current actions of a PC or NPC.

Only existing Action* functions will be cleared by this call. This includes ActionDoCommand(). It also doesn't clear any DelayCommand() functions or actions.

Anything that can have actions assigned to it (even just ActionDoCommand()) can have those actions cleared.

Functions are instant - and are not actions.




// Example of a PC triggered earthquake for use in the OnEnter event of a generic trigger.
void main()
    object oPC = GetEnteringObject();
    object oTrigger = OBJECT_SELF;
    object oArea = GetArea(oTrigger);

    // Stop here if the triggering object is not a PC.
    {   return;   }

    // Triggering object was a PC, cycle through all objects in area and apply the earthquake effect if appropriate.
    object oTarget = GetFirstObjectInArea(oArea);
        // We are looking for creatures. Don't apply the effect to doors, placeables, items, etc.
        if(GetObjectType(oTarget) == OBJECT_TYPE_CREATURE)
            // Stop anything the target creature may be doing (TRUE = including combat).
            AssignCommand(oTarget, ClearAllActions(TRUE));

            // Apply the earthquake effects to the target creature.
            ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SCREEN_SHAKE), oTarget);
            AssignCommand(oTarget, ActionPlayAnimation(ANIMATION_LOOPING_DEAD_BACK, 1.0, 3.0));
        // Get next possible target in area
        oTarget = GetNextObjectInArea(oArea);

See Also

functions: ActionDoCommand | ActionSit | AssignCommand | DelayCommand
categories: Action on Object Functions | Combat Actions Functions

 author: Iskander Merriman, editor: Jasperre, Jimmy Buffit, Mistress, additional contributors: Richard Dobkins, Jassper, Axe, Jasperre, Jimmy Buffit