switchGesture: Difference between revisions

From Bohemia Interactive Community
m (Text replacement - "\| *arma2 * * *\| *([0-1]\.[0-9]{2}) * \|game2" to "|game1= arma2 |version1= $1 |game2")
m (Some wiki formatting)
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{RV|type=command
{{RV|type=command
|arg= Local
|eff= Global


|game1= arma2
|game1= arma2
Line 16: Line 19:


|descr= When used on a person,the given move is started immediately (without transition).
|descr= When used on a person,the given move is started immediately (without transition).
{{Feature|arma3|
Since {{GVI|arma3|2.18|size= 0.75}} it is possible to play [[gestureState|gesture states]] (define in config under <sqf inline>"CfgGesturesMale" >> "states"</sqf> for male soldiers).
In addition, it is also possible to play [[animationState|move states]] (define in config under <sqf inline>"CfgMovesMaleSdr" >> "states"</sqf> for male soldiers) as gestures if they have a valid mask defined in their configs (for example, weapon switching animations have a "WeaponSwitching" mask that only affects the upper body, so they work correctly with this command).
}}


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


|p1= soldier: [[Object]]
|p1= soldier: [[Object]]
Line 25: Line 32:
|r1= [[Nothing]]
|r1= [[Nothing]]


|x1= <code>soldierOne [[switchGesture]] "Wave";</code>
|s2= soldier [[switchGesture]] [moveName, time, blendFactor, resetAim]
|s2since= arma3 2.18
 
|p21= soldier: [[Object]]


|seealso= [[playGesture]]
|p22= moveName: [[String]] - entry from <sqf inline>"CfgMovesMaleSdr" >> "states"</sqf> or <sqf inline>"CfgGesturesMale" >> "states"</sqf>
}}
 
|p23= time: [[Number]] - (Optional, default 0) normalised 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]]
 
|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;
private _m = animationState player;
private _g = gestureState player;
private _i = getUnitMovesInfo player;
private _a = getUnitMovesInfo ai1;


<dl class="command_description">
if (animationState ai1 != _m || abs(_i # 1 - _a # 1) > 0.1) then
{
ai1 switchMove [_m, _i # 0, _i # 3, false];
};


<dt><dt>
if ((gestureState ai1 != _g || abs(_i # 6 - _a # 6) > 0.1) && (_g != "<none>" && _g find "_player" < 0)) then
<dd class="notedate">Posted on August 31, 2010</dd>
{
<dt class="note">[[User:kju|kju]]</dt>
ai1 switchGesture [_g, _i # 5, _i # 8, false];
<dd class="note">
};
Rpt says "Not implemented" as of OA 1.54.
}
</sqf>


</dl>
|seealso= [[playGesture]] [[getUnitMovesInfo]] [[switchMove]]
}}


{{GameCategory|arma3|Scripting Commands}}
{{Note
{{GameCategory|tkoh|Scripting Commands}}
|user= .kju
|timestamp= 20100831184200
|text= Rpt says "Not implemented" as of OA 1.54.
}}

Latest revision as of 13:08, 29 December 2025

Hover & click on the images for description

Description

Description:
When used on a person,the given move is started immediately (without transition).
Arma 3
Since Arma 3 logo black.png 2.18 it is possible to play gesture states (define in config under "CfgGesturesMale" >> "states" for male soldiers). In addition, it is also possible to play move states (define in config under "CfgMovesMaleSdr" >> "states" for male soldiers) as gestures if they have a valid mask defined in their configs (for example, weapon switching animations have a "WeaponSwitching" mask that only affects the upper body, so they work correctly with this command).
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) normalised 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; private _m = animationState player; private _g = gestureState player; private _i = getUnitMovesInfo player; private _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.
Only post proven facts here! Add Note
.kju - c
Posted on Aug 31, 2010 - 18:42 (UTC)
Rpt says "Not implemented" as of OA 1.54.