ClearAllActions(int)
Clears currently queued actions from the calling object.
void ClearAllActions( int nClearCombatState = FALSE );
Contents |
[edit] Parameters
- nClearCombatState
- Stop all current actions, combat optional. (Default: FALSE)
[edit] Description
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.
[edit] Remarks
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.
[edit] Version
1.64
[edit] Example
// 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)) return; // 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); } }
[edit] See Also
functions: | DelayCommand |
author: Iskander Merriman, editor: Jasperre, Jimmy Buffit, Mistress, additional contributors: Richard Dobkins, Jassper, Axe, Jasperre, Jimmy Buffit