Page MenuHomeFeedback Tracker

VehicleVarName && setVehicleVarName does not work as intended
Closed, ResolvedPublic

Description

As Above

Details

Legacy ID
82159690
Severity
None
Resolution
No Bug
Reproducibility
Always
Category
Scripting
Steps To Reproduce

Create AmmoCrate in Mission editor
in INIT string type
' this setvehiclevarname "TEST123" '
Enter Game
When you mouseover and use hint like
"
hint format ["VarName = %1", cursortarget]
"
The object is referred too as the varname you set.

HOWEVER

in debug type

player setpos (getpos TEST123)

This does not work and the player stays where he is.

Event Timeline

ozdeadmeat edited Additional Information. (Show Details)
ozdeadmeat set Category to Scripting.
ozdeadmeat set Reproducibility to Always.
ozdeadmeat set Severity to None.
ozdeadmeat set Resolution to No Bug.
ozdeadmeat set Legacy ID to 82159690.May 7 2016, 8:14 PM
F2kSel added a subscriber: F2kSel.May 7 2016, 8:14 PM
F2kSel added a comment.Feb 7 2015, 3:11 PM

It does work but it is a little confusing.

this setvehiclevarname "TEST123";set the visible name only.
missionNamespace setVariable ["TEST123",this];
changes the physical name

They do not need to be the same either and you may not need both but it makes sense to keep them the same.

This is not a bug, detailed explanation of how command works is in the command description on BIKI page

PiepMGI added a subscriber: PiepMGI.May 7 2016, 8:14 PM

In BIKI documentation:
"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.
_offroad setVehicleVarName "MyFerrari"; MyFerrari = _offroad;"

Sure thing, When you have an "identified" vehicle (_offroad), you can rename it, then delete it. You don't need to rename it for that.
Same for TEST123 = cursortarget; then later, delete TEST123 works!

OK, it's not a bug, but to be consistent, this function should be improved in order to be more useful and less confusing.

Place a unit with empty name. use setVehicleVarName to give it a name ("TEST123").
Neither:
_string = "TEST123"; _object = call compile _string; deleteVehicle _object;
nor:
deleteVehicle (missionNamespace getVariable ["TEST123",objNull]);
work...

Please make this function able to delete (or else) the "refering" vehicle.
It's not hard to add
missionNamespace setVariable ["TEST123",this];
It's just impossible to guess it for common guys who intend to script.

or create a setVehicleObjectName...

or, at least, add this mission miraculous variable in BIKI.

The command works as intended, and no changes will be made to it because of backwards compatibility. Going to close this to stop unnescessary bumping.