From NWN Lexicon
Jump to: navigation, search

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 nClearCombatState is TRUE, 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. Place this script in the OnEnter event
// of a generic trigger.
void main()
    object oPC = GetEnteringObject();
    // Stop here if the triggering object is not a PC.
    if (!GetIsPC(oPC))
    // Cycle through all objects in area and apply the earthquake effect if appropriate.
    object oArea   = GetArea(OBJECT_SELF);
    object oTarget = GetFirstObjectInArea(oArea);
    while (GetIsObjectValid(oTarget))
        // 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:  DelayCommand

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