Arma 3 SQF Command Quick Reference

Searchable reference for the most-used Arma 3 SQF scripting commands. The Bohemia wiki frequently 403s and isn't mobile-friendly — this one works offline and stays fast.

Click any syntax row to copy it to your clipboard. Operator types: nular (no arguments), unary (prefix), binary (left op right).

138 of 138 commands

Unit / Player

player addMagazine "30Rnd_65x39_caseless_mag"
binary Nothing

Add a magazine to the player's inventory.

player addMagazine "30Rnd_65x39_caseless_mag"

player addItem "FirstAidKit"
binary Nothing

Add an item to the player's inventory.

player addItem "FirstAidKit"

player addWeapon "arifle_MX_F"
binary Nothing

Add a weapon to the player's inventory.

player addWeapon "arifle_MX_F"

player assignItem "ItemMap"
binary Nothing

Assign an item to a dedicated slot (map, compass, watch).

player assignItem "ItemMap"

player removeItem "ItemMap"
binary Nothing

Remove item from unit's inventory.

player removeItem "ItemMap"

player removeAllItems
binary Nothing

Remove all items and weapons from unit.

player removeAllItems

getPos unit
unary Array

Get unit's world position as [x, y, z].

_pos = getPos player

unit setPos [x, y, z]
binary Nothing

Teleport a unit to world coordinates.

player setPos [3500, 4200, 0]

unit setPosATL [x, y, z]
binary Nothing

Set position above terrain level (ignores sea level).

player setPosATL [100, 200, 0]

unit setDir 180
binary Nothing

Set the unit's facing direction in degrees (0 = North).

player setDir 90

alive unit
unary Bool

Returns true if the unit is alive.

if (alive player) then { hint "alive" }

name unit
unary String

Returns the unit's in-game display name.

_n = name player

side unit
unary Side

Returns the side (WEST, EAST, GUER, CIV) of the unit.

_s = side player

rank unit
unary String

Returns the unit's rank as a string.

_r = rank player

group unit
unary Group

Returns the group object the unit belongs to.

_grp = group player

vehicle unit
unary Object

Returns the vehicle the unit is in (or the unit itself).

_v = vehicle player

unit setDamage 0.5
binary Nothing

Set damage level (0 = healthy, 1 = dead).

player setDamage 0

unit setUnitPos "STAND"
binary Nothing

Force a unit into a stance: STAND, CROUCH, or DOWN.

player setUnitPos "CROUCH"

unit allowDamage false
binary Nothing

Toggle whether a unit can receive damage.

player allowDamage false

unit enableSimulation false
binary Nothing

Disable/enable physics and AI simulation for an object.

isPlayer unit
unary Bool

Returns true if the unit is controlled by a human player.

if (isPlayer _unit) then {}

primaryWeapon unit
unary String

Class name of the unit's primary weapon, or empty string.

_wpn = primaryWeapon player

handgunWeapon unit
unary String

Class name of the unit's handgun weapon.

uniformItems unit
unary Array

Array of item class names stored in the unit's uniform.

unit setSkill 0.8
binary Nothing

Set overall AI skill level (0-1).

_ai setSkill 0.5

unit doFollow leader
binary Nothing

Command unit to follow a target object.

unit doMove [x, y, z]
binary Nothing

Command unit to move to a position.

_unit doMove getPos player

unit doStop unit
binary Nothing

Command unit to stop current action.

moveToCompleted unit
unary Bool

Returns true if unit has completed its move order.

waitUntil { moveToCompleted _unit }

Group

units grp
unary Array

Returns array of all units in the group.

_units = units (group player)

leader grp
unary Object

Returns the current leader of the group.

_ldr = leader (group player)

join [unit, grp]
binary Nothing

Move a unit into a different group.

[player, _grp] join player

createGroup WEST
unary Group

Create a new empty group for the given side.

_grp = createGroup WEST

grp setLeader unit
binary Nothing

Assign a specific unit as group leader.

(group player) setLeader _unit

groupID grp
unary String

Returns the group's identifier string.

_id = groupID (group player)

deleteGroup grp
binary Nothing

Delete an empty group.

