setName: Difference between revisions

From Bohemia Interactive Community
(Fix versions)
m (Text replacement - " ''via'' " to " via ")
 
Line 63: Line 63:
If [[setName]] is used with a string e.g <sqf inline>this setName "blah"</sqf>, nothing occurs in the command bar and the default randomized name is displayed.<br><br>
If [[setName]] is used with a string e.g <sqf inline>this setName "blah"</sqf>, nothing occurs in the command bar and the default randomized name is displayed.<br><br>
Dealing with the units' names in a script, _x (in a <sqf inline>forEach units _group</sqf>, for example) will return the "object" as {{hl|B ALFA 4-1:2}} or the name written in ai unit name field in editor (if exists).
Dealing with the units' names in a script, _x (in a <sqf inline>forEach units _group</sqf>, for example) will return the "object" as {{hl|B ALFA 4-1:2}} or the name written in ai unit name field in editor (if exists).
This context is rather a "variable name" for each object (ai) than an "identity name" as given ''via'' the [[setName]] command.
This context is rather a "variable name" for each object (ai) than an "identity name" as given via the [[setName]] command.
}}
}}

Latest revision as of 12:44, 21 February 2025

Hover & click on the images for description

Description

Description:
Sets the name of a location or a person (person only in single player).
Groups:
Unit IdentityLocations

Syntax

Syntax:
thing setName name
Parameters:
thing: Location or Arma 3 logo black.png1.02 Object
name: String
Return Value:
Nothing

Alternative Syntax

Syntax:
unit setName [name, firstName, lastName]
Parameters:
unit: Object
name: String
firstName: String
lastName: String
Return Value:
Nothing

Examples

Example 1:
Copy
myLocation setName "My Location Name";
Example 2:
Copy
player setName "New Name";
Example 3:
Copy
player setName ["Ben Kerry","Ben","Kerry"];

Additional Information

See also:
name nameSound setNameSound setIdentity

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Pierre MGI - c
Posted on Aug 18, 2014 - 22:15 (UTC)
Only last name will appear in command bar i.e. cthis setName _myNameArray will display c_myNameArray select 2. If setName is used with a string e.g cthis setName "blah", nothing occurs in the command bar and the default randomized name is displayed.

Dealing with the units' names in a script, _x (in a cforEach units _group, for example) will return the "object" as B ALFA 4-1:2 or the name written in ai unit name field in editor (if exists). This context is rather a "variable name" for each object (ai) than an "identity name" as given via the setName command.