setVehicleVarName: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (Undo revision 87650 by Ozdeadmeat (talk) Behaviour and example is already covered in description) |
m (Minor cleanup. And change example to make it clear that you need to set variable) |
||
Line 14: | Line 14: | ||
<code>[[hint]] [[str]] _offroad; //MyFerrari</code> | <code>[[hint]] [[str]] _offroad; //MyFerrari</code> | ||
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. [[vehicleVarName]] on the other hand is only string representation of the object. So if you want to refer to the actual object by its [[vehicleVarName]], an extra step needed to assign the object to a variable of the same name. For example to see and refer to offroad as myFerrari: | 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. [[vehicleVarName]] on the other hand is only string representation of the object. So if you want to refer to the actual object by its [[vehicleVarName]], an extra step needed to assign the object to a variable of the same name. For example to see and refer to offroad as myFerrari: | ||
<code>_offroad [[setVehicleVarName]] "MyFerrari"; MyFerrari {{=}} _offroad;</code> | <code>_offroad [[setVehicleVarName]] "MyFerrari"; | ||
MyFerrari {{=}} _offroad;</code> | |||
In multiplayer environment [[setVehicleVarName]] has to be executed on every PC if you want the custom name to be known everywhere. If vehicle is created and named in the editor, the vehicle name will be known globally automatically. <br> | In multiplayer environment [[setVehicleVarName]] has to be executed on every PC if you want the custom name to be known everywhere. If vehicle is created and named in the editor, the vehicle name will be known globally automatically. <br> | ||
To reset [[vehicleVarName]] and [[str]] representation of the object to original form set [[vehicleVarName]] to an empty string: | To reset [[vehicleVarName]] and [[str]] representation of the object to original form set [[vehicleVarName]] to an empty string: | ||
Line 29: | Line 30: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1= <code>[[player]] [[setVehicleVarName]] "aP";</code> |= Example 1 | |x1= <code>[[player]] [[setVehicleVarName]] "aP"; | ||
aP = [[player]];</code> |= Example 1 | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| mp= Execute on every client |= | | mp= Execute on every client |= |
Revision as of 12:07, 18 April 2018
Description
- Description:
- Sets string representation of an object to a custom string. For example it is possible to return "MyFerrari" instead of default "ce06b00# 164274: offroad_01_unarmed_f.p3d" when querying object as string:
hint str _offroad; //MyFerrari
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. vehicleVarName on the other hand is only string representation of the object. So if you want to refer to the actual object by its vehicleVarName, an extra step needed to assign the object to a variable of the same name. For example to see and refer to offroad as myFerrari:_offroad setVehicleVarName "MyFerrari"; MyFerrari = _offroad;
In multiplayer environment setVehicleVarName has to be executed on every PC if you want the custom name to be known everywhere. If vehicle is created and named in the editor, the vehicle name will be known globally automatically.
To reset vehicleVarName and str representation of the object to original form set vehicleVarName to an empty string:_offroad setVehicleVarName "";
- Multiplayer:
- Execute on every client
- Groups:
- Uncategorised
Syntax
Examples
- Example 1:
player setVehicleVarName "aP"; aP = player;
Additional Information
- See also:
- vehicleVarName
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
Notes
Bottom Section
Categories:
- Scripting Commands
- Introduced with Arma version 1.00
- Arma: New Scripting Commands
- Arma: Scripting Commands
- Command Group: Uncategorised
- Scripting Commands: Local Effect
- Scripting Commands OFP Elite
- Scripting Commands ArmA
- VBS2 Command Group: Variables
- Scripting Commands ArmA2
- Scripting Commands Arma 3
- Scripting Commands Take On Helicopters