deleteGroup _grp

grp setCombatMode "RED"
binary Nothing

Set combat mode: BLUE (safe), GREEN, WHITE, YELLOW, RED.

(group player) setCombatMode "RED"

grp setBehaviour "COMBAT"
binary Nothing

Set group behaviour: CARELESS, SAFE, AWARE, COMBAT, STEALTH.

(group player) setBehaviour "AWARE"

Vehicle

fullCrew vehicle
unary Array

Returns array of all units that are crew of the vehicle.

_crew = fullCrew _v

unit leaveVehicle vehicle
binary Nothing

Order a unit to exit their current vehicle.

player leaveVehicle vehicle player

driver vehicle
unary Object

Returns the object currently driving the vehicle.

_drv = driver _v

gunner vehicle
unary Object

Returns the primary gunner of the vehicle.

_g = gunner _v

unit moveInDriver vehicle
binary Nothing

Teleport unit into the driver seat instantly.

player moveInDriver _v

unit moveInGunner vehicle
binary Nothing

Teleport unit into the gunner seat instantly.

player moveInGunner _v

unit moveInCargo vehicle
binary Nothing

Teleport unit into a cargo (passenger) seat.

player moveInCargo _v

vehicle setVehicleLock "LOCKED"
binary Nothing

Set vehicle lock state: UNLOCKED, DEFAULT, LOCKEDPLAYER, LOCKED.

_v setVehicleLock "LOCKED"

vehicle setFuel 1
binary Nothing

Set vehicle fuel level (0-1).

_v setFuel 0.5

vehicle setDamage 0
binary Nothing

Set vehicle damage level (0 = pristine, 1 = destroyed).

_v setDamage 0

vehicle engineOn true
binary Nothing

Turn the vehicle engine on or off.

_v engineOn true

speed vehicle
unary Number

Returns current speed of the vehicle in km/h.

_spd = speed _v

Markers

createMarker ["mrkName", [x, y]]
binary String

Create a new map marker at position. Returns the marker name.

_m = createMarker ["obj1", [3500, 4200]]

setMarkerPos ["mrkName", [x, y]]
binary Nothing

Move an existing marker to new map coordinates.

setMarkerPos ["obj1", getPos player]

setMarkerText ["mrkName", "label"]
binary Nothing

Set the text label displayed on the marker.

setMarkerText ["obj1", "Rally Point"]

setMarkerColor ["mrkName", "ColorYellow"]
binary Nothing

Set marker color by color class name.

setMarkerColor ["obj1", "ColorRed"]

setMarkerType ["mrkName", "mil_dot"]
binary Nothing

Set the marker icon type.

setMarkerType ["obj1", "mil_triangle"]

setMarkerSize ["mrkName", [1, 1]]
binary Nothing

Set marker size as [width, height] in map units.

setMarkerSize ["obj1", [2, 2]]

setMarkerAlpha ["mrkName", 0.5]
binary Nothing

Set marker transparency (0 = invisible, 1 = opaque).

setMarkerAlpha ["obj1", 0.7]

deleteMarker "mrkName"
binary Nothing

Remove a marker from the map.

deleteMarker "obj1"

setMarkerBrush ["mrkName", "Solid"]
binary Nothing

Set fill brush for area markers: Solid, Border, Horizontal, etc.

setMarkerShape ["mrkName", "RECTANGLE"]
binary Nothing

Set marker shape: ICON, RECTANGLE, ELLIPSE, POLYLINE.

markerPos "mrkName"
binary Array

Returns the world position [x, y, 0] of the named marker.

_p = markerPos "obj1"

Events

unit addEventHandler ["Killed", { params ["_unit","_killer"]; hint "Killed!" }]
binary Number

Attach an event handler to a unit. Returns handler ID.

_id = player addEventHandler ["Killed", { hint "Dead!" }]

unit removeEventHandler ["Killed", _id]
binary Nothing

Remove a specific event handler by its returned ID.

player removeEventHandler ["Killed", _id]

unit removeAllEventHandlers "Killed"
binary Nothing

Remove all event handlers of a specific event type.

player removeAllEventHandlers "Killed"

