BIS fnc animateFlag: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Remove arma3dev and fix description)
m (Fix minor stuff)
Line 24: Line 24:
|p2= phase: [[Number]] - desired animation phase 0...1 (0 - bottom of the flag pole, 1 - top of the flag pole) |PARAMETER2=
|p2= phase: [[Number]] - desired animation phase 0...1 (0 - bottom of the flag pole, 1 - top of the flag pole) |PARAMETER2=


|p3= instant (Optional):  
|p3= instant (Optional, default [[false]]):  
* [[Boolean]] - when [[true]], animation is instant ("FlagAnimationDone" EH is not called in this case). Default: [[false]]
* [[Boolean]] - when [[true]], animation is instant ("FlagAnimationDone" EH is not called in this case)
* [[Number]] - animation duration multiplier |PARAMETER3=
* [[Number]] - animation duration multiplier |PARAMETER3=


Line 34: Line 34:


|x2= <code>{{cc|Adding the "FlagAnimationDone" EH}}
|x2= <code>{{cc|Adding the "FlagAnimationDone" EH}}
[[private]] _eh {{=}} [<yourflag>, "FlagAnimationDone", {{codecomment|/* your code */}}] [[call]] [[BIS_fnc_addScriptedEventHandler]];</code> |EXAMPLE2=
[[private]] _eh = [<yourflag>, "FlagAnimationDone", { {{codecomment|/* your code */}} }] [[call]] [[BIS_fnc_addScriptedEventHandler]];</code> |EXAMPLE2=
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 43: Line 43:
<h3 style="display:none">Notes</h3>
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Functions|{{uc:animateFlag}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:animateFlag}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<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"><code>// Flag Demo (https://www.youtube.com/watch?v=sJtQfRML0cc)
<dd class="note"><code>{{cc|Flag Demo (https://www.youtube.com/watch?v{{=}}sJtQfRML0cc)}}


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


[
[
_flag,  
_flag,
"FlagAnimationDone",  
"FlagAnimationDone",
{
{
[[if]] (_this [[select]] 1 > 0.9) [[exitWith]]  
[[if]] (_this [[select]] 1 > 0.9) [[exitWith]]
{
{
[_this [[select]] 0, "FlagAnimationDone"] [[call]] [[BIS_fnc_removeAllScriptedEventHandlers]];
[_this [[select]] 0, "FlagAnimationDone"] [[call]] [[BIS_fnc_removeAllScriptedEventHandlers]];
Line 93: Line 83:
_this [[select]] 0 [[call]] fnc_addFlagAction;
_this [[select]] 0 [[call]] fnc_addFlagAction;
}
}
]  
]
[[call]] [[BIS_fnc_addScriptedEventHandler]];
[[call]] [[BIS_fnc_addScriptedEventHandler]];
</code>
</code>
</dd>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->
 
<h3 style="display:none">Bottom Section</h3>
 
 
[[Category:Functions|{{uc:animateFlag}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:animateFlag}}]]

Revision as of 21:06, 24 March 2020

Hover & click on the images for description

Description

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.
Never place this function into an object's init field.
Execution:
call
Multiplayer:
The effect is global, MP compatible and its effect is persistent.
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, default false):
  • Boolean - when true, animation is instant ("FlagAnimationDone" EH is not called in this case)
  • Number - animation duration multiplier
Return Value:
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;

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

Notes

Posted on December 12, 2016 - 20:02 (UTC)
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;

Bottom Section