ArmA: Actions

# Introduction

Actions are events that are usually executed in-game by the player by using the action menu, or by using the action sub-menu of the command menu when executing them upon AI in the the player's group. Actions can also be performed by and upon arbitrary units using the action script command. Executing an action in this way will generally create only the basic effect of that seen when starting actions using the action menu, so it may be necessary to script additional effects to achieve the same effect as the game's default action menu, and to maintain immersion. For example, scripted use of the "deactivate" action will not check the distance between the satchel and the collecting unit, allowing it to be used to pick up a satchel that is many kilometers away. Many actions can be executed by a different unit than the target unit, although in most cases it makes more sense to use the same unit. The unit executing the action will generally bend down as if to pick something up (the action animation), with the action effects taking place when the animation completes. It is possible to use a game logic unit to execute actions without any animation or delay.

# General Syntax

***unit* action [*"actionType"*, *parameter(s)*]**

 *parameter(s)*: | Various data types, dependant on the action used. The number of required parameters depends on the action type.

# Actions

## AutoHover

 **Example**: | chopperOne action ["autoHover", chopperOne]

## CancelAction

 **Example**: | soldierOne action ["CANCELACTION", soldierOne]

## CancelLand

 **Example**: | planeOne action ["cancelLand", planeOne]

## CancelTakeFlag

 **Example**: | westSoldierOne action ["cancelTakeFlag", eastFlag]

## DeactivateMine

 **Example**: | soldierOne action ["deactivateMine", soldierOne]

## Eject

 **Example**: | soldierOne action ["EJECT", vehicle soldierOne]

## EngineOn

 **Example**: | soldierOne action ["engineOn", vehicle soldierOne]

## EngineOff

 **Example**: | soldierOne action ["engineOff", vehicle soldierOne]

## FireInFlame

 **Example**: | soldierOne action ["fireInFlame", firePlaceOne]

## FirePutDown

 **Example**: | soldierOne action ["firePutDown", firePlaceOne]

## FlapsUp

 **Example**: | harrierOne action ["flapsUp", harrierOne]

## FlapsDown

 **Example**: | harrierOne action ["flapsDown", harrierOne]

## Gear

**unitName action ["GEAR",<target unit>]**

**unitName action ["GEAR",<target unit>]**

UnitName opens the gear of <target unit> (but only if he is within normal range) and plays the "pick up" animation, allowing transfer of gear between the two units. This works even if <target unit> does not normally have a gear action (for instance between two soldiers). Using "" or ObjNull for <target unit> will drop the gear on the ground, but it will take a little while before the game recognizes the weapon holder.

Example:
`SoldierOne action ["GEAR", SoldierTwo]`

## GetInCommander

 **Example**: | soldierOne action ["getInCommmander", tankOne]

## GetInDriver

 **Example**: | soldierOne action ["getInDriver", carOne]

## GetInGunner

 **Example**: | soldierOne action ["getInGunner", mySpotlight]

## GetInPilot

 **Example**: | pilotOne action ["getInPilot", chopperOne]

## GetOut

 **Example**: | soldierOne action ["getOut", carOne]

## HandGunOn

 **Example**: | soldierOne action ["handGunOn", soldierOne]

## HandGunOff

 **Example**: | soldierOne action ["handGunOff", soldierOne]

## Heal

 **Example**: | soldierOne action ["heal", medicOne]

## HideBody

 **Example**: | soldierOne action ["hideBody", soldierTwo]

## LadderDown

 **Example**: | soldierOne action ["ladderDown", (position soldierOne nearestObject 452221), 0, 1]

## LadderUp

 **Example**: | soldierOne action ["ladderUp", (position soldierOne nearestObject 452221), 0, 0]

## LadderOff

 **Example**: | soldierOne action ["ladderOff", (position soldierOne nearestObject 452221)]

## Land

 **Example**: | planeOne action ["Land", planeOne]

## LandGear

 **Example**: | planeOne action ["LandGear", planeOne]

## LandGearUp

 **Example**: | planeOne action ["LandGearUp", planeOne]

## LightOff

 **Example**: | player action ["lightOff", vehicle player]

