switchMove: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(corrected kronsky's wrongful locality assumption. Moved note about locality into description)
Line 6: Line 6:
|1.00|= Game version
|1.00|= Game version


|arg= global |= Arguments in MP
|arg= local |= Arguments in MP


|eff= local |= Effects in MP
|eff= global |= Effects in MP
____________________________________________________________________________________________
____________________________________________________________________________________________


| When used on a person, the given move is started immediately (there is no transition). Use switchmove "" to switch back to the default movement if there is no transition back, otherwise the person may be stuck.
| Applies given animation to a unit. When used on a person, the given move is started immediately (there is no transition). Use <tt>_unit [[switchMove]] "";</tt> to reset animation. For a smooth transition use [[playMove]].<br><br>
 
{{Informative | This command has global effect when executed locally to the unit and will sync for JIP. In this case the animation on the executing machine is immediate while on remote machines it will be transitional. In order for the animation to change immediately on every PC in multiplayer, use global remote execution (see example 2). When the argument is remote, the animation change on the executing PC is only temporary. }}<br>


[[:ArmA2:_Moves|List of moves in ArmA 2]]<br />
[[:ArmA2:_Moves|List of moves in ArmA 2]]<br />
Line 20: Line 22:
| person '''switchmove''' movename |= Syntax
| person '''switchmove''' movename |= Syntax


|p1= person: [[Object]] |= Parameter 1
|p1= person: [[Object]] - unit  |= Parameter 1


|p2= movename: [[String]] |= Parameter 2
|p2= movename: [[String]] - unit animation (see [[animationState]])|= Parameter 2


| [[Nothing]] |= Return value
| [[Nothing]] |= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
|x1= <code>_loon1 [[switchMove]] "FXStandDip" </code> |= Example 1
|x1= Prone: <code>[[player]] [[switchMove]] "amovppnemstpsraswrfldnon";</code> |= Example 1
|x2= Sit player immediately and globally: <code><nowiki>[</nowiki>[[player]], "amovpsitmstpslowwrfldnon"] [[remoteExec]] ["switchMove", 0];</code> |= Example 2
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 37: Line 40:
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->
For a smooth transition use [[playMove]]. This command must be executed after mission start. If you place it into init.sqs or in the Init field of some unit, it will not work. Just add a little delay (~0.001) and then place the command.
 
<dd class="notedate">Posted on March 25, 2007 - 23:48
<dd class="notedate">Posted on March 25, 2007 - 23:48
<dt class="note">'''[[User:Hurricane|Hurricane]]'''<dd class="note">
<dt class="note">'''[[User:Hurricane|Hurricane]]'''<dd class="note">
Line 51: Line 54:


<h3 style="display:none">Bottom Section</h3>
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|SWITCHMOVE]]
[[Category:Scripting Commands OFP 1.99|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP 1.96|SWITCHMOVE]]
[[Category:Scripting Commands OFP 1.46|SWITCHMOVE]]
[[Category:Scripting Commands ArmA|SWITCHMOVE]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
<!-- CONTINUE Notes -->
Line 71: Line 66:
<!-- DISCONTINUE Notes -->
<!-- DISCONTINUE Notes -->


<!-- CONTINUE Notes -->
[[Category:Scripting Commands|SWITCHMOVE]]
<dl class="command_description">
[[Category:Scripting Commands OFP 1.99|{{uc:{{PAGENAME}}}}]]
<dd class="notedate">Posted on October 20, 2018 - 19:48 (UTC)</dd>
[[Category:Scripting Commands OFP 1.96|SWITCHMOVE]]
<dt class="note">[[User:Freghar|Freghar]]</dt>
[[Category:Scripting Commands OFP 1.46|SWITCHMOVE]]
<dd class="note">
[[Category:Scripting Commands ArmA|SWITCHMOVE]]
This command is not strictly EL; when it is run on the server in MP, new players who join in progress will also have the animation playing, despite the command never having run locally.
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
</dd>
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
</dl>
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
<!-- DISCONTINUE Notes -->

Revision as of 22:20, 20 October 2018

Hover & click on the images for description

Description

Description:
Applies given animation to a unit. When used on a person, the given move is started immediately (there is no transition). Use _unit switchMove ""; to reset animation. For a smooth transition use playMove.

This command has global effect when executed locally to the unit and will sync for JIP. In this case the animation on the executing machine is immediate while on remote machines it will be transitional. In order for the animation to change immediately on every PC in multiplayer, use global remote execution (see example 2). When the argument is remote, the animation change on the executing PC is only temporary.

List of moves in ArmA 2
List of moves in Armed Assault

List of moves in Operation Flashpoint: Resistance
Groups:
Uncategorised

Syntax

Syntax:
person switchmove movename
Parameters:
person: Object - unit
movename: String - unit animation (see animationState)
Return Value:
Nothing

Examples

Example 1:
Prone: player switchMove "amovppnemstpsraswrfldnon";
Example 2:
Sit player immediately and globally: [player, "amovpsitmstpslowwrfldnon"] remoteExec ["switchMove", 0];

Additional Information

See also:
playMoveplayMoveNowswitchActionplayActionplayActionNow

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 March 25, 2007 - 23:48
Hurricane
In some cases the movement won't stay. I.e. AI hostages that put their hands behind their heads (_hostage switchMove "AmovPercMstpSsurWnonDnon") won't hold their hands up, unless you first use disableAI "autoTarget" on them. They mostly put their hands down because they 'noticed' unknown objects.
Posted on August 03, 2008 - 22:43
Killswitch
This command will not cause an AnimChanged or AnimDone event. However, playMove will.

Bottom Section

Posted on November 12, 2016 - 20:11 (UTC)
AgentRev
When using this command on the player unit outside unscheduled UI contexts, it will cause a minor camera glitch for a single frame.
For example, Draw3D and KeyDown are UI contexts and so are not affected by the glitch, but EachFrame and scheduled scripts are not UI contexts and are affected by the glitch.