{"name":"BIS_fnc_animateFlag","operator":null,"title":"BIS fnc animateFlag","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_animateFlag","revid":364735,"updated":"2024-05-30T21:39:57Z","groups":["Object Manipulation"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.68"}],"since":{"game":"arma3","name":"Arma 3","version":"1.68"},"arma3_since":"1.68","branch":null,"locality":{"argument":"global","effect":"global","server_exec":false},"exec":null,"description":"Smoothly animates given flag from current position on the flag pole to the given position. When flag animation is done, the scripted event handler \"FlagAnimationDone\" is called.","syntaxes":[{"syntax":"[flag, phase, instant] call BIS_fnc_animateFlag","since":null,"effect":null,"exec":null,"params":[{"name":"flag","type":"Object","optional":false,"default":null,"description":"flag object of the type \"FlagCarrier\"","types":["Object"],"since":null,"text":"flag: Object - flag object of the type \"FlagCarrier\""},{"name":"phase","type":"Number","optional":false,"default":null,"description":"desired animation phase 0..1 (0 - bottom of the flag pole, 1 - top of the flag pole)","types":["Number"],"since":null,"text":"phase: Number - desired animation phase 0..1 (0 - bottom of the flag pole, 1 - top of the flag pole)"},{"name":"instant (Optional, default false)","type":null,"optional":false,"default":null,"description":"- Boolean - when true, animation is instant (\"FlagAnimationDone\" EH is not called in this case)\n- Number - animation duration multiplier","types":[],"since":null,"text":"instant (Optional, default false):\n- Boolean - when true, animation is instant (\"FlagAnimationDone\" EH is not called in this case)\n- Number - animation duration multiplier"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"}}],"examples":[{"text":"```sqf\n[flag1, 0] call BIS_fnc_animateFlag;\n```","code":["[flag1, 0] call BIS_fnc_animateFlag;"]},{"text":"```sqf\n// Adding the \"FlagAnimationDone\" EH\nprivate _eh = [<yourflag>, \"FlagAnimationDone\", { /* your code */ }] call BIS_fnc_addScriptedEventHandler;\n```","code":["// Adding the \"FlagAnimationDone\" EH\nprivate _eh = [<yourflag>, \"FlagAnimationDone\", { /* your code */ }] call BIS_fnc_addScriptedEventHandler;"]}],"multiplayer":"The effect is global, MP compatible and its effect is persistent.","problems":null,"aliases":[],"see_also":["flag","flagOwner","setFlagOwner","setFlagSide","setFlagTexture","flagSide","flagTexture","setFlagAnimationPhase","flagAnimationPhase","Arma 3: Flag Textures"],"notes":[{"user":"Killzone_Kid","date":"2016-12-12T20:02:00Z","text":"Flag Demo (https://www.youtube.com/watch?v=sJtQfRML0cc)\n\n```sqf\nfnc_addFlagAction =\n{\n    _this addAction\n    [\n        \"Pull The Cord\",\n        {\n            player playAction \"PutDown\";\n            sleep 0.5;\n            [_this select 0, flagAnimationPhase (_this select 0) + 0.2, 0.2] call BIS_fnc_animateFlag;\n            _this select 0 removeAction (_this select 2);\n        },\n        \"\",\n        10,\n        true,\n        true,\n        \"\",\n        \"_this distance2D _target < 2\"\n    ];\n};\n\nprivate _flag = createVehicle [\"Flag_BI_F\", player getRelPos [10, 0], [], 0, \"CAN_COLLIDE\"];\n[_flag, 0, true] call BIS_fnc_animateFlag;\n_flag call fnc_addFlagAction;\n\n[\n    _flag,\n    \"FlagAnimationDone\",\n    {\n        if (_this select 1 > 0.9) exitWith\n        {\n            [_this select 0, \"FlagAnimationDone\"] call BIS_fnc_removeAllScriptedEventHandlers;\n            removeAllActions (_this select 0);\n        };\n        _this select 0 call fnc_addFlagAction;\n    }\n]\ncall BIS_fnc_addScriptedEventHandler;\n```"}],"categories":["Arma 3: Functions","Arma 3: New Functions","Function Group: Object Manipulation","Functions","Functions: Global Effect","Introduced with Arma 3 version 1.68"],"docblock":null,"filled_from_docblock":[]}