{"name":"BIS_fnc_ambientAnim","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","games":{"arma3":"1.00"},"since":"arma3 1.00","arma3_since":"1.00","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","params":[{"name":"unit","type":"Object","description":"unit that will play the animations","type_expr":"Object"},{"name":"animationSet","type":"String","description":"the animation set to play. Possible values:\n\n***some values are missing due to duplicate results, e.g \"STAND\" does the same as \"STAND1\"***\n\n|  |  |  |\n|---|---|---|\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 |","type_expr":"String"},{"name":"equipmentLevel","type":"String","description":"the equipment level of the unit. Possible values:\n\n- NONE\n- LIGHT\n- MEDIUM\n- FULL\n- ASIS\n- RANDOM","type_expr":"String"},{"name":"snapTo","type":"Object","optional":true,"default":"objNull","description":"the object where the unit will be snapped to","type_expr":"Object","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","type_expr":"Boolean","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","type_expr":"Boolean","text":"attachToLogic: Boolean - (Optional, default true) true to attach the unit to the created logic object, forcing it in one position"}],"returns":{"type":"Nothing","type_expr":"Nothing"}}],"examples":[{"code":["[player, \"STAND1\", \"ASIS\"] call BIS_fnc_ambientAnim;"]},{"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;"]}],"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).\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.\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).\nIf you use it on 20 units, 20 additional logics will be created."}]}