{"name":"switchGesture","title":"switchGesture","type":"command","url":"https://community.bistudio.com/wiki/switchGesture","revid":376921,"updated":"2025-12-29T12:08:48Z","groups":["Animations"],"status":"ok","games":{"arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2 1.00","arma3_since":"0.50","locality":{"argument":"local","effect":"global"},"description":"When used on a person,the given move is started immediately (without transition).\n\n> [!NOTE]\n> **Arma 3:** Since Arma 3 v2.18 it is possible to play gesture states (define in config under `\"CfgGesturesMale\" >> \"states\"` for male soldiers).\n> In addition, it is also possible to play move states (define in config under `\"CfgMovesMaleSdr\" >> \"states\"` for male soldiers) as gestures if they have a valid mask defined in their configs (for example, weapon switching animations have a \"WeaponSwitching\" mask that only affects the upper body, so they work correctly with this command).","syntaxes":[{"syntax":"soldier switchGesture moveName","params":[{"name":"soldier","type":"Object","type_expr":"Object"},{"name":"moveName","type":"String","type_expr":"String"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"soldier"},"right":{"text":"moveName"}},{"syntax":"soldier switchGesture [moveName, time, blendFactor, resetAim]","since":"arma3 2.18","params":[{"name":"soldier","type":"Object","type_expr":"Object"},{"name":"moveName","type":"String","description":"entry from `\"CfgMovesMaleSdr\" >> \"states\"` or `\"CfgGesturesMale\" >> \"states\"`","type_expr":"String"},{"name":"time","type":"Number","optional":true,"default":"0","description":"normalised time, in range 0..1, where 0 = beginning of the animation, and 1 = end of the animation","type_expr":"Number","text":"time: Number - (Optional, default 0) normalised time, in range 0..1, where 0 = beginning of the animation, and 1 = end of the animation"},{"name":"blendFactor","type":"Number","optional":true,"default":"1","description":"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).","type_expr":"Number","text":"blendFactor: Number - (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)."},{"name":"resetAim","type":"Boolean","optional":true,"default":"true","description":"whether the aim/head direction should be reset after switching","type_expr":"Boolean","text":"resetAim: Boolean - (Optional, default true) whether the aim/head direction should be reset after switching"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"soldier"},"right":{"text":"[moveName, time, blendFactor, resetAim]"}}],"examples":[{"code":["soldierOne switchGesture \"Wave\";"]},{"text":"```sqf\n// Create a dummy agent that copies your moves\nai1 = createAgent [typeOf player, getPosATL player, [], 0, \"NONE\"];\nai1 disableAI \"ALL\";\n\nonEachFrame\n{\n    ai1 setAnimSpeedCoef getAnimSpeedCoef player;\n    ai1 setVectorDir vectorDir player;\n    private _m = animationState player;\n    private _g = gestureState player;\n    private _i = getUnitMovesInfo player;\n    private _a = getUnitMovesInfo ai1;\n\n    if (animationState ai1 != _m || abs(_i # 1 - _a # 1) > 0.1) then\n    {\n        ai1 switchMove [_m, _i # 0, _i # 3, false];\n    };\n\n    if ((gestureState ai1 != _g || abs(_i # 6 - _a # 6) > 0.1) && (_g != \"<none>\" && _g find \"_player\" < 0)) then\n    {\n        ai1 switchGesture [_g, _i # 5, _i # 8, false];\n    };\n}\n```","code":["// Create a dummy agent that copies your moves\nai1 = createAgent [typeOf player, getPosATL player, [], 0, \"NONE\"];\nai1 disableAI \"ALL\";\n\nonEachFrame\n{\n\tai1 setAnimSpeedCoef getAnimSpeedCoef player;\n\tai1 setVectorDir vectorDir player;\n\tprivate _m = animationState player;\n\tprivate _g = gestureState player;\n\tprivate _i = getUnitMovesInfo player;\n\tprivate _a = getUnitMovesInfo ai1;\n\n\tif (animationState ai1 != _m || abs(_i # 1 - _a # 1) > 0.1) then\n\t{\n\t\tai1 switchMove [_m, _i # 0, _i # 3, false];\n\t};\n\n\tif ((gestureState ai1 != _g || abs(_i # 6 - _a # 6) > 0.1) && (_g != \"<none>\" && _g find \"_player\" < 0)) then\n\t{\n\t\tai1 switchGesture [_g, _i # 5, _i # 8, false];\n\t};\n}"]}],"see_also":["playGesture","getUnitMovesInfo","switchMove"],"notes":[{"user":".kju","date":"2010-08-31T18:42:00Z","text":"Rpt says \"Not implemented\" as of OA 1.54."}]}