animate: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "Category:Scripting Commands ArmA2" to "Category:Scripting Commands Arma 2") |
Lou Montana (talk | contribs) (Fix description and clean comments) |
||
Line 11: | Line 11: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Activates given object animation. Animation is defined in CfgModels | | Activates given object animation. Animation is defined in CfgModels [[Model Config#Animations|animations]] class.<br> | ||
Since {{arma3}} v1.58 animation names can be obtained with [[animationNames]].<br> | |||
<br | <br> | ||
Class names listed in CfgVehicles [[Model Config#AnimationSources|AnimationSources]] bound to "Proxy" controller can also be animated with [[animate]] command (see [[createVehicle/vehicles]]). | |||
{ | |||
{{Feature arma3| It is recommended that [[animateSource]] command is used instead of [[animate]] whenever is possible, as it is more efficient and optimised for MP}} | {{Feature arma3| It is recommended that [[animateSource]] command is used instead of [[animate]] whenever is possible, as it is more efficient and optimised for MP}} | ||
Line 50: | Line 21: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| objectName | | objectName [[animate]] [animationName, phase, speed] |SYNTAX= | ||
|p1= objectName: [[Object]] |PARAMETER1= | |p1= objectName: [[Object]] |PARAMETER1= | ||
Line 58: | Line 29: | ||
|p3= animationName: [[String]] - name of the animation. This is the class-name of the animation defined in the config. |PARAMETER3= | |p3= animationName: [[String]] - name of the animation. This is the class-name of the animation defined in the config. |PARAMETER3= | ||
|p4= phase: [[Number]] - range 0 (start point of the animation) to 1 (end point of the animation). The speed, in which the animation is processed, is defined in the addon's config.cpp and cannot be changed during running missions. | | |p4= phase: [[Number]] - range 0 (start point of the animation) to 1 (end point of the animation). The speed, in which the animation is processed, is defined in the addon's config.cpp and cannot be changed during running missions. |PARAMETER4= | ||
|p5= speed: [[Boolean]] or [[Number]] - When [[true]] animation is instant. Since | |p5= speed: [[Boolean]] or [[Number]] - When [[true]] animation is instant. Since {{arma3}} v1.65.138459 [[Number]] > 0 is treated as config speed value multiplier |PARAMETER5= | ||
| [[Nothing]] |RETURNVALUE= | | [[Nothing]] |RETURNVALUE= | ||
Line 67: | Line 38: | ||
|x1= <code>_building [[animate]] ["maindoor", 1];</code> |EXAMPLE1= | |x1= <code>_building [[animate]] ["maindoor", 1];</code> |EXAMPLE1= | ||
|x2= <code>_building [[animate]] ["Door_1_rot", 1, [[true]]];</code> |EXAMPLE2= | |x2= <code>_building [[animate]] ["Door_1_rot", 1, [[true]]];</code> |EXAMPLE2= | ||
|x3= Create Offroad and add flashing police light bar:<code>offroad = "C_Offroad_01_F" [[createVehicle]] ([[player]] [[getRelPos]] [5, 0]); | |x3= Create Offroad and add flashing police light bar:<code>offroad = "C_Offroad_01_F" [[createVehicle]] ([[player]] [[getRelPos]] [5, 0]); | ||
offroad [[animate]] ["HidePolice", 0]; | offroad [[animate]] ["HidePolice", 0]; | ||
Line 81: | Line 54: | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<dd class="notedate">Posted on Aug 2007 | <dd class="notedate">Posted on Aug 2007 | ||
<dt class="note"> | <dt class="note">[[User:Mikero|Mikero]] | ||
<dd class="note">Animations can be used on existing game models such as houses that have doors eg. The general syntax is<code>house [[animate]] ["dvere1", 1]</code>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.<br> | |||
'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. | <br> | ||
'0' and '1' are better seen as FULLY_OFF and FULLY_ON | '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. <br> | ||
'0' and '1' are better seen as FULLY_OFF and FULLY_ON<br> | |||
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. | 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.<br> | ||
<br> | |||
initphase=1; (in config cpp) does not alter open and close meanings, all it does | <tt>initphase = 1;</tt> (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. | ||
<dd class="notedate">Posted on June 2011 | <dd class="notedate">Posted on June 2011 | ||
<dt class="note"> | <dt class="note">[[User:Tyger|Tyger]] | ||
<dd class="note">Also, to animate the object called "Bar Gate" in ArmA, use the following: <code>myGate [[animate]] ["Bargate",1]</code> to close it, and <code>myGate [[animate]] ["Bargate", 0]</code> to open it. | |||
<!-- Note Section END --> | <!-- Note Section END --> | ||
</dl> | </dl> | ||
Line 98: | Line 71: | ||
<h3 style="display:none">Bottom Section</h3> | <h3 style="display:none">Bottom Section</h3> | ||
[[Category:Scripting Commands| | [[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting Commands OFP 1. | [[Category:Scripting Commands OFP 1.96|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting Commands OFP 1. | [[Category:Scripting Commands OFP 1.99|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting Commands ArmA | [[Category:Scripting Commands ArmA|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Command Group: System Commands|{{uc:{{PAGENAME}}}}]] | |||
<!-- CONTINUE Notes --> | <!-- CONTINUE Notes --> | ||
Line 129: | Line 85: | ||
<dt class="note">[[User:RageBone|RageBone]]</dt> | <dt class="note">[[User:RageBone|RageBone]]</dt> | ||
<dd class="note"> | <dd class="note"> | ||
"Bargate" was exchanged with "Door_1_rot" at one point: | |||
<code>object [[animate]] ["Bargate", 0]; {{cc|doesn't work}}</code> | |||
<code>object [[animate]] ["Door_1_rot", 0]; {{cc|works}}</code> | |||
<code>object animate ["Bargate", 0];</code | |||
<code>object animate ["Door_1_rot", 0];</code | |||
</dd> | </dd> | ||
</dl> | </dl> | ||
<dl class="command_description"> | <dl class="command_description"> | ||
<dd class="notedate">Posted on March 14, 2016 - 00:34 (UTC)</dd> | <dd class="notedate">Posted on March 14, 2016 - 00:34 (UTC)</dd> | ||
Line 148: | Line 96: | ||
<dd class="note"> | <dd class="note"> | ||
To animate bargate use [[animateSource]]: | To animate bargate use [[animateSource]]: | ||
<code>bargate animateSource ["Door_1_source", 1];</code> | <code>bargate [[animateSource]] ["Door_1_source", 1];</code> | ||
</dd> | </dd> | ||
</dl> | </dl> | ||
<dl class="command_description"> | <dl class="command_description"> | ||
<dd class="notedate">Posted on November 25, 2017 - 20:55 (UTC)</dd> | <dd class="notedate">Posted on November 25, 2017 - 20:55 (UTC)</dd> | ||
Line 159: | Line 105: | ||
<dd class="note"> | <dd class="note"> | ||
For pop-up targets, you can keep the target down (until you tell it to pop up) with: | |||
<code>target1 [[animate]] ["terc", 1];</code> | |||
When you're ready for the target to pop up, you can use: | |||
<code>target1 [[animate]] ["terc", 0];</code> | |||
:<code>target1 addEventHandler ["HitPart", {target1 animate ["terc", 1];}];</code> | 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: | ||
<code>target1 [[addEventHandler]] ["HitPart", { target1 [[animate]] ["terc", 1]; }];</code> | |||
</dd> | </dd> | ||
</dl> | </dl> | ||
<!-- DISCONTINUE Notes --> | <!-- DISCONTINUE Notes --> |
Revision as of 15:27, 7 February 2020
Description
- Description:
- Activates given object animation. Animation is defined in CfgModels animations class.
Since Arma 3 v1.58 animation names can be obtained with animationNames.
Class names listed in CfgVehicles AnimationSources bound to "Proxy" controller can also be animated with animate command (see createVehicle/vehicles). - Groups:
- Uncategorised
Syntax
- Syntax:
- objectName animate [animationName, phase, speed]
- Parameters:
- objectName: Object
- [animationName, phase, speed]: Array
- animationName: String - name of the animation. This is the class-name of the animation defined in the config.
- phase: Number - range 0 (start point of the animation) to 1 (end point of the animation). The speed, in which the animation is processed, is defined in the addon's config.cpp and cannot be changed during running missions.
- speed: Boolean or Number - When true animation is instant. Since Arma 3 v1.65.138459 Number > 0 is treated as config speed value multiplier
- Return Value:
- 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];
Additional Information
- See also:
- animationPhasesetFaceAnimationanimateSourceanimationSourcePhaseanimateDoordoorPhaseanimationNames
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
Notes
- Posted on Aug 2007
- 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.
initphase = 1; (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. - Posted on June 2011
- Tyger
- Also, to animate the object called "Bar Gate" in ArmA, use the following:
myGate animate ["Bargate",1]
to close it, andmyGate animate ["Bargate", 0]
to open it.
Bottom Section
- Posted on February 16, 2016 - 21:33 (UTC)
- 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
- Posted on March 14, 2016 - 00:34 (UTC)
- Killzone Kid
-
To animate bargate use animateSource:
bargate animateSource ["Door_1_source", 1];
- Posted on November 25, 2017 - 20:55 (UTC)
- 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]; }];
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint: Resistance version 1.75
- Operation Flashpoint: Resistance: New Scripting Commands
- Operation Flashpoint: Resistance: Scripting Commands
- Command Group: Uncategorised
- Scripting Commands: Global Effect
- Scripting Commands OFP 1.96
- Scripting Commands OFP 1.99
- Scripting Commands ArmA
- Scripting Commands Arma 2
- Scripting Commands Arma 3
- Scripting Commands Take On Helicopters
- Command Group: System Commands