switchGesture: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(add. classification)
m (Text replacement - "kju" to ".kju")
 
(54 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma2 |= Game name
|arg= Local
|eff= Global


|1.00|= Game version
|game1= arma2
____________________________________________________________________________________________
|version1= 1.00


| When used on a person,the given move is started immediately (there is no transition). |= Description
|game2= arma2oa
____________________________________________________________________________________________
|version2= 1.50


| soldier '''switchGesture''' moveName |= Syntax
|game3= tkoh
|version3= 1.00


|p1= soldier:  -  |= PARAMETER1
|game4= arma3
|version4= 0.50


|p2= Object,moveName:  -  |= PARAMETER2
|gr1= Animations


|p3= |= PARAMETER3
|descr= When used on a person,the given move is started immediately (without transition).


| [[Nothing]] |= RETURNVALUE
|s1= soldier [[switchGesture]] moveName


|p1= soldier: [[Object]]


|x1= <code>soldierOne switchGesture "Wave"</code>|= EXAMPLE1
|p2= moveName: [[String]]


____________________________________________________________________________________________
|r1= [[Nothing]]


|  |= SEEALSO
|s2= soldier [[switchGesture]] [moveName, time, blendFactor, resetAim]
|s2since= arma3 2.18
|p21= soldier: [[Object]]
|p22= moveName: [[String]] - Entry from {{hl|"CfgMovesMaleSdr" >> "states"}} or {{hl|"CfgGesturesMale" >> "states"}}
|p23= time: [[Number]] - (Optional, default: 0) normalized time, in range 0-1, where 0 = beginning of the animation, and 1 = end of the animation
|p24= blendFactor: [[Number]] - (Optional, default 1) how much to blend the current animation with the new animation, in range 0..1, where 0 = current animation, and 1 = new animation. When 1 is used, the switching is instant (not smooth).
|p25= resetAim: [[Boolean]] - (Optional, default: true) Whether the aim/head direction should be reset after switching
|r2= [[Nothing]]


| |= MPBEHAVIOUR
|x1= <sqf>soldierOne switchGesture "Wave";</sqf>
____________________________________________________________________________________________
|x2= <sqf>// Create a dummy agent that copies your moves
ai1 = createAgent [typeOf player, getPosATL player, [], 0, "NONE"];
ai1 disableAI "ALL";
onEachFrame
{
ai1 setAnimSpeedCoef getAnimSpeedCoef player;
ai1 setVectorDir vectorDir player;
_m = animationState player;
_g = gestureState player;
_i = getUnitMovesInfo player;
_a = getUnitMovesInfo ai1;
 
if (animationState ai1 != _m || abs(_i#1 - _a#1) > 0.1) then {
ai1 switchMove [_m, _i#0, _i#3, false];
};
if ((gestureState ai1 != _g || abs(_i#6 - _a#6) > 0.1) && (_g != "<none>" && _g find "_player" < 0)) then {
ai1 switchGesture [_g, _i#5, _i#8, false];
};
}
</sqf>
|seealso= [[playGesture]] [[getUnitMovesInfo]] [[switchMove]]
}}
}}


<h3 style='display:none'>Notes</h3>
<dl class="command_description">
<dl class='command_description'>
 
<!-- Note Section BEGIN -->
<dt><dt>
<dd class="notedate">Posted on 2010-08-31</dd>
<dt class="note">[[User:.kju|.kju]]</dt>
<dd class="note">
Rpt says "Not implemented" as of OA 1.54.


<!-- Note Section END -->
</dl>
</dl>
<h3 style='display:none'>Bottom Section</h3>
[[Category:ArmA 2: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]

Latest revision as of 20:32, 3 May 2024

Hover & click on the images for description

Description

Description:
When used on a person,the given move is started immediately (without transition).
Groups:
Animations

Syntax

Syntax:
soldier switchGesture moveName
Parameters:
soldier: Object
moveName: String
Return Value:
Nothing

Alternative Syntax

Syntax:
soldier switchGesture [moveName, time, blendFactor, resetAim]
Parameters:
soldier: Object
moveName: String - Entry from "CfgMovesMaleSdr" >> "states" or "CfgGesturesMale" >> "states"
time: Number - (Optional, default: 0) normalized time, in range 0-1, where 0 = beginning of the animation, and 1 = end of the animation
blendFactor: Number - (Optional, default 1) how much to blend the current animation with the new animation, in range 0..1, where 0 = current animation, and 1 = new animation. When 1 is used, the switching is instant (not smooth).
resetAim: Boolean - (Optional, default: true) Whether the aim/head direction should be reset after switching
Return Value:
Nothing

Examples

Example 1:
soldierOne switchGesture "Wave";
Example 2:
// Create a dummy agent that copies your moves ai1 = createAgent [typeOf player, getPosATL player, [], 0, "NONE"]; ai1 disableAI "ALL"; onEachFrame { ai1 setAnimSpeedCoef getAnimSpeedCoef player; ai1 setVectorDir vectorDir player; _m = animationState player; _g = gestureState player; _i = getUnitMovesInfo player; _a = getUnitMovesInfo ai1; if (animationState ai1 != _m || abs(_i#1 - _a#1) > 0.1) then { ai1 switchMove [_m, _i#0, _i#3, false]; }; if ((gestureState ai1 != _g || abs(_i#6 - _a#6) > 0.1) && (_g != "<none>" && _g find "_player" < 0)) then { ai1 switchGesture [_g, _i#5, _i#8, false]; }; }

Additional Information

See also:
playGesture getUnitMovesInfo switchMove

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 2010-08-31
.kju
Rpt says "Not implemented" as of OA 1.54.