BIS fnc animateFlag: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) No edit summary |
Killzone Kid (talk | contribs) (example) |
||
Line 38: | Line 38: | ||
<h3 style="display:none">Bottom Section</h3> | <h3 style="display:none">Bottom Section</h3> | ||
[[Category:Functions|{{uc:animateFlag}}]] | |||
[[Category:Functions|{{uc: | [[Category:{{Name|arma3}}: Functions|{{uc:animateFlag}}]] | ||
[[Category:{{Name|arma3}}: Functions|{{uc: | |||
<!-- CONTINUE Notes --> | <!-- CONTINUE Notes --> | ||
Line 46: | Line 45: | ||
<dd class="notedate">Posted on December 12, 2016 - 20:02 (UTC)</dd> | <dd class="notedate">Posted on December 12, 2016 - 20:02 (UTC)</dd> | ||
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt> | <dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt> | ||
<dd class="note"> | <dd class="note"><code>// Flag Demo | ||
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]]; | |||
</code> | |||
</dd> | </dd> | ||
</dl> | </dl> | ||
<!-- DISCONTINUE Notes --> | <!-- DISCONTINUE Notes --> |
Revision as of 21:07, 12 December 2016
Description
- Description:
- Smoothly animates given flag from current position on the flag pole to the given position. The function is global, MP and JIP compatible, persistent and will syncronise flags across the network. When flag animation is done, the scripted event handler "FlagAnimationDone" is called. To add scripted event handler to the flag use:
_eh = [<yourflag>, "FlagAnimationDone", <yourcode>] call BIS_fnc_addScriptedEventHandler;
NOTE: Never put call to this function into object init field - Execution:
- call
- Groups:
- Uncategorised
Syntax
- Syntax:
- [flag, phase, instant] call BIS_fnc_animateFlag
- Parameters:
- flag: Object - flag object of the type "FlagCarrier"
- phase: Number - desired animation phase 0...1 (0 - bottom of the flag pole, 1 - top of the flag pole)
- instant (Optional):
- Return Value:
- Nothing
Examples
- Example 1:
[flag1, 0] call BIS_fnc_animateFlag;
Additional Information
- See also:
- flagflagOwnersetFlagOwnersetFlagSidesetFlagTextureflagSideflagTexturesetFlagAnimationPhaseflagAnimationPhaseFlag Textures
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
[[Category:Introduced with arma3dev version 1.67]][[ Category: arma3dev: New Functions | BIS FNC ANIMATEFLAG]][[ Category: arma3dev: Functions | BIS FNC ANIMATEFLAG]]
Notes
Bottom Section
- Posted on December 12, 2016 - 20:02 (UTC)
- Killzone Kid
// Flag Demo 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;