Jump to content
Tankbuster

setVehicleVarName and remoteexec?

Recommended Posts

How can I run setVehicleVarName on all machines in MP with a dedi?

 

I'm using this in my mildly modified objectsmapper.

			if (_varName != "") then
			{
				_newObj setVehicleVarName _varName;
				call (compile (_varName + " = _newObj;"));
				[(compile _newObj),(compile _varName)] remoteExec ["setVehicleVarName",0];

			};

Am I even close?

Share this post


Link to post
Share on other sites
fnc_setVehicleName = {

//set vehicle name for spawned object

//example
//_veh = createVehicle ["I_UAV_02_F", [24068.07,18587.05,3.19], [], 0, "NONE"];
//[_veh, "uavName"] call fnc_setVehicleName;

    params ["_veh", "_name"];
    missionNamespace setVariable [_name, _veh, true];
    [_veh, _name] remoteExecCall ["setVehicleVarName", 0, _name];
};

Author: someone on this forum

Share this post


Link to post
Share on other sites

Tankbuster, while this appears solved.

I am pretty sure the objects mapper had am option for the object to be named. You have to do this thorough a setvariable in the object init. If scripted it's a little more work but able to be done.

Let me know add this is something I have helped otherso with before in the forums.

Share this post


Link to post
Share on other sites

objectsmapper does allow the vehicle to be named, but it uses setVehicleVarName, which is a local command. If it runs on the server, none of the clients get the vehiclevarname. Some have suggested that publicvariable'ing the vehicle object might work, but it doesn't. So the only way appears to be to run setvehiclevarname everywhere.

 

BTW, it was (as usual) killzone_kid who wrote the above function, so thanks to him and and davidoss. :)

Share this post


Link to post
Share on other sites

 

BTW, it was (as usual) killzone_kid who wrote the above function, so thanks to him and and davidoss. :)

Thank you, I have forgotten I wrote it TBH ;) Anyway here is updated variant. Since original post, there were some good changes to remoteExec, mainly that you can pass object itself as JIP and the JIP queue will be automatically removed when object is deleted. So the following code is slightly better:

fnc_setVehicleName =
{
	params ["_veh", "_name"];
	missionNamespace setVariable [_name, _veh, true];
	[_veh, _name] remoteExec ["setVehicleVarName", 0, _veh];
};

//example
_veh = createVehicle ["I_UAV_02_F", [24068.07,18587.05,3.19], [], 0, "NONE"];
[_veh, "uavName"] call fnc_setVehicleName;
  • Like 3

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

×