addMissionEventHandler ["Ended", { hint "Mission ended" }]
binary Number

Attach an event handler to the mission itself.

removeMissionEventHandler ["Ended", _id]
binary Nothing

Remove a mission-level event handler by ID.

unit addMPEventHandler ["MPKilled", { code }]
binary Number

Multiplayer-safe event handler; executes on the machine owning the unit.

Timing

sleep 5
unary Nothing

Pause script execution for N seconds. Not usable in functions.

sleep 3

uiSleep 5
unary Nothing

UI-safe sleep — suspends script without blocking the interface.

uiSleep 1.5

waitUntil { condition }
unary Nothing

Pause until the code block returns true. Checks every frame.

waitUntil { alive _enemy }

systemTime
nular Array

Returns [year, month, day, hour, minute, second, millisecond].

_t = systemTime

time
nular Number

Seconds elapsed since the mission started.

_elapsed = time

serverTime
nular Number

Seconds elapsed since mission start on the server.

[] spawn { code }
binary Script

Run a block of code in a separate script thread. Non-blocking.

[] spawn { sleep 5; hint "Done" }

[] execVM "script.sqf"
binary Script

Execute an external SQF file as a new script thread.

[] execVM "fn_init.sqf"

Strings & Arrays

str value
unary String

Convert any value to its string representation.

_s = str 42

parseNumber "3.14"
unary Number

Parse a string into a number. Returns 0 on failure.

_n = parseNumber "5"

count array
unary Number

Returns number of elements in an array or string.

_len = count [1,2,3]

array select index
binary Any

Returns the element at the given index (0-based).

_el = ["a","b"] select 0

array pushBack item
binary Number

Append item to end of array. Returns new count.

_arr pushBack "x"

array append array2
binary Nothing

Merge array2 into array (modifies array in place).

_a append [4,5,6]

array set [index, value]
binary Nothing

Replace element at index with a new value.

_arr set [0, "new"]

array deleteAt index
binary Any

Remove and return the element at index.

_arr deleteAt 2

array find value
binary Number

Returns index of value in array, or -1 if not found.

_i = _arr find "x"

array sort true
binary Nothing

Sort array in place. true = ascending, false = descending.

_nums sort true

array resize N
binary Nothing

Resize array to N elements (pads with nil or truncates).

_arr resize 10

value in array
binary Bool

Returns true if the value is present in the array.

if (player in allPlayers) then {}

format ["%1 and %2", val1, val2]
binary String

Format a string with placeholders (%1, %2, ...).

hint format ["Player: %1", name player]

toLower "TEXT"
unary String

Convert string to lower case.

_l = toLower "ABC"

toUpper "text"
unary String

Convert string to upper case.

_u = toUpper "abc"

array apply { _x * 2 }
binary Array

Map: return new array with code applied to each element.

[1,2,3] apply { _x ^ 2 }

array select { _x > 1 }
binary Array

Filter: return elements where code returns true.

[1,2,3,4] select { _x > 2 }

Conditionals

if (condition) then { code }
binary Any

Execute code block if condition is true.

if (alive player) then { hint "alive" }

if (condition) then { code } else { code }
binary Any

If-else branch. Returns value of executed branch.

if (_x > 0) then { "pos" } else { "neg" }

if (condition) exitWith { code }
binary Any

Exit the current scope if condition is true.

if (!alive player) exitWith {}

switch (_var) do { case 1: { code }; default: { code } }
binary Any

Switch statement with optional default case.

{ condition } count array
binary Number

Count elements in array where condition is true.

{ _x > 0 } count [1,-1,2,-2]

{ code } forEach array
binary Nothing

Execute code for each element; _x is the element, _forEachIndex is its index.

{ systemChat str _x } forEach allPlayers

UI / Output

systemChat "message"
unary Nothing

Display a local chat message (only visible to you).

systemChat "Debug: reached point A"

hint "message"
unary Nothing

Show a hint box in the top-right corner.

hint format ["HP: %1", getHit player "head"]

["text", "PLAIN DOWN"] titleText
binary Nothing

Display a full-screen title/subtitle.

["Mission Start", "PLAIN DOWN"] titleText

