{"name":"switchGesture","operator":null,"title":"switchGesture","type":"command","url":"https://community.bistudio.com/wiki/switchGesture","revid":376921,"updated":"2025-12-29T12:08:48Z","groups":["Animations"],"status":"ok","replaced_by":[],"games":[{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma2","name":"Arma 2","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":"local","effect":"global","server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"soldier","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"soldier: Object"},{"name":"moveName","type":"String","optional":false,"default":null,"description":null,"types":["String"],"since":null,"text":"moveName: String"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"soldier","types":["Object"]},"right":{"text":"moveName","types":["String"]}},{"syntax":"soldier switchGesture [moveName, time, blendFactor, resetAim]","since":"arma3 2.18","effect":null,"exec":null,"params":[{"name":"soldier","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"soldier: Object"},{"name":"moveName","type":"String","optional":false,"default":null,"description":"entry from `\"CfgMovesMaleSdr\" >> \"states\"` or `\"CfgGesturesMale\" >> \"states\"`","types":["String"],"since":null,"text":"moveName: String - entry from `\"CfgMovesMaleSdr\" >> \"states\"` or `\"CfgGesturesMale\" >> \"states\"`"},{"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","types":["Number"],"since":null,"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).","types":["Number"],"since":null,"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","types":["Boolean"],"since":null,"text":"resetAim: Boolean - (Optional, default true) whether the aim/head direction should be reset after switching"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"soldier","types":["Object"]},"right":{"text":"[moveName, time, blendFactor, resetAim]","types":["Array"]}}],"examples":[{"text":"```sqf\nsoldierOne switchGesture \"Wave\";\n```","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}"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["playGesture","getUnitMovesInfo","switchMove"],"notes":[{"user":".kju","date":"2010-08-31T18:42:00Z","text":"Rpt says \"Not implemented\" as of OA 1.54."}],"categories":["Arma 2: New Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Animations","Introduced with Arma 2 version 1.00","Scripting Commands","Scripting Commands: Global Effect","Take On Helicopters: Scripting Commands"]}