{"name":"action","operator":null,"title":"action","type":"command","url":"https://community.bistudio.com/wiki/action","revid":378568,"updated":"2026-05-08T21:16:17Z","groups":["Interaction"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":"global","server_exec":false},"exec":null,"description":"Make a unit perform an action. See Category:Actions for action names and syntaxes.\n\n> [!NOTE]\n> **Arma 3:** Since Arma 3 2.18 it is possible to use actionNow to perform some actions immediately without any animation.\n> However, note that some actions do require animations (for example, opening inventory while on foot), otherwise they will get cancelled.\n\n> [!NOTE]\n> - 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.\n> - the alternative syntax creates a temporary Logic entity in place of *unit*.","syntaxes":[{"syntax":"unit action actionArray","since":null,"effect":null,"exec":null,"params":[{"name":"unit","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"unit: Object"},{"name":"actionArray","type":"Array","optional":false,"default":null,"description":null,"types":["Array"],"since":null,"text":"actionArray: Array"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"unit","types":["Object"]},"right":{"text":"actionArray","types":["Array"]}},{"syntax":"action actionArray","since":"arma3 2.10","effect":null,"exec":null,"params":[{"name":"actionArray","type":"Array","optional":false,"default":null,"description":null,"types":["Array"],"since":null,"text":"actionArray: Array"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"unary","operator":null,"left":null,"right":{"text":"actionArray","types":["Array"]}}],"examples":[{"text":"```sqf\nplayer action [\"SitDown\", player];\n```","code":["player action [\"SitDown\", player];"]},{"text":"```sqf\n_soldier action [\"Eject\", vehicle _soldier];\n```","code":["_soldier action [\"Eject\", vehicle _soldier];"]},{"text":"```sqf\nplayer action [\"UseWeapon\", player, player, 7]; // plays pick up animation before throwing grenade\naction [\"UseWeapon\", player, player, 7]; // normal grenade throw\n```","code":["player action [\"UseWeapon\", player, player, 7]; // plays pick up animation before throwing grenade\naction [\"UseWeapon\", player, player, 7]; // normal grenade throw"]}],"multiplayer":"> [!IMPORTANT]\n> The argument's locality is **usually** local, but some actions can take a global argument (e.g \"Eject\", \"GetOut\", \"GetInXXXX\", \"MoveToXXXX\").\n> See Category:Actions for more details.","problems":null,"aliases":[],"see_also":["actionNow","actionIDs","actionParams","addAction","setUserActionText","inGameUISetEventHandler","showHUD","inputAction","removeAction","removeAllActions","weaponsInfo","shownAction"],"notes":[{"user":"Tom_48_97","date":"2009-08-28T09:26:00Z","text":"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."},{"user":"DreadedEntity","date":"2015-03-27T17:57:00Z","text":"This command has no effect when a dead unit is used as input."},{"user":"DrSova","date":"2017-06-27T02:15:00Z","text":"```sqf\nplayer action [\"SWITCHWEAPON\", player, player, -1]\n```\n\nSwitching weapon to the back."},{"user":"Yuval","date":"2017-07-20T12:22:00Z","text":"Some of the actions (such as \"DropWeapon\") do not always execute, and there should be a set of conditions for them to run.\nThe unit must be able to perform the dropping animation in order for the action to properly execute.\nSo, 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.\n\nAlso, 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.\nThere 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."}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Interaction","Introduced with Operation Flashpoint version 1.00","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Scripting Commands: Global Effect","Take On Helicopters: Scripting Commands"]}