Arma 3 Scripting

Function in Object Manipulation

BIS_fnc_animateFlag

Also available as Markdown and JSON, or read the original wiki page.

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.

Syntax

[flag, phase, instant] call BIS_fnc_animateFlag

Parameters:

Returns: Nothing

Examples

Example 1

[flag1, 0] call BIS_fnc_animateFlag;

Example 2

// Adding the "FlagAnimationDone" EH
private _eh = [<yourflag>, "FlagAnimationDone", { /* your code */ }] call BIS_fnc_addScriptedEventHandler;

Multiplayer

The effect is global, MP compatible and its effect is persistent.

See also

flag · flagOwner · setFlagOwner · setFlagSide · setFlagTexture · flagSide · flagTexture · setFlagAnimationPhase · flagAnimationPhase · Arma 3: Flag Textures

Community notes

Killzone_Kid

Flag Demo (https://www.youtube.com/watch?v=sJtQfRML0cc)

fnc_addFlagAction =
{
    _this addAction
    [
        "Pull The Cord",
        {
            player playAction "PutDown";
            sleep 0.5;
            [_this select 0, flagAnimationPhase (_this select 0) + 0.2, 0.2] call BIS_fnc_animateFlag;
            _this select 0 removeAction (_this select 2);
        },
        "",
        10,
        true,
        true,
        "",
        "_this distance2D _target < 2"
    ];
};

private _flag = createVehicle ["Flag_BI_F", player getRelPos [10, 0], [], 0, "CAN_COLLIDE"];
[_flag, 0, true] call BIS_fnc_animateFlag;
_flag call fnc_addFlagAction;

[
    _flag,
    "FlagAnimationDone",
    {
        if (_this select 1 > 0.9) exitWith
        {
            [_this select 0, "FlagAnimationDone"] call BIS_fnc_removeAllScriptedEventHandlers;
            removeAllActions (_this select 0);
        };
        _this select 0 call fnc_addFlagAction;
    }
]
call BIS_fnc_addScriptedEventHandler;