Ceeeb/Sandbox – User
actions again....
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 kilometres away. Note that most actions can be executed by a different unit than the target unit, although in many 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, with the action effects happening to the target after this animation completes. A game logic unit can be used to perform such actions without any animation or delay.
General Syntax
person action ["actionType", parameter(s)]
person : Object. "actionType" : String. Not case sensitive. parameter(s) : Various data types, dependant on the action used. Some actions require multiple parameters.
Actions
AUTOHOVER
Toggles auto-hovering on and off. Note that while the auto-hover status can be toggled on an AI crewed or even an empty vehicle, it will only affect a vehicle controlled by a human pilot.
Syntax: unit action ["autoHover", targetVehicle]
Where unit is any unit (no action animation is performed) and targetVehicle is any vehicle that is capable of hovering.
Example:
unitOne action ["autoHover", ChopperOne]
CANCELACTION
Cancels an action in progress. The target unit will complete it's current animation, although the action itself will not be performed.
Syntax: unit action ["cancelAction", targetUnit]
Where unit is be any unit (no action animation is performed) and targetUnit is any unit that is in the process of performing an action.
Example:
unitOne action ["CANCELACTION", unitTwo]
CANCELLAND
Cancels autopilot landing for an aircraft, including AI controlled aircraft.
Syntax: unit action ["cancelAction", targetVehicle]
Where unit is any unit (no action animation is performed) and targetVehicle is any vehicle that is currently performing an autopilot landing.
Example:
driver planeOne action ["cancelLand", planeOne]
CANCELTAKEFLAG
Cancels taking of a flag. The unit will complete the taking/action animation, but the flag will remain attached to it's current object. This action needs to be executed while the flag is being taken (which happens after the unit completes the taking/action animation) to prevent a unit taking the flag.
Syntax: unit action ["cancelTakeFlag", targetFlag]
Where unit is any unit (no action animation is performed) and targetFlag' is a flag.
Example:
westSoldierOne action ["cancelTakeFlag", eastFlag]
DEACTIVATE
unitOne action ["DEACTIVATE", unitTwo,<object>]
Soldier 'unitOne' will bend down as if to deactivate a satchel charge that has been placed by unitTwo.
This can happen from any distance (i.e. unitOne will not walk up to the charge to deactivate it, but do it 'remotely').
If unitTwo is nearby the charge when it is being deactivated it return to its inventory.
Example:
soldierOne action ["DEACTIVATE", SoldierOne, mySatchelCharge]
DEACTIVATEMINE
unitOne action ["DEACTIVATEMINE", unitTwo]
UnitOne will bend down. The mine closest to unitTwo will be deactivated, so long as it is within around 2 meters.
DIARY
["DIARY", <target>]
DROPWEAPON / DROPMAGAZINE
unitname action ["DROPMAGAZINE", (vehiclename or unitname) ,"MAGAZINENAME"]
unitname action ["DROPWEAPON", (vehiclename or unitname) ,"WEAPONNAME"] ...drops weapon and ammo
Soldier 'unitname' will put a magazine or weapon (see list) on the ground (Weaponholder) or into named vehicle (ammo box, car, etc.).
Example:
SoldierOne action ["DROPMAGAZINE", CarOne, "AK74"]
EJECT
unitName action ["EJECT", vehicleName]
Soldier 'unitName' will jump out of 'vehicleName'. (Via parachute in case of planes & helicopters.)
MP Note: Has global effect when used on a local unit.
Example:
SoldierOne action ["EJECT", ChopperOne]
ENGINEON / ENGINEOFF
unitName action ["ENGINEON", vehicleName]
unitName action ["ENGINEOFF", vehicleName]
Soldier 'unitName' will turn engine of 'vehicleName' either on or off.
Example:
SoldierOne action ["ENGINEON", ChopperOne]
FIREINFLAME / FIREPUTDOWN
unitname action ["FIREINFLAME", firename]
unitname action ["FIREPUTDOWN", firename]
Soldier 'unitname' will ignite ("FIREINFLAME") or extinguish ("FIREPUTDOWN") fireplace 'firename'.
Example:
SoldierOne action ["FIREINFLAME", Fire1]
FLAPSUP / FLAPSDOWN
unit action ["FLAPSUP", <target>]
unit action ["FLAPSDOWN", <target>]
AI pilots will instantly change flaps to what they think is suitable.
GETINCOMMANDER / GETINDRIVER / GETINGUNNER / GETINCARGO / GETINPILOT / GETINTURRET
unitname action ["GETINCOMMANDER", vehiclename]
unitname action ["GETINDRIVER", vehiclename]
unitname action ["GETINGUNNER", vehiclename]
unitname action ["GETINCARGO", vehiclename]
unitname action ["GETINPILOT", vehiclename]
unitname action ["GETINTURRET", vehiclename, [turret path]]
Soldier 'unitname' will be teleported next to 'vehiclename', play the entering animation, and then be assigned as either commander, driver or gunner.
Notes
'Turret path' is an array that defines the particular turret you want the unit to occupy.
TurretPath [0,0] moves the soldier into the first turret of the first turret of a vehicle. Similarly [1,0] would move the unit to the first turret of the second turret of the vehicle.
TurretPath [0, 2, 1] would move him to the second turret of the third turret of the first turret, [1] moves him to the second turret of a vehicle.
Turret order has to be defined in the class CfgVehicles of the Config.
Examples:
SoldierOne action ["GETINCOMMANDER", CarOne]
SoldierOne action ["GETINTURRET", UH-60One, [0]];SoldierTwo action ["GETINTURRET", UH-60One, [1]]
UH-60One is the name given to a 'UH60MG' class vehicle. SoldierOne mounts the port-side weapon, and SoldierTwo mounts the starboard-side weapon.
GETOUT
unitname action ["GETOUT", vehiclename]
Soldier 'unitname' will jump out of 'vehiclename'. (No parachute in case of planes & helicopters.)
Example:
SoldierOne action ["GETOUT", ChopperOne]
HANDGUNON / HANDGUNOFF
unitname action ["HANDGUNOFF", unitname]
unitname action ["HANDGUNON", unitname]
Soldier 'unitname' will switch to primary ("handgun off") or secondary ("handgun on") weapon.
Example:
SoldierOne action ["HANDGUNON", SoldierOne]
HEAL
unitname action ["HEAL", unitname2]
Medic 'unitname2' will teleport to 'unitname' and heal him.
Example:
SoldierOne action ["HEAL", MedicOne]
HIDEBODY
unitname action ["HIDEBODY", bodyname2]
Soldier 'unitname' will hide (bury) 'unitname2'.
Example:
SoldierOne action ["HIDEBODY", SoldierTwo]
INGAMEMENU
["INGAMEMENU", <target>]
LADDERDOWN / LADDERUP
unitname action ["LADDERDOWN", building1] unitname action ["LADDERDOWN", object ID] unitname action ["LADDERUP", building1] unitname action ["LADDERUP", object ID]
unitName action ["LADDERDOWN", <target object>, <ladder index>, <position>]
unitName action ["LADDERUP", <target object>, <ladder index>, <position>]
Soldier 'unitName' will play the climbing onto ladder animation, then appear at the specified ladder location. If he is controlled by the AI, he will then either climb up or down the ladder and get off.
Example:
unit1 action ["ladderOnUp", (position player nearestObject 452221), 0, 0]
LADDEROFF
unitName action ["LADDEROFF", <target object>]
Soldier 'unitName' will get off any ladder on <target object> he happens to be on.
Example:
unit1 action ["LADDEROFF", (position player nearestObject 452221)]
LADDERONUP / LADDERONDOWN
unitName action ["LADDERONUP", <target object>, <ladder index>, <ladder position>] unitName action ["LADDERONDOWN", <target object>, <ladder index>, <ladder position>]
UnitName will play the appropriate getting on ladder animation and appear upon the ladder at the position given. If he is AI controlled, he will climb to the other end of the ladder and get off.
LAND
unit action ["LAND", <target>] Turns on the landing autopilot.
LANDGEAR
unitName action ["LANDGEAR", planeName]
Toggle landing gear on 'planename'.
Only works if player is pilot.
Example:
PlaneOne action ["LANDGEAR", PlaneOne]
LIGHTOFF / LIGHTON
vehiclename action ["LIGHTON", vehiclename]
vehiclename action ["LIGHTOFF", vehiclename]
Turns lights of 'vehiclename' either on or off.
The lights will only stay on if the driver is in SAFE or CARELESS mode.
The lights will not stay off if the driver is in SAFE or CARELESS mode.
Example:
driver CarOne setBehaviour "safe";
CarOne action ["LIGHTON", CarOne];
LOADMAGAZINE
["LOADMAGAZINE", <target>, <magazine creator>, <magazine id>, <weapon name>, <muzzle name>]
MANUALFIRE
unitName action ["MANUALFIRE",<vehicle>]
Toggles manual fire mode if player is driver or commander of vehicle.
Example:
player action ["MANUALFIRE", vehicle player]
MARKENTITY
["MarkEntity", <target>]
MOVETOCARGO / MOVETOCOMMANDER / MOVETODRIVER / MOVETOGUNNER / MOVETOPILOT
unitname action ["MOVETOCARGO", vehiclename]
unitname action ["MOVETOCOMMANDER", vehiclename]
unitname action ["MOVETODRIVER", vehiclename]
unitname action ["MOVETOGUNNER", vehiclename]
unitname action ["MOVETOPILOT", vehiclename]
Moves 'unitname' into cargo, commander, driver or gunner position.
If that position was occupied before, the units will swap places.
Example:
SoldierOne action ["MOVETODRIVER", CarOne]
NONE
["NONE", <target>]
NVGOGGLES / NVGOGGLESOFF
unitName action ["NVGOGGLES", unitName2]
unitName action ["NVGOGGLESOFF", unitName2]
unitName puts his night vision goggles on/off. UnitName2 is apparently not used, but action requires a two element array.
Example:
player action ["NVGOGGLES",ANYTHING]
REARM / REFUEL / REPAIR
vehiclename action ["REARM", vehiclename2] vehiclename action ["REFUEL", vehiclename2] vehiclename action ["REPAIR", vehiclename2]
Vehiclename will receive weapons/fuel/repair from 'vehicle2' immediately and via teleportation.
Example:
SoldierOne action ["REARM", TruckOne]
RETURNFLAG
unitname action ["RETURNFLAG", flagname]
Soldier 'unitname' returns 'flagname' to base.
Example:
SoldierOne action ["RETURNFLAG", FlagOne]
SALUTE
unitOne action ["SALUTE", unitTwo]
UnitOne does nothing. UnitTwo salutes. If unitTwo is in safe or careless mode, salute will be held, otherwise it is only momentary.
Example:
SoldierOne action ["SALUTE", SoldierOne]
SCUD LAUNCH / SCUD START / SCUD CANCEL
scudname action ["SCUD LAUNCH"]
scudname action ["SCUD START"]
scudname action ["SCUD CANCEL"]
Scudname launches or fires its missile.
The launch process takes about 10.5 seconds. There is no Scud in ArmA.
Example:
ScudOne action ["SCUD START"]
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
unitOne action ["SITDOWN", unitTwo]
Soldier 'unitTwo' sits down.
Sitting position will only be held if unitTwo is in SAFE and CARELESS mode.
Example:
SoldierOne action ["SITDOWN", SoldierOne]
STROKEFIST
unitname action ["STROKEFIST"]
Soldier 'unitname' performs a boxing animation. Apparently not working in ArmA.
Example:
SoldierOne action ["STROKEFIST"]
STROKEGUN
unitname action ["STROKEGUN"]
Soldier 'unitname' performs a hitting animation with his weapon. Apparently not working in ArmA.
Example:
SoldierOne action ["STROKEGUN"]
SWITCHWEAPON
unitOne action ["SWITCHWEAPON", <target unit>, <target unit>, <muzzle index>]
UnitOne plays the action animation. Target unit switches to the given muzzle index. Second element might be target vehicle, as seen with "USEWEAPON".
Example:
unit2 action ["SWITCHWEAPON",unit1,unit1,7]
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]
TALK
["TALK", <target>]
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>, <magazine id>]
Expects a 5 element array?
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.
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.
Example:
SoldierOne action ["WEAPONONBACK", SoldierTwo]