GetCurrentAction

From NWN Lexicon
Jump to: navigation, search



GetCurrentAction(object)

Returns the currently executing Action.

int GetCurrentAction(
    object oObject = OBJECT_SELF
);

Parameters

oObject

The object to return the Action of. (Default: OBJECT_SELF)


Description

Get the current action (ACTION_*) that oObject is executing from its Action Queue. oObject can be anything with an action queue. Modules and Areas cannot have actions assigned to them.



Remarks

As of 1.60, Defensive stance and Random Walk can be returned by new constants. Some actions still return ACTION_INVALID, however.

Use GetActionMode() to check if a creature is using parry, power attack and so on.


Version

1.22

Example

// On Phsical Attacked event, if we are currently moving, stop.
// Could use to stop a moving archery target in an archery range.
void main()
{
    if(GetUserDefinedEventNumber() == 1005)
    {
        // Check action - ACTION_MOVETOPOINT
        if(GetCurrentAction() == ACTION_MOVETOPOINT)
        {
            // Stop moving
            ClearAllActions();
            // Could do other stuff
        }
    }
}

See Also

constants: 

ACTION_* Constants



 author: Ryan Hunt, editor: Jasperre