Jump to content
Chance536

Hiding layers for all players on a local host

Recommended Posts

So I've been making a liberation type map with all custom points. I've been hand placing the enemies, so they look like they're actually living there. After the point is captured the layers switch after 10 min and there is now a fob that is spawnable there. My scripting knowledge is limited so I usually put things in the init of units, it's just easier for me to visualize what I'm doing and keep track of it all. So I've been hiding the layers until they are activated manually because there's ALOT of ai on the map. It works absolutely flawless for me and my standards I get great frames across the map, and the layers are hidden and not trying to move around. The problem starts when other players join. The AI of the units disables but not the simulation and model. Here's the code I put in the init of a unit. This is the first time I've ever even tried to use serverExec so i probably messed it up.

call{{_x disableAI "all"; _x enableSimulation false; _x hideObject true;} forEach (getMissionLayerEntities "mantiq" #0)} remoteExec ["call",2];

 

Share this post


Link to post
Share on other sites
16 hours ago, Chance536 said:

 I usually put things in the init of units, it's just easier for me to visualize what I'm doing and keep track of it all.The problem starts when other players join. The AI of the units disables but not the simulation and model. Here's the code I put in the init of a unit. This is the first time I've ever even tried to use serverExec so i probably messed it up.


call{{_x disableAI "all"; _x enableSimulation false; _x hideObject true;} forEach (getMissionLayerEntities "mantiq" #0)} remoteExec ["call",2];

 

 

If you place a code in init field of an object/unit , the code will run on server and players when joining. That means, for JIP, at different times of the game.

getMissionLayerEntities has sense on server only. (probably the reason why you remote exec on it (2) ). But you are doing that at each login JIP. There is no need for that!
A code for server, from an init field should be simple as:

if (isServer) then {...};

No way to run it at each player's joining.
The second fact is enableSimulation and hideObject are commands with local effect (LE) only. That means, as you are writing for server cause getMissionLayerEntities, the effect will be for server only.

Use enableSimulationGlobal and hideObjectGlobal instead.

So, something like:

if (isServer) then {  {_x disableAI "all"; _x enableSimulation false; _x hideObject true} forEach ((getMissionLayerEntities "mantiq") #0) };

should work. (the disableAI "all" seems to me useless).

 

 

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

×