setVehicleVarName – Talk

From Bohemia Interactive Community
Revision as of 15:52, 25 November 2009 by Alef (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

AnswerMe

Anyone know what this command is supposed to achieve? If you put this in a vehicles init field:

This SetVehicleVarName "Test" ; Hint Format ["%1",Test]

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:

This SetVehicleVarName "test";
This Call Compile Format ["%1=_This","Test"];

Cheers

Maybe I'm missing something here, but wouldn't the second line be the same as Test=This?
I don't quite understand why the _this, and why it needs to be compiled in the first place.
When I tried the "plain" version it worked just fine: --Kronzky 03:45, 4 May 2007 (CEST)
this setVehicleVarName "test";
test=this;
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. UNN 08:29, 4 May 2007 (CEST)

_name = "foobar"; _l = "logic" createvehicle getpos player; _l setvehiclevarname _name; player sidechat str _l; // output is "foobar" This is only use I see. --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. --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. alef 14:52, 25 November 2009 (CET)