{"name":"setName","title":"setName","type":"command","url":"https://community.bistudio.com/wiki/setName","revid":370891,"updated":"2025-02-21T10:44:05Z","groups":["Unit Identity","Locations"],"status":"ok","games":{"arma1":"1.08","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma1 1.08","arma3_since":"0.50","locality":{"argument":"global","effect":"local"},"description":"Sets the name of a location or a person (person only in single player).","syntaxes":[{"syntax":"thing setName name","params":[{"name":"thing","type":"Location or Arma 3 v1.02 Object","type_expr":"Location | Object"},{"name":"name","type":"String","type_expr":"String"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"thing"},"right":{"text":"name"}},{"syntax":"unit setName [name, firstName, lastName]","since":"arma3 1.02","params":[{"name":"unit","type":"Object","type_expr":"Object"},{"name":"name","type":"String","type_expr":"String"},{"name":"firstName","type":"String","type_expr":"String"},{"name":"lastName","type":"String","type_expr":"String"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"unit"},"right":{"text":"[name, firstName, lastName]"}}],"examples":[{"code":["myLocation setName \"My Location Name\";"]},{"code":["player setName \"New Name\";"]},{"code":["player setName [\"Ben Kerry\",\"Ben\",\"Kerry\"];"]}],"see_also":["name","nameSound","setNameSound","setIdentity"],"notes":[{"user":"Pierre MGI","date":"2014-08-18T22:15:00Z","text":"Only last name will appear in command bar i.e. `this setName _myNameArray` will display `_myNameArray select 2`.\nIf setName is used with a string e.g `this setName \"blah\"`, nothing occurs in the command bar and the default randomized name is displayed.\n\nDealing with the units' names in a script, _x (in a `forEach 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).\nThis context is rather a \"variable name\" for each object (ai) than an \"identity name\" as given via the setName command."}]}