---
name: "switchMove"
type: command
status: ok
groups: ["Animations"]
arma3_since: "0.50"
locality: {"argument": "local", "effect": "global", "server_exec": false}
source: https://community.bistudio.com/wiki/switchMove
revid: 378292
updated: 2026-04-01T13:01:19Z
---

# switchMove

*Command · Animations · Arma 3 v0.50 · introduced in Operation Flashpoint v1.00*

Locality: arguments **local** · effect **global**

## Description

Immediately applies given animation to the unit. For a smooth transition from the current animation (by connecting animations successively, e.g `CurrentAnim -> Intermediate1 -> Intermediate2 -> TargetAnim`), use [playMove](../commands/playMove.md) or [playMoveNow](../commands/playMoveNow.md).

> [!NOTE]
> see Category:Moves for respective games animations.

This command first resets the unit's animation states (including aiming state, gesture state, etc.) then puts the unit in the first frame of the animation (therefore showing no transition).
If an invalid animation is provided, the unit's animations will be reset but no new animation will be played (see [#Example 3](../commands/switchMove.md#example-3)).

> [!NOTE]
> It is a good practice to always use [playMoveNow](../commands/playMoveNow.md) after [switchMove](../commands/switchMove.md) to make sure the animation plays correctly when using the first syntax:
>
> ```sqf
> _unit switchMove "myMove";
> _unit playMoveNow "myMove";
> ```
>
> The alternative syntax does this automatically.

## Syntax

### Syntax 1

```sqf
person switchMove moveName
```

**Parameters:**

- `person`: [Object](../topics/Object.md) - unit
- `moveName`: [String](../topics/String.md) - animation state (see [animationState](../commands/animationState.md))

**Returns:** [Nothing](../topics/Nothing.md)

### Syntax 2

*since arma3 2.18*

```sqf
person switchMove [moveName, time, blendFactor, resetAim]
```

**Parameters:**

- `person`: [Object](../topics/Object.md) - unit
- `moveName`: [String](../topics/String.md) - entry from `"CfgMovesMaleSdr" >> "states"` or `"CfgGesturesMale" >> "states"`
- `time`: [Number](../topics/Number.md) - (Optional, default 0) normalized time, in range 0..1, where 0 = beginning of the animation, and 1 = end of the animation
- `blendFactor`: [Number](../topics/Number.md) - (Optional, default 1) how much to blend the current animation with the new animation, in range 0..1, where 0 = current animation, and 1 = new animation. When 1 is used, the switching is instant (not smooth), similar to the first syntax.
- `resetAim`: [Boolean](../topics/Boolean.md) - (Optional, default true) whether the aim/head direction should be reset after switching

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

Prone:

```sqf
player switchMove "AmovPpneMstpSrasWrflDnon";
```

### Example 2

Sit player immediately and globally:

```sqf
[player, "AmovPsitMstpSlowWrflDnon"] remoteExec ["switchMove"];
```

### Example 3

Resets unit's animation:

```sqf
_unit switchMove "";
```

### Example 4

```sqf
// Create a dummy agent that copies your moves
ai1 = createAgent [typeOf player, getPosATL player, [], 0, "NONE"];
ai1 disableAI "ALL";
onEachFrame
{
    ai1 setAnimSpeedCoef getAnimSpeedCoef player;
    ai1 setVectorDir vectorDir player;
    private _m = animationState player;
    private _g = gestureState player;
    private _i = getUnitMovesInfo player;
    private _a = getUnitMovesInfo ai1;
    
    if (animationState ai1 != _m || abs(_i#1 - _a#1) > 0.1) then
    {
        ai1 switchMove [_m, _i#0, _i#3, false];
    };

    if ((gestureState ai1 != _g || abs(_i#6 - _a#6) > 0.1) && (_g != "<none>" && _g find "_player" < 0)) then
    {
        ai1 switchGesture [_g, _i#5, _i#8, false];
    };
}
```

## Multiplayer

