ClearAllActions(int)
Removes all actions from an action queue.
void ClearAllActions( int nClearCombatState = FALSE );
Parameters
nClearCombatState
Stop combat along with all other actions. (Default: FALSE)
Description
Clear all the actions of the caller's action queue. Use this to cancel any previous instructions to an object (often an NPC), before assigning new orders. Note that unless TRUE is passed for nClearCombatState, any current fighting involving the caller of ClearAllActions will continue.
Remarks
The distinction between commands and actions for the purpose of ClearAllActions is a bit nebulous. See the example below.
Contrary to the nwscript.nss help, this command can be assigned to any action queue (including triggers), not just that of a creature.
Version
1.29
Example
// in the OnEnter script of a trigger #include "nw_i0_generic" void main() { object oPC = GetEnteringObject(); if (! GetIsPC(oPC)) return; DelayCommand( 1.0, ClearAllActions()); DelayCommand( 2.0, SendMessageToPC(oPC, "Hello")); // not an action - gets displayed DelayCommand( 3.0, ActionSpeakString("Hello again")); // Action. Gets cancelled. DelayCommand( 4.0, SpeakString("Hello again")); // also counts as an action - cancelled. }
See Also
functions: | ActionDoCommand | AssignCommand | DelayCommand |
categories: | Action on Object Functions | Combat Actions Functions |
author: Iskander Merriman, editor: Charles Feduke, additional contributor(s): Richard Dobkins, Jassper
Send comments on this topic.