Jump to content
  • Topics

  • 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 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  
    • that's how I do it, works perfectly.   init.sqf   if (isNil "e_spawn") then {e_spawn = true}; // Define spawn arrays csat_infantry_spawn_array = ["OIA_InfSquad", "OIA_InfSquad_Weapons", "OIA_InfTeam", "OIA_InfTeam_AT", "OIA_InfSentry"]; csat_infantry_support_spawn_array = ["OI_support_CLS", "OI_support_EOD", "OI_support_ENG"]; csat_motorized_spawn_array = ["OIA_MotInfTeam", "OIA_MotInf_AT", "OIA_MotInf_GMGTeam"]; csat_mechanized_spawn_array = ["OIA_MechInfSquad", "OIA_MechInf_AT"];   Start the spawn.sqf any way you want: nul = [] execVM "spawn.sqf";   spawn.sqf private ["_random1", "_random2", "_random3", "_random4", "_spawnGroup1", "_spawnGroup2", "_spawnGroup3", "_spawnGroup4"]; while {e_spawn} do  {     if (isServer) then {                  _random1 = floor random 6;         _random2 = floor random 4;         _random3 = floor random 4;         _random4 = floor random 3;         _spawnGroup1 = csat_infantry_spawn_array select _random1;         _spawnGroup2 = csat_infantry_support_spawn_array select _random2;         _spawnGroup3 = csat_motorized_spawn_array select _random3;         _spawnGroup4 = csat_mechanized_spawn_array select _random4;                  csat_grp1 = [getMarkerPos "spawn1", east, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> _spawnGroup1)] call BIS_fnc_spawnGroup;         [csat_grp1, getMarkerPos "Radiotower", 150] call BIS_fnc_taskAttack;         csat_grp2 = [getMarkerPos "spawn2", east, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Support" >> _spawnGroup2)] call BIS_fnc_spawnGroup;         [csat_grp2, getMarkerPos "Radiotower", 150] call BIS_fnc_taskAttack;                  csat_grp3 = [getMarkerPos "spawn3", east, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Motorized_MTP" >> _spawnGroup3)] call BIS_fnc_spawnGroup;         [csat_grp3, getMarkerPos "Radiotower", 150] call BIS_fnc_taskAttack;                  csat_grp4 = [getMarkerPos "spawn1", east, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Mechanized" >> _spawnGroup4)] call BIS_fnc_spawnGroup;         [csat_grp4, getMarkerPos "Radiotower", 150] call BIS_fnc_taskAttack;     };              sleep 250; }; You can define random groups to spawn. You can extend the waypoint radius. Instead of attacking you can use BIS_fnc_taskPatrol or BIS_fnc_taskDefend. Instead of fixed spawn points and destination points you can alter the code the way you need it. If you don't want random groups to spawn, remove _spawnGroupX and enter the desired group directly. Exit the unit spawn by setting e_spawn to false on runtime.  
    • Updated: added the loadout and faction customization as optional configurations;
    • Jebus and MGI modules are very good options. 
    • Try applying private to all local variables, like so: private _ingame = true; Do it to all local (_thisIsLocal) variables. If you're just using CUP you can share your mission and i'll take a look. DM if you want.
×