Jump to content

Recommended Posts

hi,

 

Is there a way to determine the position of a vehicle by vehiclevarname?

 

I work on a survival server and want to save the positions even if the vehicle is moved without a driver.

 

Many Thanks.

Share this post


Link to post
Share on other sites

you can use getpos on empty vehicles 

myVehicle = vehicle player;

hint (str (getpos myVehicle));

 

Share this post


Link to post
Share on other sites

You need to cycle through all vehicles and compare your varname to each vehicle varname and get vehicle reference when they match

Share this post


Link to post
Share on other sites
23 minutes ago, LoOni3r said:

Is there a way to determine the position of a vehicle by vehiclevarname?

 

Sure:

_position = getPos myvehiclevarname;

or

_position = getPos (missionNamespace getVariable "myvehiclevarname");

 

25 minutes ago, LoOni3r said:

I work on a survival server and want to save the positions even if the vehicle is moved without a driver.

 

vehicles command returns all vehicles.

Share this post


Link to post
Share on other sites

I solved it this way:

{
	if (vehicleVarName _x != "") then {
		str typeOf _X remoteExec ["systemChat"];
		str vehicleVarName _x remoteExec ["systemChat"];
		str getPosATL _x remoteExec ["systemChat"];
		str getDir _x remoteExec ["systemChat"];
		str getAllHitPointsDamage _x remoteExec ["systemChat"];
	};

}
forEach vehicles; 

 

had hoped you can directly address the vehicle by vehiclevarname without scanning for all vehicle.

Many Thanks for your answers.

Share this post


Link to post
Share on other sites

If a vehicle is assigned to global variable with the same name as vehicleVarName, you can try get the reference with _veh = missionNamespace getVariable ["myvehvarname", objNull];

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

×