jandrews 116 Posted November 4, 2019 I am not finding much on google regarding this topic. I found some code from 2015 that is throwing an error. may be someone more educated would lend a hand. Code as follows. Description.ext class Extended_Init_EventHandlers { class Man { init = "_this call (compile preprocessFileLineNumbers 'scripts\forceloadouts.sqf')"; }; }; forceloadouts.sqf private "_this"; _this = _this select 0; if ((side _this isEqualTo independent) && (!isPlayer _this)) then { null = [] execVM "scripts\Ailoadouts.sqf"; }; Ailoadouts.sqf private "_this"; _this = _this select 0; { if (typeof _this isEqualTo "I_Soldier_TL_F") then { [_this] execVM "loadouts\Cobra_TL.sqf"}; } forEach units group _this; blah blah blah.... am trying to use a mod that does not have premade AI units and using editor loadouts. The error I am getting is "_this" from Ailoadouts.sqf. not sure if this is a good way to try this nonetheless. Share this post Link to post Share on other sites
dreadpirate 173 Posted November 4, 2019 I did a similar thing myself. Have a look at setSkill.sqf in eos\functions....... // ADD CUSTOM SCRIPTS TO UNIT HERE [_unit] execVM "redressFIA.sqf"; {_x addCuratorEditableObjects [[_unit],true]} forEach allCurators; Share this post Link to post Share on other sites
jandrews 116 Posted November 4, 2019 5 minutes ago, dreadpirate said: I did a similar thing myself. Have a look at setSkill.sqf in eos\functions....... // ADD CUSTOM SCRIPTS TO UNIT HERE [_unit] execVM "redressFIA.sqf"; {_x addCuratorEditableObjects [[_unit],true]} forEach allCurators; would you mind sharing your redress.sqf? mine is from the editor as well. is placing the sqf there all thats needed? Share this post Link to post Share on other sites
dreadpirate 173 Posted November 4, 2019 redressFIA.sqf: Spoiler // [this] execVM "redressFIA.sqf"; if (!isServer) exitWith {}; _unit = _this select 0; _unitType = typeOf _unit; _possibleUniforms = [ "U_IG_Guerilla1_1" ,"U_IG_Guerilla1_1" ,"U_IG_Guerilla1_1" ,"U_IG_Guerilla1_1" ,"U_IG_Guerilla1_1" ,"U_IG_Guerilla1_1" ,"U_IG_Guerilla1_1" ,"U_IG_Guerilla1_1" ,"U_IG_Guerilla2_1" ,"U_IG_Guerilla2_2" ,"U_IG_Guerilla2_3" // ,"U_IG_Guerilla3_1" // ,"U_IG_Guerilla3_2" // ,"U_IG_leader" ,"U_C_Poor_1" // ,"U_C_WorkerCoveralls" // ,"U_C_WorkerCoveralls" // ,"U_C_WorkerCoveralls" // ,"U_C_WorkerCoveralls" ]; _possibleHeads = [ "GreekHead_A3_01" ,"GreekHead_A3_02" ,"GreekHead_A3_03" ,"GreekHead_A3_04" ,"GreekHead_A3_05" ,"GreekHead_A3_06" ,"GreekHead_A3_07" ,"GreekHead_A3_08" ,"GreekHead_A3_09" ]; _possibleVoices = [ "Male01GRE" ,"Male02GRE" ,"Male03GRE" ,"Male04GRE" ,"Male05GRE" ]; _possiblePrimaryWeapons = [ "arifle_TRG21_F" ,"arifle_TRG20_F" ,"arifle_Katiba_F" ,"arifle_Katiba_C_F" ,"arifle_Mk20_plain_F" ,"arifle_Mk20_F" ,"arifle_Mk20C_F" ,"arifle_Mk20C_plain_F" ,"SMG_02_F" ]; _possibleGLWeapons = [ "arifle_TRG21_GL_F" ,"arifle_Katiba_GL_F" ,"arifle_Mk20_GL_F" ,"arifle_Mk20_GL_plain_F" ]; _possibleMarksmanWeapons = [ "srifle_DMR_06_olive_F" ,"srifle_DMR_06_camo_F" ,"srifle_DMR_01_F" ]; _possibleMGs = [ "LMG_Mk200_F" ,"LMG_Zafir_F" ,"MMG_01_tan_F" ]; _possibleHandguns = [ "hgun_ACPC2_F" ,"hgun_Pistol_heavy_01_F" ,"hgun_Pistol_heavy_02_F" ,"hgun_Rook40_F" ]; _possibleLaunchers = [ "launch_NLAW_F" ,"launch_RPG32_F" ]; _possibleVests = [ "V_BandollierB_khk" ,"V_BandollierB_cbr" ,"V_BandollierB_rgr" ,"V_BandollierB_blk" ,"V_BandollierB_oli" ,"V_Chestrig_khk" ,"V_Chestrig_rgr" ,"V_Chestrig_blk" ,"V_Chestrig_oli" ,"V_TacVest_khk" ,"V_TacVest_brn" ,"V_TacVest_oli" ,"V_TacVest_blk" ,"V_TacVest_camo" ]; _possibleBackpacks = [ "B_AssaultPack_rgr" ,"B_Bergen_rgr" ,"B_Carryall_oli" ,"B_AssaultPack_khk" ,"B_FieldPack_oli" ,"B_Kitbag_rgr" ,"B_TacticalPack_rgr" ,"B_TacticalPack_oli" ]; _possibleHeadgear = [ "H_Shemag_khk" ,"H_Shemag_tan" ,"H_Shemag_olive" ,"H_ShemagOpen_khk" ,"H_ShemagOpen_tan" ]; _possibleFacewear = [ "G_Aviator" ,"G_Lowprofile" ,"G_Shades_Black" ,"G_Shades_Blue" ,"G_Shades_Green" ,"G_Shades_Red" ,"G_Spectacles" ,"G_Spectacles_Tinted" ,"G_Sport_Blackred" ,"G_Sport_BlackWhite" ,"G_Sport_Blackyellow" ,"G_Sport_Checkered" ,"G_Sport_Greenblack" ,"G_Sport_Red" ,"G_Squares" ,"G_Squares_Tinted" ,"" ]; _GLSoldiers = [ "B_Soldier_GL_F" ,"B_Soldier_TL_F" ,"O_Soldier_GL_F" ,"O_Soldier_TL_F" ,"I_Soldier_GL_F" ,"I_Soldier_TL_F" ]; _MarksmanSoldiers = [ "B_soldier_M_F" ,"B_spotter_F" ,"B_sniper_F" ,"O_soldier_M_F" ,"O_spotter_F" ,"O_sniper_F" ,"I_soldier_M_F" ,"I_spotter_F" ,"I_sniper_F" ]; _ATSoldiers = [ "B_soldier_LAT_F" ,"B_soldier_AT_F" ,"O_Soldier_LAT_F" ,"O_Soldier_AT_F" ,"O_soldierU_LAT_F" ,"O_soldierU_AT_F" ,"I_Soldier_LAT_F" ,"I_Soldier_AT_F" ]; _MGSoldiers = [ "B_soldier_AR_F" ,"O_Soldier_AR_F" ,"O_soldierU_AR_F" ,"I_Soldier_AR_F" ]; _MedicSoldiers = [ "B_medic_F" ,"O_medic_F" ,"O_soldierU_medic_F" ,"I_medic_F" ]; _RepairSoldiers = [ "B_engineer_F" ,"B_soldier_exp_F" ,"B_soldier_repair_F" ,"O_engineer_F" ,"O_engineer_U_F" ,"O_soldier_exp_F" ,"O_soldierU_exp_F" ,"O_soldier_repair_F" ,"O_soldierU_repair_F" ,"I_engineer_F" ,"I_Soldier_exp_F" ,"I_Soldier_repair_F" ]; _possibleGarmentTextures = [ "\a3\characters_f_gamma\Civil\Data\c_cloth1_black.paa" ,"A3\Characters_F\Civil\Data\c_cloth1_kabeiroi_co.paa" ,"A3\Characters_F\Civil\Data\c_cloth1_bandit_co.paa" ,"\a3\characters_f_gamma\Civil\Data\c_cloth1_brown.paa" ,"A3\Characters_F\Civil\Data\c_cloth1_v3_co.paa" ,"A3\Characters_F\Civil\Data\c_cloth1_v2_co.paa" ,"A3\Characters_F\Civil\Data\c_cloth1_co.paa" ]; _possibleCoverallTextures = [ "\A3\characters_f\common\data\coveralls_bandit_co.paa" ,"\A3\characters_f\common\data\coveralls_black_co.paa" ,"\A3\characters_f\common\data\coveralls_grey_co.paa" ,"\A3\characters_f\common\data\coveralls_urbancamo_co.paa" ]; removeAllWeapons _unit; removeAllAssignedItems _unit; removeAllContainers _unit; removeHeadgear _unit; removeGoggles _unit; _unit setFace (_possibleHeads call Bis_fnc_selectRandom); _unit setSpeaker (_possibleVoices call Bis_fnc_selectRandom); _unit forceAddUniform (_possibleUniforms call Bis_fnc_selectRandom); if ((uniform _unit) == "U_IG_Guerilla1_1") then { _unit setObjectTextureGlobal [0, _possibleGarmentTextures call Bis_fnc_selectRandom]; if (random 1 > 0.7) then { _unit setobjectTextureGlobal [1, "#(argb,8,8,3)color(0.33,0.31,0.24,0.3)"]; //Olive pants and boots }; if (random 1 > 0.7) then { _unit setobjectTextureGlobal [1, "#(argb,8,8,3)color(0.1,0.1,0.1,0.3)"]; //Black pants and boots }; }; if ((uniform _unit) == "U_C_WorkerCoveralls") then { _unit setObjectTextureGlobal [0, _possibleCoverallTextures call Bis_fnc_selectRandom]; }; _unit addVest (_possibleVests call Bis_fnc_selectRandom); _unit addBackpack (_possibleBackpacks call Bis_fnc_selectRandom); _unit addHeadgear (_possibleHeadgear call Bis_fnc_selectRandom); _unit addGoggles (_possibleFacewear call Bis_fnc_selectRandom); {_unit linkItem _x} forEach ["ItemMap","ItemCompass","ItemWatch","ItemRadio"]; _unit addItem "FirstAidKit"; //Add LMG for Autorifleman, otherwise give rifle if (_unitType in _MGSoldiers) then { [_unit, (_possibleMGs call Bis_fnc_selectRandom), 6] call BIS_fnc_addWeapon; } else { if (_unitType in _GLSoldiers) then { {_unit addMagazine "1Rnd_HE_Grenade_shell"} forEach [1,2,3,4,5,6]; [_unit, (_possibleGLWeapons call Bis_fnc_selectRandom), 6] call BIS_fnc_addWeapon; } else { if (_unitType in _MarksmanSoldiers) then { [_unit, (_possibleMarksmanWeapons call Bis_fnc_selectRandom), 6] call BIS_fnc_addWeapon; _unit addPrimaryWeaponItem "optic_Hamr"; } else { [_unit, (_possiblePrimaryWeapons call Bis_fnc_selectRandom), 6] call BIS_fnc_addWeapon; }; }; }; [_unit, (_possibleHandguns call Bis_fnc_selectRandom), 4] call BIS_fnc_addWeapon; //Give AT weapon where appropriate if (_unitType in _ATSoldiers) then { [_unit, (_possibleLaunchers call Bis_fnc_selectRandom), 3] call BIS_fnc_addWeapon; }; //Give Medikit to Medics if (_unitType in _MedicSoldiers) then { _unit addItemToBackpack "Medikit"; {_unit addItemToBackpack "FirstAidKit";} forEach [1,2,3,4,5,6,7,8,9,10]; }; //Give Toolkit to Engineers, etc. if (_unitType in _RepairSoldiers) then { _unit addItemToBackpack "ToolKit"; _unit addItemToBackpack "MineDetector"; {_unit addItemToBackpack "FirstAidKit";} forEach [1,2]; }; {_unit addItem "HandGrenade"; _unit addItem "SmokeShell";} forEach [1,2,3]; _primaryMagazineArray = getArray (configFile >> "CfgWeapons" >> (primaryWeapon _unit) >> "magazines"); _i = 1; while {((load _unit) < 0.4) && (_i < 6)} do { _unit addMagazine (_primaryMagazineArray select 0); _i = _i + 1; }; 1 Share this post Link to post Share on other sites
jandrews 116 Posted November 4, 2019 hey. looks good. just added a whole lot more code for me to filter. have you come across an easy way to use editor made loadouts with EOS? Share this post Link to post Share on other sites
dreadpirate 173 Posted November 4, 2019 2 minutes ago, jandrews said: hey. looks good. just added a whole lot more code for me to filter. have you come across an easy way to use editor made loadouts with EOS? Because it was for enemies, I didn't bother with precise loadouts, but if that's what you want it will be a big script. At that point, you might want to look at creating your own faction. There are some good tools for doing that like the ALIVE Orbatron or Drongo's Config Generator: http://alivemod.com/wiki/index.php/ORBAT_Tool https://steamcommunity.com/sharedfiles/filedetails/?id=1771335720 Share this post Link to post Share on other sites
jandrews 116 Posted November 4, 2019 So the mod I am using already has some things for units like uniforms and helmets. Vanilla arma allows me to match the rest. What I was attempting was use editor saved loadouts for enemy AI and as they spawn in with EOS the loadouts just pass over to the selected units. the mod has vehicles as well. Its Fight for Freedom mod. The code I posted was a few years old and popps an error. Share this post Link to post Share on other sites
GEORGE FLOROS GR 4206 Posted November 4, 2019 44 minutes ago, jandrews said: What I was attempting was use editor saved loadouts for enemy AI Hello there guys ! There are many ways to do this . You can check also here : 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4206 Posted November 4, 2019 2 hours ago, jandrews said: class Extended_Init_EventHandlers { 1 Share this post Link to post Share on other sites
jandrews 116 Posted November 4, 2019 Hey GF. Great find. I will try and decipher that code and see what happens. 2 Share this post Link to post Share on other sites