## LightOn

 **Example**: | player action ["lightOn", spotLight]

## LoadMagazine

 **Example**: | player action ["loadmagazine",player, player, 0, 1 ,"vbs2\_us\_m16a2\_iron\_gla", "vbs2\_us\_m16a2\_iron\_gla"]

## ManualFire

 **Example**: | player action ["MANUALFIRE", vehicle player]

## ManualFireCancel

 **Example**: | player action ["manualFireCancel", vehicle player]

## MoveToCargo

 **Example**: | player action ["moveToCargo", vehicle player, 2]

## MoveToCommander

 **Example**: | player action ["moveToCommander", vehicle player]

## MoveToDriver

 **Example**: | player action ["moveToDriver", vehicle player]

## MoveToGunner

 **Example**: | player action ["moveToGunner", vehicle player]

## NVGoggles

 **Example**: | player action ["nvGoggles", player]

## NVGogglesOff

 **Example**: | player action ["nvGogglesOff", player]

## Refuel

 **Example**: | tankOne action ["refuel", refuelTruckOne]

## Repair

 **Example**: | tankOne action ["refuel", repairTruckOne]

## ReturnFlag

 **Example**: | soldierOne action ["returnFlag", westFlag]

## Salute

 **Example**: | soldierOne action ["salute", soldierOne]

## SETTIMER

**unitOne action ["SETTIMER", unitTwo, <bombName>]**

Soldier 'unitOne' plays the action animation. UnitTwo activates and adds thirty seconds to the timer for a satchel charge. Neither unit needs to be near the satchel.
Charge has to be places first using *unitname Fire ["pipebombmuzzle", "pipebombmuzzle", "pipebomb"]* command.

## SitDown

 **Example**: | soldierOne action ["sitDown", soldierOne]

## SWITCHMAGAZINE

**<unit> action ["SWITCHMAGAZINE", <target vehicle>, <target unit>, <mode index>]**

Target unit switches to the given firing mode index. This allows selection of any firing mode for any weapon carried by a soldier, or mounted on a weapon. First are the firing modes for the primary weapon (index 0 upwards), then secondary weapon, then optics, then pistol, then thrown and placed weapons. Changing to NVGoggles just plays an animation, not actually setting NV mode. Unfortunately, the list of firing modes seems to only be created when a soldier is initiated; modes are removed from the list when a weapon is dropped and not re-added when a weapon is picked up. Thus, only use this during the initiation phase of the soldier. On vehicles, where the weapons are not likely to be changed, this action might be useful after the vehicle has been initiated.

If the mode index is higher than available indices, it assumes index 0.

If you just want to change the muzzle used, rather than the firing mode, the standard command selectWeapon is generally more useful.

Example:
`gameLogic action ["SWITCHMAGAZINE", unit1, unit1, 3];
gameLogic action ["SWITCHMAGAZINE", m1a1, gunner m1a1, 1];`

## SWITCHWEAPON

**unitOne action ["SWITCHWEAPON", <target unit>, <target unit>, <muzzle index>]**

UnitOne plays the action animation. Target unit switches to the given muzzle/mode index. Target unit can also be a vehicle. The weapons array is a list of all weapon modes specific to each weapon, muzzle and firing mode combination.

Example:
`unit2 action ["SWITCHWEAPON",unit1,unit1,7]
player action ["SWITCHWEAPON", vehicle player, vehicle player, 3]`

## TAKEFLAG

**unitname action ["TAKEFLAG", flag1]**

Soldier 'unitname' takes control of 'flag1'. He must be close to the flagpole and it must belong to an enemy side.

Example:
`SoldierOne action ["TAKEFLAG", FlagOne]`

## TAKEMAGAZINE / TAKEWEAPON

**unitname action ["TAKEMAGAZINE", (vehiclename or unitname), "MAGAZINENAME"]**

**unitname action ["TAKEWEAPON", (vehiclename or unitname), "WEAPONNAME"]**

Soldier 'unitname' takes one magazine/weapon of specified type (see list) from the ground (Weaponholder) or from named vehicle (ammo box, car, etc.).

