Jump to content

Recommended Posts

Hi Folks.

 

My goal is set in my mp training scenario a kind of randomized CQB "killhouse" generator, and I was lucky to find between my old files a scenario folder that have it. It works perfectly in SP but in MP have a problem, and is when my buddys join in scenario walls and targets are not synchronized between the server and the players.

 

I must clarify that I don't know anything about scripting.

 

I understand that the function of the script is to hide the walls and targets randomly to give a dynamic impression to the killhouse. It works with ACE mod menu.

 

Below I leave the details:

In a transfer switch init (Land_TransferSwitch_01_F)  named "training_tools":

_killhousecategory = ["KILLHOUSE", "KILLHOUSE", "", {}, {true}] call ace_interact_menu_fnc_createAction;    
_targetcategory = ["TARGETS", "TARGETS", "", {}, {true}] call ace_interact_menu_fnc_createAction;    
_rankillhouse = ["KILLHOUSE_RAN", "RANDOMIZE", "", {    
private["_w", "_walls"];  
_walls = [];  
_w = 0;  
  
for "_count" from 0 to 45 do {  
    _w = _w + 1;  
    _walls set [_count, format["w%1", _w]];  
    if (_w == 45) then {  
        _w = 0;  
        {  
            targetObj = missionNamespace getVariable [_x, objNull];  
            targetObj hideObject false;  
            targetObj setDamage 0; 
        } forEach _walls;  
        for "_count2" from 0 to 45 do {  
            ranval = selectRandom _walls;  
            target = missionNamespace getVariable [ranval, objNull];  
            target hideObject true;  
        };  
    };  
};  
}, {true}] call ace_interact_menu_fnc_createAction;    
  
_rantargets = ["OPFOR", "[TAR] OPFOR", "", {    
private["_t", "_targets"];  
_targets = [];  
_t = 0;  
  
for "_count" from 0 to 51 do {  
    _t = _t + 1;  
    _targets set [_count, format["t%1", _t]];  
    if (_t == 51) then {  
        _t = 0;  
        {  
            targetObj = missionNamespace getVariable [_x, objNull];  
            targetObj hideObject false;  
            targetObj setDamage 0.8;  
        } forEach _targets;  
        for "_count2" from 0 to 51 do {  
            ranval = selectRandom _targets;  
            target = missionNamespace getVariable [ranval, objNull];  
            target hideObject true;  
        };  
    };  
};  
}, {true}] call ace_interact_menu_fnc_createAction;    
  
_ranciv = ["CIV", "[TAR] CIV", "", {    
private["_civ", "_civilians"];  
_civilians = [];  
_civ = 0;  
  
for "_count" from 0 to 33 do {  
    _civ = _civ + 1;  
    _civilians set [_count, format["civ%1", _civ]];  
    if (_civ == 33) then {  
        _civ = 0;  
        {  
            targetObj = missionNamespace getVariable [_x, objNull];  
            targetObj hideObject false;  
            targetObj setDamage 0.99;  
        } forEach _civilians;  
        for "_count2" from 0 to 43 do {  
            ranval = selectRandom _civilians;  
            target = missionNamespace getVariable [ranval, objNull];  
            target hideObject true;  
        };  
    };  
};  
}, {true}] call ace_interact_menu_fnc_createAction;    
  
_cleartargets = ["CLEAR", "[TAR] CLEAR", "", {    
private["_num", "_targets", "_civilians"];  
_targets = [];  
_civilians = [];  
_num = 0;  
  
for "_count" from 0 to 51 do {  
    _num = _num + 1;  
    _targets set [_count, format["t%1", _num]];  
    _civilians set [_count, format["civ%1", _num]];  
};  
  
{  
    targetObj = missionNamespace getVariable [_x, objNull];  
    targetObj hideObject true;  
} forEach _targets;  
  
{  
    targetObj = missionNamespace getVariable [_x, objNull];  
    targetObj hideObject true;  
} forEach _civilians;  
}, {true}] call ace_interact_menu_fnc_createAction;    
  
[training_tools, 0, ["ACE_MainActions"], _targetcategory] call ace_interact_menu_fnc_addActionToObject;  
[training_tools, 0, ["ACE_MainActions"], _killhousecategory] call ace_interact_menu_fnc_addActionToObject;  
[training_tools, 0, ["ACE_MainActions", "KILLHOUSE"], _rankillhouse] call ace_interact_menu_fnc_addActionToObject;  
[training_tools, 0, ["ACE_MainActions", "TARGETS"], _cleartargets] call ace_interact_menu_fnc_addActionToObject; 
[training_tools, 0, ["ACE_MainActions", "TARGETS"], _rantargets] call ace_interact_menu_fnc_addActionToObject;  
[training_tools, 0, ["ACE_MainActions", "TARGETS"], _ranciv] call ace_interact_menu_fnc_addActionToObject; 

There are a total of 45 internal walls named consecutively (w1, w2,......w45).

There are a total of 51 opfor targets named consecutively (t1, t2,......t51).

There are a total of 33 civilian targets named consecutively (civ1, civ2,......civ33)

 

Sorry, my english sucks.

 

Greetings and thanks

 

Share this post


Link to post
Share on other sites

Looks like you have to remoteExec hideObject since it is local effect.

//target hideObject true;
[target, true] remoteExec ["hideObjectGlobal", 2]; // remote-executes hideObjectGlobal from a client to the server

Do it for all instances of hideObject (not just target 😐).

  • Thanks 1

Share this post


Link to post
Share on other sites
41 minutes ago, RCA3 said:

Looks like you have to remoteExec hideObject since it is local effect.


//target hideObject true;
[target, true] remoteExec ["hideObjectGlobal", 2]; // remote-executes hideObjectGlobal from a client to the server

Do it for all instances of hideObject (not just target 😐).

 

It would be replacing

 

Quote

//target hideObject true;

 

by

 

Quote

[target, true] remoteExec ["hideObjectGlobal", 2]; // remote-executes hideObjectGlobal from a client to the server

 

???.

 

Thanks.

Share this post


Link to post
Share on other sites

Yes, and:

Quote

targetObj hideObject true;

would be:

Quote

[targetObj, true] remoteExec ["hideObjectGlobal", 2]; // remote-executes hideObjectGlobal from a client to the server

 

Replace true and false accordingly.

  • Thanks 1

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  

×