BIS fnc animateFlag: Difference between revisions
Jump to navigation
Jump to search
m (formatting) |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
(14 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
|game1= arma3 | |game1= arma3 | ||
|version1= 1.68 | |version1= 1.68 | ||
Line 11: | Line 10: | ||
|eff= global | |eff= global | ||
|descr= 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. | |descr= Smoothly animates given flag from current position on the flag pole to the given position. When flag animation is done, the {{Link|Arma 3: Scripted Event Handlers|scripted event handler}} {{Link|Arma 3: Scripted Event Handlers#BIS_fnc_animateFlag|"FlagAnimationDone"}} is called. | ||
|mp= The effect is global, MP compatible and its effect is persistent. | |||
|mp= The effect is global, MP compatible and its effect is persistent. | |||
|s1= [flag, phase, instant] call [[BIS_fnc_animateFlag]] | |s1= [flag, phase, instant] call [[BIS_fnc_animateFlag]] | ||
Line 21: | Line 18: | ||
|p1= flag: [[Object]] - [[flag]] object of the type "FlagCarrier" | |p1= flag: [[Object]] - [[flag]] object of the type "FlagCarrier" | ||
|p2= phase: [[Number]] - desired animation phase 0 | |p2= phase: [[Number]] - desired animation phase 0..1 (0 - bottom of the flag pole, 1 - top of the flag pole) | ||
|p3= instant (Optional, default [[false]]): | |p3= instant (Optional, default [[false]]): | ||
Line 29: | Line 26: | ||
|r1= [[Nothing]] | |r1= [[Nothing]] | ||
|x1= < | |x1= <sqf>[flag1, 0] call BIS_fnc_animateFlag;</sqf> | ||
|x2= < | |x2= <sqf> | ||
// Adding the "FlagAnimationDone" EH | |||
private _eh = [<yourflag>, "FlagAnimationDone", { /* your code */ }] call BIS_fnc_addScriptedEventHandler; | |||
</sqf> | |||
|seealso= [[flag]] | |seealso= [[flag]] [[flagOwner]] [[setFlagOwner]] [[setFlagSide]] [[setFlagTexture]] [[flagSide]] [[flagTexture]] [[setFlagAnimationPhase]] [[flagAnimationPhase]] [[Arma 3: Flag Textures]] | ||
}} | }} | ||
{{Note | |||
|user= Killzone_Kid | |||
|timestamp= 20161212200200 | |||
|text= Flag Demo (https://www.youtube.com/watch?v=sJtQfRML0cc) | |||
<sqf> | |||
fnc_addFlagAction = | fnc_addFlagAction = | ||
{ | { | ||
_this | _this addAction | ||
[ | [ | ||
"Pull The Cord", | "Pull The Cord", | ||
{ | { | ||
player playAction "PutDown"; | |||
sleep 0.5; | |||
[_this | [_this select 0, flagAnimationPhase (_this select 0) + 0.2, 0.2] call BIS_fnc_animateFlag; | ||
_this | _this select 0 removeAction (_this select 2); | ||
}, | }, | ||
"", | "", | ||
10, | 10, | ||
true, | |||
true, | |||
"", | "", | ||
"_this | "_this distance2D _target < 2" | ||
]; | ]; | ||
}; | }; | ||
private _flag = createVehicle ["Flag_BI_F", player getRelPos [10, 0], [], 0, "CAN_COLLIDE"]; | |||
[_flag, 0, | [_flag, 0, true] call BIS_fnc_animateFlag; | ||
_flag | _flag call fnc_addFlagAction; | ||
[ | [ | ||
Line 71: | Line 69: | ||
"FlagAnimationDone", | "FlagAnimationDone", | ||
{ | { | ||
if (_this select 1 > 0.9) exitWith | |||
{ | { | ||
[_this | [_this select 0, "FlagAnimationDone"] call BIS_fnc_removeAllScriptedEventHandlers; | ||
removeAllActions (_this select 0); | |||
}; | }; | ||
_this | _this select 0 call fnc_addFlagAction; | ||
} | } | ||
] | ] | ||
call BIS_fnc_addScriptedEventHandler; | |||
</ | </sqf> | ||
}} | |||
Latest revision as of 22:39, 30 May 2024
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.
- Execution:
- call
- Multiplayer:
- The effect is global, MP compatible and its effect is persistent.
- Groups:
- Object Manipulation
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):
- Return Value:
- Nothing
Examples
- Example 1:
- Example 2:
Additional Information
- See also:
- flag flagOwner setFlagOwner setFlagSide setFlagTexture flagSide flagTexture setFlagAnimationPhase flagAnimationPhase Arma 3: Flag 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
- Posted on Dec 12, 2016 - 20:02 (UTC)
-
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;