Arma 3 Scripting

Command in Unit Identity, Locations

name

Also available as Markdown and JSON, or read the original wiki page.

Description

When argument is Object, the command returns the name given to a unit using the setIdentity instruction or selected randomly by the game engine if setIdentity has not been used on the unit. If used on vehicle, name of first crew member (in order commander, driver, gunner). If used on an object, "Error: No unit" is being returned.

Syntax

Syntax 1

name object

Parameters:

Returns: String

Syntax 2

since arma1 1.08

name location

Parameters:

Returns: String - the location's name. To get its textual value, use text (see #Example 3)

Syntax 3

since arma3 2.18

name namespace

Parameters:

Returns: String - namespace's name. Possible values:

Syntax 4

since arma3 2.22

name scriptHandle

Parameters:

Returns: String - The name given to the script via scriptName or the name passed to spawn when creating a "Empty Handle"

Examples

Example 1

_name = name player;

Example 2

_locationName = name myLocation;

Example 3

name nearestLocation [position player, "Hill"]; // ""
text nearestLocation [position player, "Hill"]; // "Lesnoy Khrebet"

Example 4

_currentNamespace = name currentNamespace;

Multiplayer

name returns profileName, eventually suffixed by the server in the event of identical names, e.g username/username (2).

Problems

Important

If the provided unit is dead and has been removed from its group, its identity has then been purged to save memory and using name on it will result in a logged error.

See also

profileName · setName · setIdentity · nameSound · setNameSound · createLocation · deleteLocation · locationPosition · nearestLocation · nearestLocations · nearestLocationWithDubbing

Community notes

Kju

Location variant appears to be only for the 3d editor.

Alef

Will return Error: No vehicle for JIP players in init.sqf, if no sleep were performed.