setVehicleVarName – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
 
m (Content's deleted as they are considered confusing. Making the page blank is preferred over deleting it completely, so we don't lose editing history.)
 
Line 1: Line 1:
[[AnswerMe]]


Anyone know what this command is supposed to achieve? If you put this in a vehicles init field:
<pre>This SetVehicleVarName "Test" ; Hint Format ["%1",Test]</pre>
The [[format]] command returns the scalar bool error. If you want to refer to the vehicle via the variable pointer Test in ver 1.05, you have to also call this:
<pre>This SetVehicleVarName "test";
This Call Compile Format ["%1=_This","Test"];</pre>
Cheers
:Maybe I'm missing something here, but wouldn't the second line be the same as <tt>Test=This</tt>?
:I don't quite understand why the <tt>_this</tt>, and why it needs to be compiled in the first place.
:When I tried the "plain" version it worked just fine: --[[User:Kronzky|Kronzky]] 03:45, 4 May 2007 (CEST)
:<code>this setVehicleVarName "test";<br>test=this;</code>
::Yeah, the second part is a bad example. For the purposes of understanding how the command is supposed to be used, your simplified version is a much clearer demonstration of the problem.
::My original example relates to how I wanted to use the command at the time. The variable names I want to use are all dynamic. Because they are created during the mission, I would not know what they were called. Only I removed all that from the code when I pasted the example here.
::I can't help thinking this is a bug with the setVehicleVarName command? As I can't think of any other use for it. [[User:UNN|UNN]] 08:29, 4 May 2007 (CEST)
<code>_name = "foobar";
_l = "logic" createvehicle getpos player;
_l setvehiclevarname _name;
player sidechat str _l; // output is "foobar"</code>
This is only use I see. --[[User:Doolittle|Doolittle]] 08:45, 9 August 2007 (CEST)
Useful in scripts with [[createUnit_array]]. For example, can't use the game generated (O 1-1-H:1 etc) object name in [[setTriggerStatements]]. --[[User:Shuko|Shuko]] 17:31, 3 September 2009 (CEST)
When respawn happens, dead unit and alive player will have the same name but point to different object. As stated in the article, it's possible to assign the dead unit body a different name with the a step pass. [[User:Alef|alef]] 14:52, 25 November 2009 (CET)

Latest revision as of 15:45, 18 April 2018