Home Editors Depot Missions Depot FAQ COMREF OFPEC Tags Forum

All Commands

# | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W

Types Arrays Scripting Topics CfgVehiclesOFP/ArmA WeaponsOFP/ArmA
a
abs x
Operand types:
x: Number
Type of returned value:
Description:
Absolute value of x.
Used In:
OFP/ArmA
Example:
_a = abs -3 ..........Result is 3

accTime
Operand types:
None
Type of returned value:
Description:
Current time acceleration factor.
Used In:
OFP/ArmA
Example:
_eTime = acctime
23 Nov 2007
macguba
Use setAccTime to change the time acceleration factor.
Not to be confused with skipTime.

acos x
Operand types:
x: Number
Type of returned value:
Description:
Arccosine of x, result in degrees.
Used In:
OFP/ArmA
Example:
_angle = acos 0.5 ..........Result is 60

unit action action
Operand types:
unit: Object
action: Array
Type of returned value:
Description:
Make unit preform an action.
Format of action may be [type, target, param1, param2, param3].
Only type is required, target defaults to unit, param1, param2, param3 are type specific.
Used In:
OFP/ArmA
Example:
soldierOne action ["eject", vehicle soldierOne]

actionKeys action
Operand types:
action: String
Type of returned value:
Description:
Returns a list of dikCodes of buttons assigned to the given user action.
Used In:
ArmA
Example:
array = actionKeys "ReloadMagazine"

actionKeysImages [action, maxKeys]
Operand types:
[action, maxKeys]: Array
Type of returned value:
Description:
Returns a list of button images or names assigned to the given user action.
A maximum of maxKeys keys is listed.
You can find the action names in config class ControllerSchemes.
Used In:
ArmA
Example:
text = actionKeysImages "ReloadMagazine"

actionKeysNames [action, maxKeys]
Operand types:
[action, maxKeys]: Array
Type of returned value:
Description:
Returns a list of button names assigned to the given user action.
A maximum of maxKeys keys is listed.
You can find the action names in config class ControllerSchemes.
Used In:
ArmA
Example:
list = actionKeysNames "ReloadMagazine"

activateAddons [addon1, ...]
Operand types:
[addon1, ...]: Array
Type of returned value:
Description:
Activates the listed addons.
The list of active addons is initialized during this function.
Used In:
ArmA
Example:
activateAddons ["BISOFP"]

activateKey keyName
Operand types:
keyName: String
Type of returned value:
Description:
Activates the given key for the current user profile.
The keys are used to unlock missions or campaigns.
See keys, keysLimit and doneKeys in the description.ext file of the missions.
Used In:
ArmA
Example:
activateKey "M04"

unit addAction [action, script filename, (arguments, priority, showWindow, hideOnUse, shortcut)]
Operand types:
unit: Object
[action, script filename, (arguments, priority, showWindow, hideOnUse, shortcut)]: Array
Type of returned value:
Description:
Creates an action.
Action ID should be returned, but due to bug it is not.
To determine action ID use following algorithm:
First action added to given vehicle has ID zero, next has ID 1, etc.
Used In:
OFP/ArmA
Example:
player addAction ["Hello", "hello.sqs"]
26 Oct 2007
toadlife
An easy way to keep track of and remove actions is to set the ID of the action yourself.
This can be accomplished by doing the following:

myaction = player addAction ["Hello", "hello.sqs"]

This sets the actions ID to "myaction".
This can make keeping track actions much easier.

To remove the above action, you would use the following line:

player removeAction myaction
26 Oct 2007
Tactician
It seems that since 1.85+(?) addAction has correctly returned action ID although the comref doesn't reflect this.

Params passed by an action to the executed script:
[(object action was attached to), (unit that activated action), (index of action)]

So an example of an action-based script goes like this:

_obj = _this select 0
_man = _this select 1
_index = _this select 2

If you want to remove the action from the object immediately after it's triggered, use this line along with the above:

_obj removeAction _index

edited
10 Jan 2008
Mandoble
If arguments are passed to the action, these are accessible as _this select 3 in the action script. If you need to pass several values as arguments for an action script, pass them as an array.

object addEventHandler handler
Operand types:
object: Object
handler: Array
Type of returned value:
Description:
Format of handler is [type,command].
Check scripting topic Event handlers for more information.
Index of currently added handler is returned.
Used In:
OFP/ArmA
Example:
player addEventHandler ["killed",{_this exec "playerKilled.sqs"}]

unitName addLiveStats score
Operand types:
unitName: Object
score: Number
Type of returned value:
Description:
Xbox Live MP only: Adds score to the Xbox Live Statistics score for the given unit (or the commander unit of the given vehicle).
Used In:
OFP/ArmA
Example:
player addLiveStats 12

unit addMagazine weaponName
Operand types:
unit: Object
weaponName: String
Type of returned value:
Description:
Add magazine to unit.
Note: You can create invalid combinations with this function like 20 grenades.
When doing so, application behaviour is undefined.
Used In:
OFP/ArmA
Example:
player addMagazine "M16"
23 Nov 2007
macguba
If the unit has magazines already, you may need to use the commands removeMagazine or removeMagazines to make space for the mags you want to add.