This command has a global effect when executed locally to the unit and will synchronise properly for JIP.
In this case the animation on the executing machine is immediate while on remote machines it will be transitional.
In order for the animation to change immediately on every PC in multiplayer, use global remote execution (see [#Example 2](../commands/switchMove.md#example-2)).
When the argument is remote, the animation change on the executing PC is only temporary.

## See also

[switchGesture](../commands/switchGesture.md) · [playMove](../commands/playMove.md) · [playMoveNow](../commands/playMoveNow.md) · [switchAction](../commands/switchAction.md) · [playAction](../commands/playAction.md) · [playActionNow](../commands/playActionNow.md) · [animationState](../commands/animationState.md) · [getUnitMovesInfo](../commands/getUnitMovesInfo.md)

## Community notes

**Hurricane** — 2007-03-25

In some cases the movement won't stay. I.e. AI hostages that put their hands behind their heads (_hostage [switchMove](../commands/switchMove.md) "AmovPercMstpSsurWnonDnon") won't hold their hands up, unless you first use [disableAI](../commands/disableAI.md) "autoTarget" on them. They mostly put their hands down because they 'noticed' unknown objects.

---

**Killswitch** — 2008-08-03

This command will not cause an AnimChanged or AnimDone event. However, [playMove](../commands/playMove.md) will.

---

**AgentRev** — 2016-11-12

When using this command on the [player](../commands/player.md) unit outside [unscheduled](../topics/Scheduler.md#unscheduled_environment) UI contexts, it will cause a minor camera glitch for a single frame.

For example,  [Draw3D](../topics/Mission_Event_Handlers.md#draw3d) and [KeyDown](../commands/displayAddEventHandler.md) are UI contexts and so are not affected by the glitch, but [EachFrame](../topics/Mission_Event_Handlers.md#eachframe) and [scheduled](../topics/Scheduler.md#scheduled_environment) scripts are not UI contexts and are affected by the glitch.

---

**Leopard20** — 2021-08-08

If the animation you're trying to use with this command has no connection/interpolation to the unit's base animation (usually "AmovPercMstpSrasWrflDnon"), the move might not play using [switchMove](../commands/switchMove.md) alone. In such cases you have to do this:

```sqf
_unit switchMove _move; _unit playMoveNow _move;
```

This must run in **[unscheduled environment](../topics/Scheduler.md)** (see [isNil](../commands/isNil.md))

Alternatively, just use the second syntax:

```sqf
_unit switchMove [_move];
```

---

**Leopard20** — 2025-11-04

You can loop an animation using a function like this (it's recommended to do `ai disableAI "ANIM"` first)

```sqf
// TAG_fnc_loopAnim
params ["_unit", "_anim"];

// remove old EH
_unit removeEventHandler ["AnimStateChanged", _unit getVariable ["TAG_AnimStateChangedEH", -1]];

private _EH = -1;
// if anim is empty, just stop looping
if (_anim != "") then
{
    _EH = _unit addEventHandler ["AnimStateChanged", {  
        params ["_unit", "_anim"]; 
        private _loopedAnim = _unit getVariable ["TAG_LoopedAnim", ""];
        if (alive _unit && _anim != _loopedAnim) then {
            _unit switchMove [_loopedAnim, 0, 0, false];
        };
    }];
};

_unit setVariable ["TAG_AnimStateChangedEH", _EH];
_unit setVariable ["TAG_LoopedAnim", _anim];

// start the anim
_unit switchMove [_anim, 0, 0, false];
```

Then use the above code in a function, either by defining it in the function library or by doing 

```sqf
TAG_fnc_loopAnim = { above code }
```

How to use the function:

```sqf
// start looping
[testUnit, "HubSittingChairUA_move1"] call TAG_fnc_loopAnim;

// stop looping
[testUnit, ""] call TAG_fnc_loopAnim;
```

<sub>Source: [BI Community Wiki — switchMove](https://community.bistudio.com/wiki/switchMove) (revision 378292).</sub>
