Jump to content
Sign in to follow this  
clydefrog

Making enableSimulation global

Recommended Posts

Hi, this is a local command so it needs to be run on all clients. To do this I have tried the following with BIS_fnc_MP and tested it on a dedicated server, but it does not work. Any ideas why or how to get it working in another way?

Here's the function (run on all clients):

CF_globalSimulation =

           		{

          		 private["_object","_status"];
           		_object = _this select 0;
		_status = _this select 1;

           		if(isNull _object) exitWith {};

       	_object enablesimulation _status;

       	}; 

and then here's what is called after creating the vehicle inside the isServer if statement:


	[[cargoBox1,false],"CF_globalSimulation",nil,true] call BIS_fnc_MP;

That should be all it takes right? Does this command even work on dedicated servers?

Thanks

Share this post


Link to post
Share on other sites

try spawn with Bis fnc MP not call

and where in mission is it called from?

are you sure also about the ,nil, parameter cause I don't remember if it was an option?

Share this post


Link to post
Share on other sites
try spawn with Bis fnc MP not call

and where in mission is it called from?

are you sure also about the ,nil, parameter cause I don't remember if it was an option?

Call is the correct way to use BIS_fnc_MP in Arma 3, it was Spawn in take on helicopters

the function is created in a script executed at the start of the mission from the init.sqf, and it is then called and run on all clients later on in that script on the server (which should be fine as I've done this with other things, as long as the function is created on all clients and not only the server it is ok to execute the function on the server), and yeah, the nil parameter means the function will be executed on all clients.

Share this post


Link to post
Share on other sites
the nil parameter means the function will be executed on all clients.

I know the example on the Wiki says nil to execute on alll clients yet the function syntax says 'Boolean - true to execute on every client, false to execute it on server only'.

Must admit i havent actually tried nil, I always use true and have had no problems get MP to do what i need.

Share this post


Link to post
Share on other sites
I know the example on the Wiki says nil to execute on alll clients yet the function syntax says 'Boolean - true to execute on every client, false to execute it on server only'.

Must admit i havent actually tried nil, I always use true and have had no problems get MP to do what i need.

Yeah it is in an example on there which is where I and a lot of others got it from, but I know that does work because I'm using it to do stuff such as addActions for all clients and it works fine, it's just this enableSimulation and I have seen other people wondering if this command even works on a dedi server.

Share this post


Link to post
Share on other sites

have you given a try to the "spawn" and "true" suggestions and what's the outcome? cause it works on my dedi server with the vehicle.sqf thing with init. and every examples I see uses spawn, not call. I may be wrong though.

also something I saw is the passing of object's netId with this function instead of the object itself. you can convert back to object in the function with something like objectFromNetid. This must be something to do when you just spawn an object.

hope this can help

Share this post


Link to post
Share on other sites

if (!(isNull player)) then {
fnc_simulationMP = {
private ["_object","_simStatus"];
	_object = (_this select 0);
	_simStatus =(_this select 1);

 _object  enablesimulation _simStatus; 
};};

  [[cargoBox1,false],"fnc_simulationMP",nil,true] call BIS_fnc_MP;  

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  

×