Transfer happens immediately and via teleportation. Unit1 plays pickup animation at its current position, no matter where 'weapon or magazine' is.

Example:
`SoldierOne action ["TAKEMAGAZINE", SoldierTwo, "RPGLAUNCHER"]`

## TAKEMINE

**unitName action ["TAKEMINE", <target unit>]**

UnitName will perform the action animation. The closest mine that is within two meters of the target unit will be placed into the target unit's inventory.

Example:
`unit1 action ["takeMine",unit2]`

## TEAMSWITCH

**<current unit> action ["TEAMSWITCH ", <unit>]**

Opens the normal team-switch dialog. <current unit> will be greyed out in the list and thus unselectable. The effect of the second array element is unknown, but it must be a unit.
Works in single-player game only (in MP games, will just momentarily show the mouse cursor without the team-switch window being shown).

Example:
`player action ["TEAMSWITCH", player]`

## TOUCHOFF

**unitOne action ["TOUCHOFF", unitTwo]**

Soldier 'unitOne' plays the action animation. UnitTwo's satchels are "touched off". UnitTwo must be within range (300m) of his satchels to touch them off.

Example:
`unitname action ["TOUCHOFF", unitname]`

## TURNIN / TURNOUT

**unitName action ["TURNIN", vehicleName]**

**unitName action ["TURNOUT", vehicleName]**

Crew of 'vehiclename' turns in/out (gets in and out of hatches). UnitName must be a player in effective commander of vehicleName. AI will automatically turn in/out based on their current behaviour mode.

Examples:
`TankOne action ["TURNIN", TankOne]
player action ["TURNOUT,vehicle player]`

## USEMAGAZINE

**["USEMAGAZINE", <target>, <magazine creator>, <number>, <number>]**

This makes the target bend down, like he's using an ammo crate. I don't notice anything else happening. I don't know what the number values at the end do.

Example:
`player action["USEMAGAZINE", player, player, 0, 0]`

## USER

**unitName ["USER", <target unit>, <action index>]**

Soldier 'unitName' does nothing. Executes the custom action with the given index of the the target unit. Indexes are based upon the order in which the actions are added to the unit. See addAction.

Example:
`gameLogic action ["USER", player, 3]`

## USERTYPE

**["USERTYPE", <target>, <action index>]**

As of ArmA version 1.08, using this action type will cause ArmA to crash to desktop (fixed in OA v1.60).

## USEWEAPON

**unitOne ["USEWEAPON", <target vehicle>, <target unit>, <weapon index>]**

Soldier 'unitOne' will play the action animation. Target unit will fire the specified unit's position in the target vehicle's (can be the unit itself) weapon mode index. The indexes seem to be based upon the order in which weapons are added to the unit/vehicle, with each weapon's muzzle's fire mode having an unique index. Weapons can be fired in this way from a not-readied position (eg, firing a rifle on a soldiers back). Pistols will fire from the current weapon's proxy. It can also be used to sound the horn on AI controlled vehicles.

Examples:
`gameLogic action ["useWeapon",unit1,unit1,16]
gameLogic action ["useWeapon",vehicle unit1,unit1,0]
gameLogic action ["useWeapon",myTank,gunner myTank,1]
gameLogic action ["useWeapon",myTank,commander myTank,0]`

## WEAPONINHAND / WEAPONONBACK

**unitName action ["WEAPONINHAND",<target unit>]**

**unitName action ["WEAPONONBACK",<target unit>]**

Soldier 'unitName' does nothing, 'target unit' moves his weapon from/to the safety position (gun held across chest pointing at the ground).
Change is persistent with player, but AI units will change back to suit their current behaviour mode. AI generally keep their rifles safe unless moving or targeting.

(*VBS2 calls this action "PUTWEAPONONBACK"*)

Example:
`SoldierOne action ["WEAPONONBACK", SoldierTwo]`

# Unsorted actions found in UI.pbo/config.bin

## PutMagazine

is synonym for DropMagazine (same syntax)?

## HideWeapon

unit action ["hideWeapon",<object>,<object>,<Number>]