Page tree
Skip to end of metadata
Go to start of metadata



Introduced in

Version:2.00

Description

Description:When used on a person, a smooth transition to the given action or gesture is initiated.
  • Actions - Actions are "shortcuts" for animations, which work regardless of the state of the unit they are applied to (for example, standing / running, armed / unarmed). The selected action is converted to an appropriate animation, depending on the state of the unit. For instance, if you apply the "salute" action, while the unit arm is down, it is translated into "amovpercmstpslowwrfldnon_salutein" (moving the arm up). If you again apply the same "salute" action, while the arm is still up, it then applies the animation "amovpercmstpslowwrfldnon_saluteout" (moving the arm down). These action mappings have to be defined by hand, in the appropriate animation configurations. Not all actions are available for all states (in which case, the associated animation is a blank string in the action configuration entry). Typical actions are: Crouch, PlayerCrouch, PlayerStand, Stand, binocOff, binocOn, die, down, handGunOn, reloadMagazine, salute, strokeGun.
  • Gestures - Gestures are body movements, independent from regular animations. They can either affect the whole body, or only certain parts, and can be executed, regardless of the unit current state, and even run concurrently to another animation. So, it is possible to apply the same gesture (for example, a hand signal), whether the unit is standing, running, swimming, or parachuting. While technically a gesture can be executed during most animation states, it is not guaranteed though, that the effect is realistic (for example, a prone unit may move its arms through the ground). An ongoing or looped gesture can be aborted by executing a different gesture. For a list of gestures, open the CfgGesturesMale class in the Configuration Browser.

Syntax

Syntax:unit playAction action
Parameters:
  • unit: Object - Person to perform the animation.
  • action: String - Name of action, as defined in the configuration.
Return Value:Nothing

Examples

Examples:soldierOne playAction "SitDown"soldierOne playAction "GestureAdvance"

Additional Information

See also: playActionNow, switchAction, playMove, switchMove
Multiplayer: 
Problems: 

Notes







Posted on July 25, 2012
Kronzky
To determine whether a specific action or gesture exists for a unit's current animationState, you can use the following code:


// unit to check
_unit = tst_ai;
// gesture's or action's class name to check
_chkAction = "GestureNod"; 

// Gestures: e.g. GestureNod, WeaponMagazineReloadStand
// Actions: e.g. strokeGun, sitDown


clearRadio;
_unitType = typeOf _unit;
// find out which animation config the unit is using (e.g. CfgMovesMaleSdrNG)
_animConfig = getText (configFile>>"cfgvehicles">>_unitType>>"moves"); 
player sidechat _animConfig;

// find out which action config is associated with the current animation 
// (e.g. AmovPercMstpSnonWnonDnon uses CivilStandActions)
_animation = animationState _unit; 
_actionsConfig = getText (configFile>>_animConfig>>"states">>_animation>>"actions"); 
player sidechat _actionsConfig;

// go through the defined actions for this config, and see if the desired gesture is defined
_exists = false;
_type = "";
_actionsList = (configFile>>_animConfig>>"Actions">>_actionsConfig);
while {configName _actionsList!=""} do {
  for "_i" from 0 to (count _actionsList)-1 do {
    _action = _actionsList select _i;
    // if action is an array, it's a gesture, so check its first element
    if (isArray _action) then {
      _arr = getArray _action;
      if (count _arr==2) then {
        if (_arr select 0==_chkAction) exitWith {
          _exists = true;
          _type = "Gesture ";
        };
      };
    } else {
      // if it's an action, check if there's an animation assigned to it (if it's empty, then the action is not available)
      if (configName _action==_chkAction) exitWith {
        _exists = (getText _action!="");
        _type = "Action ";
      };
    };
    if (_type!="") exitWith {};
  };
  _actionsList = inheritsFrom _actionsList;
};
player sidechat format["%1'%2' is%3 available",_type,_chkAction,if (_exists) then {""} else {" NOT"}];