Jump to content
Sign in to follow this  
Bulldog72

VehicleVarName headaches...

Recommended Posts

In a script I have this:

_carVehicleVarName = "foobar"; //the real "string"

That is all the script knows at this point.

Metainfo:

In my game there exists a vehicle (a humvee actually but thats not important here) which indeed has the name foobar and can be referenced by it.

Therefore:

_carPos = getPos foobar;

is perfectly valid.

And this is exactly what I need. The position of said car foobar.

How do I get there from the string "foobar"?

Share this post


Link to post
Share on other sites

When you do that don't use quotes. That way you'll assign that value into a global variable.

_carvehicleVarName = foobar;

Just check Twirly's link, and you'll see how to correctly assign a variable name to an object. Maybe that was what you wanted.

If you do it, remember to publicVariable it, in case you're making MP mission and you want that variable to be recognized across the whole network.

Share this post


Link to post
Share on other sites

Ty, but the problem at this point is still I can not know the car as the "object".

So I cant do a

_carObject = foobar;

because I dont know foobar (without quotes) yet.

I do know "foobar" (or "myuberride" or "whatever") as string representation of some object's name only - the script does not have the Metainfo that there are actual objects floating around with those names.

And I cant do a

if (_carvehicleVarName == "foobar") then {
  foobar doDance; //do something with object foobar
};

for all possible names either because the "name's pool" may change dynamically. Some names may come from editor placed objects, some are assigned with setVehicleVarName as vehicles are created at runtime.

I need to get my hand on the actual object reference starting from those string names first...

Basically I would need something similar to:

_myride = [color="#FF0000"]getObjectWithVehicleVarName[/color] _carvehicleVarName;

Any other ideas or am I barking up the wrong tree here and something like this is not doable?

Share this post


Link to post
Share on other sites


[left][color=#333333]_myride = [/color]missionNamespace getVariable [color=#333333]_carvehicleVarName;[/color][/left]




Xeno

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×