Jump to content

Recommended Posts

For BLUFOR_Player1_1:

 

if (isServer) then {
     [] spawn {
       while {true} do {
         waitUntil {sleep 1; allUnits findIf { side _x in [INDEPENDENT,EAST] &&  {BLUFOR_Player1_1 distance2D _x < 40} } >-1};
         ZeusBLUFOR1_1_Curator removeCuratorEditingArea 1;
         waitUntil {sleep 1; allUnits findIf { side _x in [INDEPENDENT,EAST] &&  {BLUFOR_Player1_1 distance2D _x < 40} } == -1};
         ZeusBLUFOR1_1_Curator addCuratorEditingArea [1, position BLUFOR_Player1_1, 40];
      };
    };
};

 


        

Share this post


Link to post
Share on other sites
15 minutes ago, pierremgi said:

For BLUFOR_Player1_1:

 


if (isServer) then {
     [] spawn {
       while {true} do {
         waitUntil {sleep 1; allUnits findIf { side _x in [INDEPENDENT,EAST] &&  {BLUFOR_Player1_1 distance2D _x < 40} } >-1};
         ZeusBLUFOR1_1_Curator removeCuratorEditingArea 1;
         waitUntil {sleep 1; allUnits findIf { side _x in [INDEPENDENT,EAST] &&  {BLUFOR_Player1_1 distance2D _x < 40} } == -1};
         ZeusBLUFOR1_1_Curator addCuratorEditingArea [1, position BLUFOR_Player1_1, 40];
      };
    };
};

 

Just a quick question about why this is a better way of writing what I've already put.

 

I can see that the check for Independent/East is a much cleaner way of doing what my script already does, I'm just wondering why you suggest using:

14 minutes ago, pierremgi said:

if (isServer) then {

and:

15 minutes ago, pierremgi said:

{BLUFOR_Player1_1 distance2D _x < 40} } >-1};

15 minutes ago, pierremgi said:

{BLUFOR_Player1_1 distance2D _x < 40} } == -1};

 

Share this post


Link to post
Share on other sites

isServer  There is no need to run that on client as far as your command are server only! Already explained multiple times on your other topics.

waitUntil   avoid repeating code (for curator areas). There is no reason for adding (or removing) an area every 0.05 sec.

while {true}  // In MP, instead of alive blabla,  just in case your unit blabla can be killed/respawned.

findIf (see example 2)

 

see also:

https://community.bistudio.com/wiki/Code_Optimisation

https://community.bistudio.com/wiki/Multiplayer_Scripting

 

Take time to read if you want to progress in MP scripting.

 

 

 

 

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

×