action: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(58 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| ofp |= Game name
|game1= ofp
|version1= 1.00


|1.00|= Game version
|game2= ofpe
|version2= 1.00


|arg= local |= Arguments in MP
|game3= arma1
|version3= 1.00


|eff= global |= Effects in MP
|game4= arma2
____________________________________________________________________________________________
|version4= 1.00


| Make a unit to perform an action. Use the [[:Category:Actions|List of Actions]] for reference about the available actions and their syntax.  
|game5= arma2oa
|version5= 1.50


[[Image:arguments_global.gif]]
|game6= tkoh
<br><br>'''NOTES:'''
|version6= 1.00
* While this command should be executed where unit is [[local]], it is not always the case. Actions such as "Eject", "GetOut", "GetInXXXX", "MoveToXXXX", etc can be executed on remote units.
* In SP, when user Alt+Tabs the simulation is paused and so the action will also halt until user returns to the game. For example, <tt>[[player]] [[action]] ["GetInDriver", car]</tt> executed while user is Alt+Tabbed will result in user seeing the action happening when he returns to the game screen. This doesn't happen in MP. |= Description
____________________________________________________________________________________________


| unit '''action''' actionArray |= Syntax
|game7= arma3
|version7= 0.50


|p1= unit: [[Object]] |= Parameter 1
|eff= global


|p2= actionArray: [[Array]] |= Parameter 2
|gr1= Interaction


| [[Nothing]] |= Return value
|descr= Make a unit perform an action. See [[:Category:Actions]] for action names and syntaxes.
____________________________________________________________________________________________
{{Feature|arma3|
 
Since {{arma3}} 2.18 it is possible to use [[actionNow]] to perform some actions immediately without any animation.
|x1= <code>[[player]] [[action]] ["SitDown", [[player]]];</code> |= Example 1
However, note that some actions do require animations (for example, opening inventory while on foot), otherwise they will get cancelled.
}}
{{Feature|informative|
* in singleplayer, when user Alt-Tabs the simulation is paused and so the action will also halt until user returns to the game. For example, <sqf inline>player action ["GetInDriver", car];</sqf> executed while user is Alt-Tabbed will result in the user seeing the action happening when he returns to the game screen. This does not happen in Multiplayer.
* the alternative syntax creates a temporary Logic entity in place of ''unit''.
}}
 
|mp= {{Feature|important|
The argument's [[Multiplayer Scripting#Locality|locality]] is '''usually''' local, but some actions can take a global argument (e.g "Eject", "GetOut", "GetInXXXX", "MoveToXXXX").
See [[:Category:Actions]] for more details.
}}
 
|s1= unit [[action]] actionArray
 
|p1= unit: [[Object]]


|x2= <code>_soldier [[action]] ["Eject", [[vehicle]] _soldier];</code> |= Example 2
|p2= actionArray: [[Array]]
____________________________________________________________________________________________


| [[actionIDs]], [[actionParams]], [[addAction]], [[setUserActionText]], [[inGameUISetEventHandler]], [[showHUD]], [[inputAction]], [[removeAction]], [[removeAllActions]]|= See also
|r1= [[Nothing]]


}}
|s2= [[action]] actionArray
 
|s2since= arma3 2.10
 
|p21= actionArray: [[Array]]
 
|r2= [[Nothing]]
 
|x1= <sqf>player action ["SitDown", player];</sqf>


<h3 style="display:none">Notes</h3>
|x2= <sqf>_soldier action ["Eject", vehicle _soldier];</sqf>
<dl class="command_description">
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on 28 Aug, 2009
<dt class="note">'''[[User:Tom_48_97|tom_48_97]]'''<dd class="note">
In ArmA 2, you can place a unique unit (for example a boat, far of all combats) and use it for all command lines with action.
<!-- Note Section END -->
</dl>


<h3 style="display:none">Bottom Section</h3>
|x3= <sqf>
player action ["UseWeapon", player, player, 7]; // plays pick up animation before throwing grenade
action ["UseWeapon", player, player, 7]; // normal grenade throw
</sqf>


[[Category:Scripting Commands|ACTION]]
|seealso= [[actionNow]] [[actionIDs]] [[actionParams]] [[addAction]] [[setUserActionText]] [[inGameUISetEventHandler]] [[showHUD]] [[inputAction]] [[removeAction]] [[removeAllActions]] [[weaponsInfo]]
[[Category:Scripting Commands OFP 1.99|ACTION]]
}}
[[Category:Scripting Commands OFP 1.96|ACTION]]
[[Category:Scripting Commands OFP 1.46|ACTION]]
[[Category:Scripting Commands ArmA|ACTION]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Unit_Control|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
{{Note
<dl class="command_description">
|user= Tom_48_97
<dd class="notedate">Posted on March 27, 2015 - 17:57 (UTC)</dd>
|timestamp= 20090828092600
<dt class="note">[[User:DreadedEntity|DreadedEntity]]</dt>
|text= In {{arma2}}, you can place a unique unit (for example a boat, far of all combats) and use it for all command lines with action.
<dd class="note">
}}
This command has no effect when a dead unit is used as input.
</dd>
</dl>
<!-- DISCONTINUE Notes -->


<!-- CONTINUE Notes -->
{{Note
<dl class="command_description">
|user= DreadedEntity
<dd class="notedate">Posted on June 27, 2017 - 02:15 (UTC)</dd>
|timestamp= 20150327175700
<dt class="note">[[User:DrSova|DrSova]]</dt>
|text= This command has no effect when a dead unit is used as input.
<dd class="note">
}}
<code>player action ["SWITCHWEAPON",player,player,-1]</code>
 
{{Note
|user= DrSova
|timestamp= 20170627021500
|text= <sqf>player action ["SWITCHWEAPON", player, player, -1]</sqf>
Switching weapon to the back.
Switching weapon to the back.
</dd>
}}
</dl>
<!-- DISCONTINUE Notes -->


<!-- CONTINUE Notes -->
{{Note
<dl class="command_description">
|user= Yuval
<dd class="notedate">Posted on July 20, 2017 - 12:22 (UTC)</dd>
|timestamp= 20170720122200
<dt class="note">[[User:Yuval|Yuval]]</dt>
|text= Some of the actions (such as "DropWeapon") do not always execute, and there should be a set of conditions for them to run.
<dd class="note">
Some of the actions (such as "DropWeapon") do not always execute, and there should be a set of conditions for them to run.
The unit must be able to perform the dropping animation in order for the action to properly execute.
The unit must be able to perform the dropping animation in order for the action to properly execute.
So, if for example we spawn a unit at [0,0,0] and make it perform a "DropWeapon" action - it won't work if [0,0,0] is water (which it is, if the current map is an island) because the unit will be swimming.<br /><br />
So, if for example we spawn a unit at [0,0,0] and make it perform a "DropWeapon" action - it won't work if [0,0,0] is water (which it is, if the current map is an island) because the unit will be swimming.<br>
 
<br>
 
Also, you cannot stack up actions right after the other. If you run a "DropWeapon" action when the current action animation is still going - it will not perform.
Also, you cannot stack up actions right after the other. If you run a "DropWeapon" action when the current action animation is still going - it will not perform.
There are a few more conditions for an action to perform, but relying on a hundred percent success of the action is not a good practice.
There are a few more conditions for an action to perform, but relying on a hundred percent success of the action is not a good practice.
</dd>
}}
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 16:56, 23 March 2024

Hover & click on the images for description

Description

Description:
Make a unit perform an action. See Category:Actions for action names and syntaxes.
Arma 3
Since Arma 3 2.18 it is possible to use actionNow to perform some actions immediately without any animation. However, note that some actions do require animations (for example, opening inventory while on foot), otherwise they will get cancelled.
  • in singleplayer, when user Alt-Tabs the simulation is paused and so the action will also halt until user returns to the game. For example, player action ["GetInDriver", car]; executed while user is Alt-Tabbed will result in the user seeing the action happening when he returns to the game screen. This does not happen in Multiplayer.
  • the alternative syntax creates a temporary Logic entity in place of unit.
Multiplayer:
The argument's locality is usually local, but some actions can take a global argument (e.g "Eject", "GetOut", "GetInXXXX", "MoveToXXXX"). See Category:Actions for more details.
Groups:
Interaction

Syntax

Syntax:
unit action actionArray
Parameters:
unit: Object
actionArray: Array
Return Value:
Nothing

Alternative Syntax

Syntax:
action actionArray
Parameters:
actionArray: Array
Return Value:
Nothing

Examples

Example 1:
player action ["SitDown", player];
Example 2:
_soldier action ["Eject", vehicle _soldier];
Example 3:
player action ["UseWeapon", player, player, 7]; // plays pick up animation before throwing grenade action ["UseWeapon", player, player, 7]; // normal grenade throw

Additional Information

See also:
actionNow actionIDs actionParams addAction setUserActionText inGameUISetEventHandler showHUD inputAction removeAction removeAllActions weaponsInfo

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
Tom_48_97 - c
Posted on Aug 28, 2009 - 09:26 (UTC)
In Arma 2, you can place a unique unit (for example a boat, far of all combats) and use it for all command lines with action.
DreadedEntity - c
Posted on Mar 27, 2015 - 17:57 (UTC)
This command has no effect when a dead unit is used as input.
DrSova - c
Posted on Jun 27, 2017 - 02:15 (UTC)
player action ["SWITCHWEAPON", player, player, -1]
Switching weapon to the back.
Yuval - c
Posted on Jul 20, 2017 - 12:22 (UTC)
Some of the actions (such as "DropWeapon") do not always execute, and there should be a set of conditions for them to run. The unit must be able to perform the dropping animation in order for the action to properly execute. So, if for example we spawn a unit at [0,0,0] and make it perform a "DropWeapon" action - it won't work if [0,0,0] is water (which it is, if the current map is an island) because the unit will be swimming.

Also, you cannot stack up actions right after the other. If you run a "DropWeapon" action when the current action animation is still going - it will not perform. There are a few more conditions for an action to perform, but relying on a hundred percent success of the action is not a good practice.