Jump to content
Prejudice

How to execute HideTerrainObjects Remotely

Recommended Posts

Hey,
I've been scripting some stuff for a Scenario we are playing and I'm running the below piece of code

 

{ _x hideObjectGlobal true } foreach (nearestTerrainObjects [player,[],8]);


Now that piece of code is meant to hide all terrain objects around my player (and it does) however it doesn't execute on all other clients, the terrain objects are only hidden for me, the local client. 

 

Even with the hideObjectGlobal use it still is only for me, I've tried to remoteexec it but am unsure how to execute the above using remoteexec, Ive also tried Calling BIS_fnc_MP but to no avail. 

Ive been looking for a while and am very annoyed with myself that I can't seem to figure this out, the code works fine, its just forcing it to execute across all connected clients to the dedicated server that is making me pull my hair out. 

 

Thanks in advance 

 

Share this post


Link to post
Share on other sites

Thanks That got it working on my side, perfectly. 

Im still struggling to understand the remote exec. 

Ive got the following code that I need to do the same for but unsure how to do it again

 

	_this setVariable ["LESH_canBeTowed", 1]; 
	_this setVariable ["LESH_towFromFront", 1]; 
	_this  setVariable ["LESH_AxisOffsetTarget", [0,4.8,-1.3]]; 
	_this setVariable ["LESH_WheelOffset", [0,-1.5]];
	_this setVariable ["LESH_canTow", 1];   
	_this setVariable ["LESH_AxisOffsetTower", [0,-4.5,-1.0]]; 

tried a couple things but hit a wall

Share this post


Link to post
Share on other sites

It's time for you to learn about locality and Multiplayer Scripting. It is a tough concept to understand, and harder yet to master. hideObjectGlobal should only be run on the server, that's what the "SE" means. Now with new knowledge take another look at the wiki page for setVariable and you will see that it produces local effects i.e. only the computer that ran the command will see it's effect. That's normally when you'd bring in remoteExec, but as _foley stated the command has a third parameter that will broadcast for you. Keep in mind that using the broadcast parameter in setVariable will automatically make the value saved for JIP players, if that is not desired for whatever reason then you must use remoteExec

  • Like 2

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

×