unit addMagazineCargo magazines
Operand types:
unit: Object
magazines: Array
Type of returned value:
Description:
Add magazines to weapon cargo space.
Used for infantry weapons.
Format of magazines is [magazineName, count].
For magazineName values see OFPWeapons or ArmAWeapons.
Used In:
OFP/ArmA
Example:
rearmTruckOne addMagazineCargo ["M16",10]

addMagazinePool [name, count]
Operand types:
[name, count]: Array
Type of returned value:
Description:
Adds count magazines of type name into magazine pool.
Used in campaign to transfer magazines into next mission.
Used In:
OFP/ArmA
Example:
addMagazinePool ["M16",10]

variableName addPublicVariableEventHandler code
Operand types:
variableName: String
code: Code
Type of returned value:
Description:
If the EH detects a change via publicVariable on the given variableName, code will be executed.
The following arguments are transferred to the code:

* _this select 0: variableName
* _this select 1: New variable value
Used In:
ArmA
Example:
"mypublicVar" addPublicVariableEventHandler {hint ((_this select 0) + " has been modified to: " + str (_this select 1))}
05 Sep 2008
Mr.Peanut
Biki States:
Multiplayer: Note that the EH is only fired on clients where the publicVariable command has not been executed, as publicVariable does not change the variable where it has been executed.

unitName addRating number
Operand types:
unitName: Object
number: Number
Type of returned value:
Description:
Add number to unit rating.
This is usually used to reward for completed mission objectives.
Rating for killed enemies and killed friendlies is adjusted automatically.
When rating is lower than zero, unit is consider "renegade" and is enemy to everyone.
Used In:
OFP/ArmA
Example:
player addRating 1000

unitName addScore score
Operand types:
unitName: Object
score: Number
Type of returned value:
Description:
MP only: Add unit score.
This is shown in the "I" MP screen as total.
Used In:
OFP/ArmA
Example:
player addScore 10

addSwitchableUnit unitName
Operand types:
unitName: Object
Type of returned value:
Description:
Add a unit into the list of units available for team switch.
Used In:
ArmA
Example:

groupName addVehicle vehicleName
Operand types:
groupName: Group
vehicleName: Object
Type of returned value:
Description:
Adds the specified vehicle to the specified group.
Used In:
ArmA
Example:

groupName addWaypoint [center, radius]
Operand types:
groupName: Group
[center, radius]: Array
Type of returned value:
Description:
Adds a new waypoint to a group.
The waypoint is placed randomly in a circle with the given center and radius.
The function returns a waypoint with format [group, index].
Used In:
ArmA
Example:
grp addWaypoint [position player, 0]

unitName addWeapon weaponName
Operand types:
unitName: Object
weaponName: String
Type of returned value:
Description:
Add weapon to unit.
Note: You can create invalid combinations with this function, for example by adding two rifles.
When doing so, application behaviour is undefined.
Used In:
OFP/ArmA
Example:
player addWeapon "AK74"
23 Nov 2007
macguba
To ensure that the weapon is loaded at the start of the mission, add at least one magazine (addMagazine) before adding the weapon.
23 Nov 2007
The real Armstrong
To remove weapons use the removeAllWeapons or the removeWeapon commands.

unitName addWeaponCargo weaponName
Operand types:
unitName: Object
weaponName: Array
Type of returned value:
Description:
Add weapons to weapon cargo space.
Used for infantry weapons.
Format of weapons is [weaponName, count].
For weaponName values see OFPWeapons or ArmAWeapons.
Used In:
OFP/ArmA
Example:
rearmTruckOne addWeaponCargo ["M16",10]

addWeaponPool [name, count]
Operand types:
[name, count]: Array
Type of returned value:
Description:
Adds count weapons of type name into weapon pool.
Used in campaign to transfer weapons into next mission.
Used In:
OFP/ArmA
Example:
addWeaponPool ["M16",10]

airportSide id
Operand types:
id: Number
Type of returned value:
Description:
Returns which side an airfield is assigned to.
Following id numbers apply:

0 - Paraiso
1 - Rahmadi
2 - Pita
3 - Antigua
Used In:
ArmA
Example:
airportSide 3

alive objectName
Operand types:
objectName: Object
Type of returned value:
Description:
Check if given person, vehicle or building is not dead / destroyed.
Used In:
OFP/ArmA
Example:
? (alive player) : _b = 1

objectName allowDammage allow
Operand types:
objectName: Object
allow: Boolean
Type of returned value:
Description:
Obsolete command.
Used In:
OFP/ArmA
Example:

unitName allowFleeing courage
Operand types:
unitName: Object
courage: Number
Type of returned value:
Description:
Set group courage.
The less courage, the sooner will group start fleeing.
0 means maximum courage, 1 means always fleeing.
Used In:
OFP/ArmA
Example:
soldierOne allowFleeing 0

