---
name: "setVehicleVarName"
type: command
status: ok
groups: ["Object Manipulation"]
arma3_since: "0.50"
locality: {"argument": "global", "effect": "local", "server_exec": false}
source: https://community.bistudio.com/wiki/setVehicleVarName
revid: 338577
updated: 2023-03-20T15:21:44Z
---

# setVehicleVarName

*Command · Object Manipulation · Arma 3 v0.50 · introduced in Armed Assault v1.00*

Locality: arguments **global** · effect **local**

## Description

Sets string representation of an object to a custom string.

When a vehicle is created and named in the editor, the name becomes both the variable containing the vehicle object and the string representation of the vehicle object.
In scripts an extra step is needed to achieve the same effect - see [#Example 1](../commands/setVehicleVarName.md#example-1).

> [!NOTE]
> This does not work with Simple Objects.

## Syntax

```sqf
object setVehicleVarName name
```

**Parameters:**

- `object`: [Object](../topics/Object.md)
- `name`: [String](../topics/String.md)

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
private _playersCar = vehicle player;
systemChat str _playersCar; // displays e.g "ce06b00# 164274: offroad_01_unarmed_f.p3d"

_playersCar setVehicleVarName "MyOffroad";
systemChat str _playersCar;    // displays "MyOffroad"

isNil "MyOffroad";            // true - the MyOffroad variable is not set
MyOffroad = _playersCar;    // now it is
publicVariable "MyOffroad";    // broadcasts it over the network
```

### Example 2

```sqf
_offroad setVehicleVarName ""; // Reset string representation to the default value
```

## See also

[vehicleVarName](../commands/vehicleVarName.md) · [BIS_fnc_objectVar](../functions/BIS_fnc_objectVar.md)

<sub>Source: [BI Community Wiki — setVehicleVarName](https://community.bistudio.com/wiki/setVehicleVarName) (revision 338577).</sub>
