pierremgi 4743 Posted April 26 if (_unit IsKindOf "CAManBase") then { call { if (faction _unit isEqualTo "BLU_F") exitwith {[_unit] spawn CB_fnc_loadout_BLUFORnato}; // standard NATO if (faction _unit isEqualTo "BLU_CTRG_F") exitWith {[_unit] spawn CB_fnc_loadout_BLUFORspecops}; // CTRG if (faction _unit isEqualTo "BLU_G_F") exitWith {[_unit] spawn CB_fnc_loadout_BLUFORion}; // FIA as IoN security if (faction _unit isEqualTo "OPF_F") exitWith {[_unit] spawn CB_fnc_loadout_OPFORcsat}; // standard CSAT if (faction _unit isEqualTo "OPF_R_F") exitWith {[_unit] spawn CB_fnc_loadout_OPFORspecops}; // Spetznaz as Viper guys if (faction _unit isEqualTo "IND_G_F") exitWith {[_unit] spawn CB_fnc_loadout_INDFORfia}; // standard FIA if (faction _unit isEqualTo "IND_C_F") exitWith {[_unit] spawn CB_fnc_loadout_INDFORspecops}; // Syndikat as common criminals if (faction _unit isEqualTo "CIV_F") exitWith {[_unit] spawn CB_fnc_loadout_CIV}; }; }; Share this post Link to post Share on other sites
Raider_18 4 Posted April 26 2 hours ago, pierremgi said: if (_unit IsKindOf "CAManBase") then { call { if (faction _unit isEqualTo "BLU_F") exitwith {[_unit] spawn CB_fnc_loadout_BLUFORnato}; // standard NATO if (faction _unit isEqualTo "BLU_CTRG_F") exitWith {[_unit] spawn CB_fnc_loadout_BLUFORspecops}; // CTRG if (faction _unit isEqualTo "BLU_G_F") exitWith {[_unit] spawn CB_fnc_loadout_BLUFORion}; // FIA as IoN security if (faction _unit isEqualTo "OPF_F") exitWith {[_unit] spawn CB_fnc_loadout_OPFORcsat}; // standard CSAT if (faction _unit isEqualTo "OPF_R_F") exitWith {[_unit] spawn CB_fnc_loadout_OPFORspecops}; // Spetznaz as Viper guys if (faction _unit isEqualTo "IND_G_F") exitWith {[_unit] spawn CB_fnc_loadout_INDFORfia}; // standard FIA if (faction _unit isEqualTo "IND_C_F") exitWith {[_unit] spawn CB_fnc_loadout_INDFORspecops}; // Syndikat as common criminals if (faction _unit isEqualTo "CIV_F") exitWith {[_unit] spawn CB_fnc_loadout_CIV}; }; }; Roger that, changed. Thanks! Share this post Link to post Share on other sites
pierremgi 4743 Posted April 26 btw, you could use a hashmap , probably better for preparing such script(s). Something like: CB_Factions_data = createHashMapFromArray [ ["BLU_F", [ [ "WhiteHead_01", "WhiteHead_05", "WhiteHead_04",...], [ "U_I_L_Uniform_01_tshirt_black_F", .5, "U_I_L_Uniform_01_tshirt_olive_F", .5, "U_I_L_Uniform_01_tshirt_skull_F", .5,....], [ "\a3\characters_f_gamma\Civil\Data\c_cloth1_black.paa", "A3\Characters_F\Civil\Data\c_cloth1_kabeiroi_co.paa", ....], [ "V_LegStrapBag_olive_F", "V_LegStrapBag_coyote_F", "V_LegStrapBag_black_F", "V_Pocketed_black_F", ...], [ "H_Beret_blk", "H_Bandanna_gry", "H_Bandanna_blu", "H_Bandanna_cbr", "H_Booniehat_taiga", "H_Booniehat_wdl",....], [ "arifle_AKM_F", "arifle_AKS_F", "arifle_AK12U_F", "arifle_CTAR_blk_F" ,...], [....] ], ], ["BLU_CTRG_F", [[...],[...],...]] ], .... ]; This way, you can see the whole things you want and the codes are faster. You create the hashmap once for all, then use it multiple times. Usage is a little bit different from testing a condition and running a script. Just: private _factionData = CB_Factions_Data get faction _unit; _unit setFace selectRandom (_factionData #0); _unit forceAddUniform selectRandomWeighted (_factionData #1); if (_factionData == "IND_G_F" && {uniform _unit == "U_IG_Guerilla1_1"} && {random 10 > 5} ) then { _unit setObjectTextureGlobal [0, _fiaFatigues]; _unit setobjectTextureGlobal [1, "#(argb,8,8,3)color(0.33,0.31,0.24,0.3)"] }; _unit addVest selectRandom (_factionData #3); There is no delay whatever the key (faction here) could be. Of course, it's a dirty example. Adapt and mind for the arrays and the global structure of the hashmap. Have fun 1 Share this post Link to post Share on other sites
Larrow 2803 Posted April 26 Why init.sqf ? So this is happening everywhere! Should just be initServer.sqf and then remoteExec the loadout script to where the unit is local, due to some of the commands being LA. //initServer.sqf // detect and change all editor placed units { [_x] call CB_fnc_factionConfig; } forEach ( allUnits select { _x isKindOf "CAManBase" && { !isPlayer _x }} ); // add MEH to catch anything spawned CB_MEH_factions = addMissionEventHandler ["EntityCreated", { params ["_entity"]; if ( _entity isKindOf 'CAManBase' && { !isPlayer _entity }) then {[_entity] call CB_fnc_factionConfig}; }]; //CB_fnc_factionConfig // handles params[ "_unit" ]; //Everything here will already be CAManBase and !player //ignore special units with this variable // factions to re-paint private _scriptName = switch ( faction _unit ) do { case ( "BLU_F" ) : { "BLUFORnato" }; case ( "BLU_CTRG_F" ) : { "BLUFORspecops" }; case ( "BLU_G_F" ) : { "BLUFORion" }; case ( "OPF_F" ) : { "OPFORcsat" }; case ( "OPF_R_F" ) : { "OPFORspecops" }; case ( "IND_G_F" ) : { "INDFORfia" }; case ( "IND_C_F" ) : { "INDFORspecops" }; case ( "CIV_F" ) : { "CIV" }; }; [ _unit ] remoteExec[ format[ "CB_fnc_loadout_%1", _scriptName ], _unit ]; 1 Share this post Link to post Share on other sites
Raider_18 4 Posted April 26 _bigThanks = "Many thanks, you guys are awesome!! 😁"; _homies = getPos (Pierremgi && @Larrow); _message = _bigThanks deliverTo _homies; Will reconfigure and I am learning alot by your examples. Thanks to you both. Will try to post an example mission with it cleaned up soon, so others can take an inside look. Share this post Link to post Share on other sites