{"name":"BIS_fnc_ambientAnim","operator":null,"title":"BIS fnc ambientAnim","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_ambientAnim","revid":329376,"updated":"2022-07-27T12:38:16Z","groups":["Ambient"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.00"}],"since":{"game":"arma3","name":"Arma 3","version":"1.00"},"arma3_since":"1.00","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Play set of ambient animations on given unit. If the unit should react to combat, use BIS_fnc_ambientAnimCombat instead.\n\n> [!NOTE]\n> Animations can be cancelled using `_unit call BIS_fnc_ambientAnim__terminate`.","syntaxes":[{"syntax":"[unit, animationSet, equipmentLevel, snapTo, interpolate, attachToLogic] call BIS_fnc_ambientAnim","since":null,"effect":null,"exec":null,"params":[{"name":"unit","type":"Object","optional":false,"default":null,"description":"unit that will play the animations","types":["Object"],"since":null,"text":"unit: Object - unit that will play the animations"},{"name":"animationSet","type":"String","optional":false,"default":null,"description":"the animation set to play. Possible values:\n\n|  |  |  |\n|---|---|---|\n| *some values are missing due to duplicate results, e.g \"STAND\" does the same as \"STAND1\"* |  |  |\n| - STAND1<br>- STAND2<br>- STAND_U1<br>- STAND_U2<br>- STAND_U3<br>- WATCH<br>- WATCH2<br>- GUARD<br>- LISTEN_BRIEFING<br>- LEAN_ON_TABLE<br>- LEAN | - SIT_AT_TABLE<br>- SIT1<br>- SIT<br>- SIT3<br>- SIT_U1<br>- SIT_U2<br>- SIT_U3<br>- SIT_HIGH1<br>- SIT_HIGH<br>- SIT_LOW<br>- SIT_LOW_U<br>- SIT_SAD1<br>- SIT_SAD2 | - KNEEL<br>- REPAIR_VEH_PRONE<br>- REPAIR_VEH_KNEEL<br>- REPAIR_VEH_STAND<br>- PRONE_INJURED_U1<br>- PRONE_INJURED_U2<br>- PRONE_INJURED<br>- KNEEL_TREAT<br>- KNEEL_TREAT2<br>- BRIEFING<br>- BRIEFING_POINT_LEFT<br>- BRIEFING_POINT_RIGHT<br>- BRIEFING_POINT_TABLE |","types":["String"],"since":null,"text":"animationSet: String - the animation set to play. Possible values:\n\n|  |  |  |\n|---|---|---|\n| *some values are missing due to duplicate results, e.g \"STAND\" does the same as \"STAND1\"* |  |  |\n| - STAND1<br>- STAND2<br>- STAND_U1<br>- STAND_U2<br>- STAND_U3<br>- WATCH<br>- WATCH2<br>- GUARD<br>- LISTEN_BRIEFING<br>- LEAN_ON_TABLE<br>- LEAN | - SIT_AT_TABLE<br>- SIT1<br>- SIT<br>- SIT3<br>- SIT_U1<br>- SIT_U2<br>- SIT_U3<br>- SIT_HIGH1<br>- SIT_HIGH<br>- SIT_LOW<br>- SIT_LOW_U<br>- SIT_SAD1<br>- SIT_SAD2 | - KNEEL<br>- REPAIR_VEH_PRONE<br>- REPAIR_VEH_KNEEL<br>- REPAIR_VEH_STAND<br>- PRONE_INJURED_U1<br>- PRONE_INJURED_U2<br>- PRONE_INJURED<br>- KNEEL_TREAT<br>- KNEEL_TREAT2<br>- BRIEFING<br>- BRIEFING_POINT_LEFT<br>- BRIEFING_POINT_RIGHT<br>- BRIEFING_POINT_TABLE |"},{"name":"equipmentLevel","type":"String","optional":false,"default":null,"description":"the equipment level of the unit. Possible values:\n- NONE\n- LIGHT\n- MEDIUM\n- FULL\n- ASIS\n- RANDOM","types":["String"],"since":null,"text":"equipmentLevel: String - the equipment level of the unit. Possible values:\n- NONE\n- LIGHT\n- MEDIUM\n- FULL\n- ASIS\n- RANDOM"},{"name":"snapTo","type":"Object","optional":true,"default":"objNull","description":"the object where the unit will be snapped to","types":["Object"],"since":null,"text":"snapTo: Object - (Optional, default objNull) the object where the unit will be snapped to"},{"name":"interpolate","type":"Boolean","optional":true,"default":"false","description":"should try to interpolate into the ambient animation. Works only for some default stances","types":["Boolean"],"since":null,"text":"interpolate: Boolean - (Optional, default false) should try to interpolate into the ambient animation. Works only for some default stances"},{"name":"attachToLogic","type":"Boolean","optional":true,"default":"true","description":"true to attach the unit to the created logic object, forcing it in one position","types":["Boolean"],"since":null,"text":"attachToLogic: Boolean - (Optional, default true) true to attach the unit to the created logic object, forcing it in one position"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"}}],"examples":[{"text":"```sqf\n[player, \"STAND1\", \"ASIS\"] call BIS_fnc_ambientAnim;\n```","code":["[player, \"STAND1\", \"ASIS\"] call BIS_fnc_ambientAnim;"]},{"text":"```sqf\n// will search for a chair within 2 meters around the unit and will place the unit on it\n[_unit, \"SIT\", \"NONE\"] call BIS_fnc_ambientAnim;\n```","code":["// will search for a chair within 2 meters around the unit and will place the unit on it\n[_unit, \"SIT\", \"NONE\"] call BIS_fnc_ambientAnim;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["BIS_fnc_ambientAnimCombat","BIS_fnc_ambientAnimGetParams"],"notes":[{"user":"PierreMGI","date":"2016-02-19T04:24:00Z","text":"In 3den editor, place a blufor unit (B_soldier_A_F) near a camping chair (land_campingChair_V2_F).\n\nIn init field of the unit:\n\n```sqf\n[this, \"SIT2\"] call BIS_fnc_ambientAnim;\n0 = this spawn {\n    waitUntil { behaviour _this == \"combat\"};\n    _this call BIS_fnc_ambientAnim__terminate;\n};\n```\n\nWhen this unit is aware of a threat, he will quit the \"ambient animation\" and will able to return fire.\n\nNote: BIS_fnc_ambientAnimCombat doesn't need this script but the list of animations is limited."},{"user":"PierreMGI","date":"2016-08-08T01:37:00Z","text":"To make this command working in MP (hosted server tested)\n\n```sqf\n[this, \"SIT2\"] call BIS_fnc_ambientAnim; // wrong! the first JIP will throw the unit to position [0,0,0]\nif (isServer) then { [this, \"SIT2\"] call BIS_fnc_ambientAnim; }; // wrong! only player located on server will see the animation\nif (local this) then { [this, \"SIT2\"] call BIS_fnc_ambientAnim; }; // OK, best way\nif (isServer) then { [this, \"SIT2\"] remoteExecCall [\"BIS_fnc_ambientAnim\"]; }; // OK\n```"},{"user":"Icaruk","date":"2016-08-11T16:33:00Z","text":"Be careful using this function multiple times on MP, it creates a Logic using createUnit (which is global).\n\nIf you use it on 20 units, 20 additional logics will be created."}],"categories":["Arma 3: Functions","Arma 3: New Functions","Function Group: Ambient","Functions","Introduced with Arma 3 version 1.00"],"docblock":null,"filled_from_docblock":[]}