["text", "PLAIN"] cutText
binary Nothing

Display a subtitle cut at the top of the screen.

hintSilent "message"
unary Nothing

Show hint without the sound effect.

hintSilent "Silent hint"

player sideChat "msg"
binary Nothing

Send a side chat message as a specific unit.

player sideChat "Ready"

player globalChat "msg"
binary Nothing

Broadcast message to all players on all sides.

player globalChat "GG"

Math & Logic

a + b
binary Number

Add two numbers (also concatenates arrays and strings).

_sum = 5 + 3

a - b
binary Number

Subtract b from a.

_diff = 10 - 4

a * b
binary Number

Multiply a by b.

_prod = 3 * 7

a / b
binary Number

Divide a by b.

_q = 10 / 2

a % b
binary Number

Modulo — remainder after dividing a by b.

_r = 7 % 3

a ^ b
binary Number

Raise a to the power of b.

_sq = 2 ^ 8

floor 3.9
unary Number

Round down to nearest integer.

_f = floor 3.9

ceil 3.1
unary Number

Round up to nearest integer.

_c = ceil 3.1

round 3.5
unary Number

Round to nearest integer.

_r = round 3.5

abs -5
unary Number

Returns the absolute (positive) value.

_a = abs _val

random 10
unary Number

Returns a random float from 0 up to (but not including) N.

_r = random 100

a max b
binary Number

Returns the larger of two values.

_m = _x max 0

a min b
binary Number

Returns the smaller of two values.

_m = _x min 100

a && b
binary Bool

Logical AND — true if both a and b are true.

if (alive p && side p == WEST) then {}

a || b
binary Bool

Logical OR — true if either a or b is true.

!a
unary Bool

Logical NOT — inverts a boolean.

if (!alive _unit) then {}

World & Mission

allPlayers
nular Array

Array of all player-controlled units on the server.

_n = count allPlayers

allUnits
nular Array

Array of all living non-player units in the mission.

_all = allUnits

allGroups
nular Array

Array of all groups currently in the mission.

_grps = allGroups

allDead
nular Array

Array of all dead units.

_count = count allDead

worldName
nular String

Returns the class name of the current map/world.

_map = worldName

missionName
nular String

Returns the file name of the current mission.

_mn = missionName

pos distance pos2
binary Number

Returns the 3D distance between two positions or objects.

player distance _enemy

pos distance2D pos2
binary Number

Returns the flat (2D) distance, ignoring altitude.

player distance2D _obj

nearestObjects [[x,y,z], ["Man"], 50]
binary Array

Objects of given types within radius of position.

nearestObjects [player, ["Man"], 100]

createVehicle ["className", pos]
binary Object

Spawn a vehicle or object at position.

_v = createVehicle ["B_MRAP_01_F", getPos player]

deleteVehicle obj
unary Nothing

Remove an object from the mission.

deleteVehicle _v

obj setPosASL [x,y,z]
binary Nothing

Set position above sea level (useful for aircraft spawn).

isServer
nular Bool

True if code is running on the game server (not a client).

if (isServer) then {}

hasInterface
nular Bool

True if code is running on a machine with a player interface.

if (hasInterface) then {}

obj isKindOf "Man"
binary Bool

True if object is of the given class or a subclass of it.

if (_unit isKindOf "Man") then {}

publicVariable "varName"
binary Nothing

Broadcast a global variable value to all machines in MP.

publicVariable "g_score"

publicVariableServer "varName"
binary Nothing

Send a variable value to the server only.

Operator Type Legend

nular

No arguments. The command stands alone. Example: systemTime

unary

One argument on the right. Example: alive unit

binary

Left argument, command, right argument. Example: player addItem "x"

Private Arma 3 hosting

Run your own Arma 3 server.

Rent a private Arma 3 server on real hardware — full control-panel access, your mods, your configs, your rules. It's your server; run it your way.

Rent a Arma 3 server Real hardware · Full control panel · 98% SLA

Don't want to run it yourself? Our managed services & consulting team will set it up and keep it running for you — game servers, Windows, Linux, and cloud, from 10+ years of MSP work.