Arma 3 Scripting

Command in Animations

animate

Also available as Markdown and JSON, or read the original wiki page.

Description

Activates given object animation. Animation is defined in CfgModels animations class. Class names listed in CfgVehicles AnimationSources bound to "Proxy" controller can also be animated with animate command (see Arma 3: createVehicle/vehicles).

Note

Since Arma 3 v2.24 parachutes are supported. The phases for a parachute animation are: 0...1 - pulling of the parachute from the bag, 1...2 - opening of the canopy, 2...3 packing of the canopy. The animation name is "". You can only skip forward the animation of the parachute. For example:

_para animate ["", 1]; // skips parachute animation forward to the canopy opening

Giving negative phase would delay the whole parachute opening animation until the phase rolls up to 0. See also animationPhase

Note

Arma 3: - It is recommended that animateSource command is used instead of animate whenever is possible, as it is more efficient and optimised for multiplayer

  • Since Arma 3 v1.58 animation names can be obtained with animationNames

Warning

Mixing animateSource command with animate command to animate the same part may produce some undefined behaviour.

Syntax

object animate [animationName, phase, speed]

Parameters:

Returns: Nothing

Examples

Example 1

_building animate ["maindoor", 1];

Example 2

_building animate ["Door_1_rot", 1, true];

Example 3

Create Offroad and add flashing police light bar:

offroad = "C_Offroad_01_F" createVehicle (player getRelPos [5, 0]);
offroad animate ["HidePolice", 0];
offroad animate ["BeaconsStart", 1];

See also

animationPhase · setFaceAnimation · animateSource · animationSourcePhase · animateDoor · doorPhase · animationNames

Community notes

Mikero

Animations can be used on existing game models such as houses that have doors eg. The general syntax is

house animate ["dvere1", 1]

to 'open' the door and

house animate ["dvere1", 0]

to 'close' it. Whether used on Oem addons, or official ones, an internal working knowledge (via config.cpp) of the model's animated name(s) is required.

'open' and 'close' are visual perceptions of the state of the model, and are a design decision of the p3d. Open does not, necessarily mean, 1, and close does not mean 0.

'0' and '1' are better seen as FULLY_OFF and FULLY_ON

If a door is initially closed in the model, FULLY_ON, will open it. If it is initialy OPEN visually, in the model, FULLY_ON will close it.

(in config cpp) does not alter open and close meanings, all it does is set the model to the 'on' (rather than 'off') state to begin with. Whether on means open or close visually is a p3d design decision.

Tyger

Also, to animate the object called "Bar Gate" in ArmA, use the following:

myGate animate ["Bargate",1]

to close it, and

myGate animate ["Bargate", 0]

to open it.

RageBone

"Bargate" was exchanged with "Door_1_rot" at one point:

object animate ["Bargate", 0]; // doesn't work
object animate ["Door_1_rot", 0]; // works
SteveStevenson

For pop-up targets, you can keep the target down (until you tell it to pop up) with:

target1 animate ["terc", 1];

When you're ready for the target to pop up, you can use:

target1 animate ["terc", 0];

With this setting, the target will return to its usual behavior of going down when hit and automatically popping back up again. To make the target stay down after being hit, add the following line:

target1 addEventHandler ["HitPart", { target1 animate ["terc", 1]; }];