unitArray allowGetIn allow
Operand types:
unitArray: Array
allow: Boolean
Type of returned value:
Description:
Allow getting in vehicles to all units in the list.
Used In:
OFP/ArmA
Example:
[unitOne, unitTwo] allowGetIn false

unitName ammo magazine
Operand types:
unitName: Object
magazine: String
Type of returned value:
Description:
Count how many shots are left for given magazine type.
Used In:
OFP/ArmA
Example:
player ammo "M16"

a and b
Operand types:
Type of returned value:
Description:
a and b
Used In:
OFP/ArmA
Example:
(alive player) and (alive leader player)

objectName animate [animation, phase]
Operand types:
objectName: Object
[animation, phase]: Array
Type of returned value:
Description:
Process animation on object.
Animation is defined in config file.
Wanted animation phase is set to phase.
Used In:
OFP/ArmA
Example:
house animate ["doors1", 1]

objectName animationPhase animation
Operand types:
objectName: Object
animation: String
Type of returned value:
Description:
Return animation phase of animation on object.
Used In:
OFP/ArmA
Example:
house animationPhase "doors1"

animationState unitName
Operand types:
unitName: Object
Type of returned value:
Description:
Return the name of the current primary animation.
Used In:
ArmA
Example:
10 Jan 2008
Mandoble
The returned string is the name of the current move being "played" (see switchMove, playMove).

asin x
Operand types:
x: Number
Type of returned value:
None
Description:
Arcsine of x, result in degrees.
Used In:
OFP/ArmA
Example:
_angle = asin 0.5 ..........Result is 30

assert condition
Operand types:
condition: Boolean
Type of returned value:
Description:
Tests a condition and if the condition is false, halts the program.
Used In:
ArmA
Example:
assert (_x>0)

unitName assignAsCargo vehicleName
Operand types:
unitName: Object
vehicleName: Object
Type of returned value:
Description:
Assign soldier into cargo / passenger space of given vehicle.
Used In:
OFP/ArmA
Example:
player assignAsCargo truckOne
23 Nov 2007
macguba
To make the unit get into the vehicle you will need to use the command orderGetIn after you have issued any assignAs command.

unitName assignAsCommander vehicleName
Operand types:
unitName: Object
vehicleName: Object
Type of returned value:
Description:
Assign soldier as commander of given vehicle.
Used In:
OFP/ArmA
Example:
player assignAsCommander tankOne

unitName assignAsDriver vehicleName
Operand types:
unitName: Object
vehicleName: Object
Type of returned value:
Description:
Assign soldier as driver of given vehicle.
Used In:
OFP/ArmA
Example:
player assignAsDriver tankOne

unitName assignAsGunner vehicleName
Operand types:
unitName: Object
vehicleName: Object
Type of returned value:
Description:
Assign soldier as gunner of given vehicle.
Used In:
OFP/ArmA
Example:
player assignAsGunner tankOne

assignedTarget vehicleName
Operand types:
vehicleName: Object
Type of returned value:
Description:
Return the target assigned to the vehicle.
Used In:
ArmA
Example:

assignedVehicle vehicleName
Operand types:
vehicleName: Object
Type of returned value:
Description:
Returns the vehicle that a unit is assigned to.
Used In:
ArmA
Example:
assignedVehicle fred

assignedVehicleRole unitName
Operand types:
unitName: Object
Type of returned value:
Description:
Returns the role that a unit is assigned to within its assigned vehicle. The array which is returned can contain:

[] - Not assigned to any vehicle
["Driver"] - Assigned as driver
["Cargo"] - Assigned as cargo
["Turret", [turret path]] - Assigned to a turret
Used In:
ArmA
Example:
assignedVehicleRole fred

vehicleName assignTeam team
Operand types:
vehicleName: Object
team: String
Type of returned value:
Description:
Assigns the vehicle (specifically its commander unit) to the given team.
The possible team values are:

"MAIN"
"RED"
"GREEN"
"BLUE"
"YELLOW"
Used In:
ArmA
Example:
soldier2 assignTeam "RED"

assignToAirport
Operand types:
None
Type of returned value:
None
Description:
assignToAirport used to do the same as landAt.
Now it assigns for purpose of future getout commands.
Do not use till it is fully implemented at some future date.
Used In:
ArmA
Example:

atan x
Operand types:
x: Number
Type of returned value:
Description:
Arctangens of x, result in degrees.
Used In:
OFP/ArmA
Example:
_angle = atan 1 ..........Result is 45

x atan2 y
Operand types:
x: Number
y: Number
Type of returned value:
Description:
Returns the arctangens of x/y.
Returned value is in degrees, in the range -180 to +180, using the signs of both parameters to determine the quadrant of the return value.
Used In:
OFP/ArmA
Example:
_angle = 5 atan2 3 ..........Result is 59.0362

atg x
Operand types:
x: Number
Type of returned value:
Description:
Arctangens of x, result in degrees.
Used In:
OFP/ArmA
Example:
_angle = atg 1 ..........Result is 45

attackEnabled groupName
Operand types:
groupName: Group
Type of returned value:
Description:
Return whether leader can issue attack
Used In:
ArmA
Example: