Marve_XT 12 Posted September 2, 2014 alright i have created some unit lately ( a driver) the problem is that all drivers looks the same , & it looks really bad in Armed offroads , driver & gunner do look like identical twins ;) i tried the Randomizing script i found in A3 folder for the offroad cars (randomize.sqf) & tweaked it to be like this : if (server) then { if !(_this getVariable ["BIS_enableRandomization",true]) exitWith {}; _this setObjectTextureGlobal [0, ["\is_all\data\IS_driver.paa", "\is_all\data\IS_driver.paa", "\is_all\data\IS_casual.paa"] select _rnd1]; _this setObjectTextureGlobal [1, ["\is_all\data\IS_driver.paa", "\is_all\data\IS_driver.paa", "\is_all\data\IS_sports.paa"] select _rnd1]; }; but it didnt work , units remained the same :( Share this post Link to post Share on other sites
ante185 2 Posted September 2, 2014 this is for random uniforms, helmets and vests + adds a the ACP at random to the unit /* File: randomize_equipment.sqf Author: pettka, modified for a different purpose by "ante" Description: Randomizes a headgear form _headgear array and puts it to civilian's headgear slot upon startup of mission. _rnd1 is used to have some civilians without any headgear _rnd2 is used to determine particular headgear from array Parameter(s): None Returns: Nothing */ _uniform = ["U_B_CombatUniform_mcam", "U_B_CombatUniform_sgg_vest", "U_B_CombatUniform_mcam_worn", "U_BG_Guerilla1_1", "U_BG_Guerilla2_1", "U_BG_Guerilla2_2", "U_BG_Guerilla3_1", "U_BG_leader", "U_I_CombatUniform_shortsleeve", "U_I_CombatUniform", "U_I_OfficerUniform"]; _headgear = ["H_MilCap_dgtl", "H_Shemag_khk", "H_Beret_blk", "H_Booniehat_dgtl", "H_Booniehat_mcamo", "H_HelmetB", "H_HelmetB_paint", "H_HelmetIA", "H_HelmetIA_net", "H_HelmetSpecB_paint2", "H_HelmetCrew_I"]; _vest = ["V_TacVestCamo_khk", "V_TacVestIR_blk", "V_TacVestIR_blk", "V_Rangemaster_belt", "V_BandollierB_blk", "V_BandollierB_oli", "V_BandollierB_rgr", "V_Chestrig_blk", "V_HarnessO_brn", "V_Rangemaster_belt", "V_TacVest_blk"]; _headCount = count _headgear; _uniformCount = count _uniform; _vestCount = count _vest; if (isServer) then { BIS_randomSeed1 = []; BIS_randomSeed2 = []; _rnd1 = floor random _uniformCount; _this setVariable ["BIS_randomSeed1", _rnd1, TRUE]; _rnd2 = floor random _headCount; _this setVariable ["BIS_randomSeed2", _rnd2, TRUE]; }; waitUntil {!(isNil {_this getVariable "BIS_randomSeed1"})}; waitUntil {!(isNil {_this getVariable "BIS_randomSeed2"})}; _randomSeed1 = _this getVariable "BIS_randomSeed1"; _randomSeed2 = _this getVariable "BIS_randomSeed2"; _magazines = magazines _this; _items = items _this; // Medkits, ToolKits etc. _assitems = assignedItems _this; // NVG's, GPS etc. if (true) then { Removeuniform _this; Removeheadgear _this; Removevest _this; _this adduniform (_uniform select _randomSeed1); _this addheadgear (_headgear select _randomSeed2); _this addvest (_vest select (((_randomSeed1 + _randomSeed2) % (_vestCount - 1)) * (floor random _vestCount) % (_vestCount + 1 ))); }; {_this addItem _x} forEach _items; {_this addMagazine _x} forEach _magazines; {_this addItem _x} forEach _assitems; {_this assignItem _x} forEach _assitems; if (0.5 > _randomSeed1 / _headCount) then { _this addmagazine ("9Rnd_45ACP_Mag"); _this addweapon ("hgun_ACPC2_F"); _this addmagazine ("9Rnd_45ACP_Mag"); _this addmagazine ("9Rnd_45ACP_Mag"); _this addmagazine ("9Rnd_45ACP_Mag"); }; Here's a crude random weapons version of this /* File: randomize_equipment.sqf Author: pettka, modified for a different purpose by "ante" Description: Randomizes a headgear form _headgear array and puts it to civilian's headgear slot upon startup of mission. _rnd1 is used to have some civilians without any headgear _rnd2 is used to determine particular headgear from array Parameter(s): None Returns: Nothing */ _magazines = magazines _this; _items = items _this; // Medkits, ToolKits etc. _assitems = assignedItems _this; // NVG's, GPS etc. _weaponlist = ["arifle_mx_f", "arifle_Katiba_F", "arifle_MXC_F", "arifle_Katiba_C_F", "srifle_DMR_01_F", "arifle_MXM_F", "arifle_SDAR_F", "arifle_TRG20_F", "arifle_TRG21_F", "LMG_Zafir_F", "SMG_02_F", "hgun_PDW2000_snds_F", "arifle_Mk20C_plain_F", "arifle_Mk20_F"]; _headCount = count _weaponlist; if (isServer) then { BIS_randomSeed1 = []; BIS_randomSeed2 = []; _rnd1 = floor random 3; _this setVariable ["BIS_randomSeed1", _rnd1, TRUE]; _rnd2 = floor random _headCount; _this setVariable ["BIS_randomSeed2", _rnd2, TRUE]; }; waitUntil {!(isNil {_this getVariable "BIS_randomSeed1"})}; waitUntil {!(isNil {_this getVariable "BIS_randomSeed2"})}; _randomSeed1 = _this getVariable "BIS_randomSeed1"; _randomSeed2 = _this getVariable "BIS_randomSeed2"; _getweapon = (_weaponlist select _randomSeed2); /* loaded magazine */ switch (_getweapon) do { case "arifle_mx_f": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "arifle_Katiba_F": {_this addmagazine "30Rnd_65x39_caseless_green"}; case "arifle_MXC_F": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "arifle_Katiba_C_F": {_this addmagazine "30Rnd_65x39_caseless_green"}; case "arifle_MXM_F": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "srifle_DMR_01_F": {_this addmagazine "10Rnd_762x51_Mag"}; case "arifle_SDAR_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_TRG20_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_TRG21_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "LMG_Zafir_F": {_this addmagazine "150Rnd_762x51_Box"}; case "SMG_02_F": {_this addmagazine "30Rnd_9x21_Mag"}; case "hgun_PDW2000_snds_F": {_this addmagazine "30Rnd_9x21_Mag"}; case "arifle_Mk20C_plain_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_Mk20_F": {_this addmagazine "30Rnd_556x45_Stanag"}; }; if (_randomSeed1 < 6) then { _this addweapon (_getweapon); _this addmagazine ("9Rnd_45ACP_Mag"); _this addweapon ("hgun_ACPC2_F"); }; /* magazine 1 */ switch (_getweapon) do { case "arifle_mx_f": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "arifle_Katiba_F": {_this addmagazine "30Rnd_65x39_caseless_green"}; case "arifle_MXC_F": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "arifle_Katiba_C_F": {_this addmagazine "30Rnd_65x39_caseless_green"}; case "arifle_MXM_F": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "srifle_DMR_01_F": {_this addmagazine "10Rnd_762x51_Mag"}; case "arifle_SDAR_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_TRG20_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_TRG21_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "LMG_Zafir_F": {_this addmagazine "150Rnd_762x51_Box"}; case "SMG_02_F": {_this addmagazine "30Rnd_9x21_Mag"}; case "hgun_PDW2000_snds_F": {_this addmagazine "30Rnd_9x21_Mag"}; case "arifle_Mk20C_plain_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_Mk20_F": {_this addmagazine "30Rnd_556x45_Stanag"}; }; /* magazine 2 */ switch (_getweapon) do { case "arifle_mx_f": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "arifle_Katiba_F": {_this addmagazine "30Rnd_65x39_caseless_green"}; case "arifle_MXC_F": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "arifle_Katiba_C_F": {_this addmagazine "30Rnd_65x39_caseless_green"}; case "arifle_MXM_F": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "srifle_DMR_01_F": {_this addmagazine "10Rnd_762x51_Mag"}; case "arifle_SDAR_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_TRG20_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_TRG21_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "LMG_Zafir_F": {_this addmagazine "150Rnd_762x51_Box"}; case "SMG_02_F": {_this addmagazine "30Rnd_9x21_Mag"}; case "hgun_PDW2000_snds_F": {_this addmagazine "30Rnd_9x21_Mag"}; case "arifle_Mk20C_plain_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_Mk20_F": {_this addmagazine "30Rnd_556x45_Stanag"}; }; /* magazine 3 */ switch (_getweapon) do { case "arifle_mx_f": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "arifle_Katiba_F": {_this addmagazine "30Rnd_65x39_caseless_green"}; case "arifle_MXC_F": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "arifle_Katiba_C_F": {_this addmagazine "30Rnd_65x39_caseless_green"}; case "arifle_MXM_F": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "srifle_DMR_01_F": {_this addmagazine "10Rnd_762x51_Mag"}; case "arifle_SDAR_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_TRG20_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_TRG21_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "LMG_Zafir_F": {_this addmagazine "150Rnd_762x51_Box"}; case "SMG_02_F": {_this addmagazine "30Rnd_9x21_Mag"}; case "hgun_PDW2000_snds_F": {_this addmagazine "30Rnd_9x21_Mag"}; case "arifle_Mk20C_plain_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_Mk20_F": {_this addmagazine "30Rnd_556x45_Stanag"}; }; /* magazine 4 */ switch (_getweapon) do { case "arifle_mx_f": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "arifle_Katiba_F": {_this addmagazine "30Rnd_65x39_caseless_green"}; case "arifle_MXC_F": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "arifle_Katiba_C_F": {_this addmagazine "30Rnd_65x39_caseless_green"}; case "arifle_MXM_F": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "srifle_DMR_01_F": {_this addmagazine "10Rnd_762x51_Mag"}; case "arifle_SDAR_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_TRG20_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_TRG21_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "LMG_Zafir_F": {_this addmagazine "150Rnd_762x51_Box"}; case "SMG_02_F": {_this addmagazine "30Rnd_9x21_Mag"}; case "hgun_PDW2000_snds_F": {_this addmagazine "30Rnd_9x21_Mag"}; case "arifle_Mk20C_plain_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_Mk20_F": {_this addmagazine "30Rnd_556x45_Stanag"}; }; /* magazine 5 */ switch (_getweapon) do { case "arifle_mx_f": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "arifle_Katiba_F": {_this addmagazine "30Rnd_65x39_caseless_green"}; case "arifle_MXC_F": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "arifle_Katiba_C_F": {_this addmagazine "30Rnd_65x39_caseless_green"}; case "arifle_MXM_F": {_this addmagazine "30Rnd_65x39_caseless_mag"}; case "srifle_DMR_01_F": {_this addmagazine "10Rnd_762x51_Mag"}; case "arifle_SDAR_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_TRG20_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_TRG21_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "LMG_Zafir_F": {_this addmagazine "150Rnd_762x51_Box"}; case "SMG_02_F": {_this addmagazine "30Rnd_9x21_Mag"}; case "hgun_PDW2000_snds_F": {_this addmagazine "30Rnd_9x21_Mag"}; case "arifle_Mk20C_plain_F": {_this addmagazine "30Rnd_556x45_Stanag"}; case "arifle_Mk20_F": {_this addmagazine "30Rnd_556x45_Stanag"}; }; How to add it to a unit: class EventHandlers : EventHandlers { init = "(_this select 0) execVM ""\characters_a_pmc\randomize_equipment.sqf"";(_this select 0) execVM ""\characters_a_pmc\randomize_weapons.sqf"""; }; Share this post Link to post Share on other sites
Marve_XT 12 Posted September 3, 2014 ante185 , u r a savior i have digged down google & the forum here with no luck ,but u just made it :) ps : looks like all troops are in there underwears , but that should be fine since i am using ur script without any editing yet , vests & headgear are working well though . Share this post Link to post Share on other sites
Marve_XT 12 Posted September 3, 2014 update : looks like i cant create 2 uniforms for same exact class ,do i have to create a separate class for every separate uniform i 'll create ? Share this post Link to post Share on other sites
ante185 2 Posted September 3, 2014 My script might be a bit outdated, look up in the wiki the command forceadduniform it's something like that and replace addunifom with that Share this post Link to post Share on other sites
Tiskahar 10 Posted September 6, 2014 marven, you need to have a separate uniform class for each uniform model and texture set that you have. You must link them with the appropriate soldier model so that the game can compile a new soldier model with the new uniform at load time. As far as I am aware, uniforms work by switching out the units torso model with the one of the new uniform, and uniforms are not 'laid over' the existing torso model. Share this post Link to post Share on other sites
Marve_XT 12 Posted September 7, 2014 marven, you need to have a separate uniform class for each uniform model and texture set that you have. You must link them with the appropriate soldier model so that the game can compile a new soldier model with the new uniform at load time. As far as I am aware, uniforms work by switching out the units torso model with the one of the new uniform, and uniforms are not 'laid over' the existing torso model. yes i have realized that , thx so much . however the randomization is not working well with vests for some reason , all units wears same vists all the time , even the classes who doesn't have one configured (unlike helmets behavior) . Share this post Link to post Share on other sites
L3TUC3 32 Posted September 7, 2014 (edited) Have you taken a look at BIS_fnc_selectRandom? It can select a random item out of an array. All you have to do is define the arrays of classnames of the stuff you want, have the function pick something, then (force)addX it to the unit. E.g. _hatarray = ["hat1classname","hat2classname","hat3classname"]; _randomhat = _hatarray call BIS_fnc_selectRandom; _unit addHeadgear _randomhat; Edited September 7, 2014 by L3TUC3 Share this post Link to post Share on other sites
Marve_XT 12 Posted September 8, 2014 Have you taken a look at BIS_fnc_selectRandom?It can select a random item out of an array. All you have to do is define the arrays of classnames of the stuff you want, have the function pick something, then (force)addX it to the unit. E.g. _hatarray = ["hat1classname","hat2classname","hat3classname"]; _randomhat = _hatarray call BIS_fnc_selectRandom; _unit addHeadgear _randomhat; hmmmm i am gonna give this a shot , thx man Share this post Link to post Share on other sites