dr death jm 117 Posted August 18, 2016 this is botching me for a bit, i have a loadout for ai (playable units) , called from a triger... but no matter how i try with EventHandler's it will work in editor but not on dedicated server. in short these are my last examples i tested .. and no go on dedicated {[_x] call JNA_fnc_redressFIA} forEach thisList this addEventHandler["Respawn",{[this,true] call JNA_fnc_redressFIA}]; {[_x] call JNA_fnc_redressFIA} forEach thisList; this addEventHandler["Respawn",{[_this select 0,true] call JNA_fnc_redressFIA}]; with these trigers i also edited them to each units init and still same problem... extra info , playable ai play as if your playing coop, but when player joins he becomes one of the ai, and players use a different loadout type so there are no issues..there... but ai cannot use the players load out do to its opening a dialog.. and is why im trying to get a respawnable loadout for ai... thanks ... Share this post Link to post Share on other sites
DrSova 46 Posted August 19, 2016 {[_x] call JNA_fnc_redressFIA} forEach playableUnits; {_x addEventHandler["Respawn",{[_x,true] call JNA_fnc_redressFIA}];} forEach playableUnits; try this into init.sqf Share this post Link to post Share on other sites
dr death jm 117 Posted August 19, 2016 Thanks ill try it out tonight when i get home. I did ( i think) finally got it working but thru editor units init. So i guess my next question would be , whats better ? Init.sqf or init on units? Or a triger to the side? And thanks again for help above, ill post my results tonight... Share this post Link to post Share on other sites
DrSova 46 Posted August 19, 2016 whats better ? Init.sqf or init on units? Or a triger to the side? In my opinion, triggers and unit's init too much load mission. If you do small mission with 1-3 triggers and about 20 units, then there will be no any problems. But if you need more operations with code, more multithreading, units and functions, it is nessesary to use init.sqf (for server and for client) and etc. Share this post Link to post Share on other sites
dr death jm 117 Posted August 20, 2016 In my opinion, triggers and unit's init too much load mission. If you do small mission with 1-3 triggers and about 20 units, then there will be no any problems. But if you need more operations with code, more multithreading, units and functions, it is nessesary to use init.sqf (for server and for client) and etc. oooofff, i have small like mission but lots of eventhandlers and trigers.. im fighting with mp scripting and jip, i figured trigers were the way to go.. i have the loadout working in this method , i guess i need to stop a min.. and test what you posted before i go to far... thanks again.. Share this post Link to post Share on other sites
dr death jm 117 Posted August 20, 2016 /*MFA redress Updated 16/09/2014 Author: Jona33 edited drdeathjm 8/15/16 Unit background: The Militant Forces for Altis are a splintered paramilitary organisation, supported by the AAF. Although various groups fight under the banner it is split into groups with local affiliations rather than a combined force. They are covertly supported by the AAF who officially deny any involvement, however there is clear evidence to the contrary. The standard weapon they use is the Mk20, in an unpainted form as supplied by the manufacturer, they also have limited numbers of Mk200 LMGs and Mk18 EBRs. They routinely wear the old style of body armour worn by pre-revolution Altian Forces. More importantly they have been linked to numerous crimes, what they lack in military organisation and discipline they make up for in sheer viciousness. Indiscriminate killings and violent abuse of prisoners under the pretext of defending their area from FIA guerillas. Due to the fear of reprisals against their families if recognised they will nearly always cover their faces to minimise this risk. Parameters 0: Unit (OBJECT): the unit that will recieve the loadout 1: Greek Identity (BOOLEAN)-OPTIONAL: Whether or not that a Greek voice and face will be assigned to a unit, Can be True or False. (Should be set to false when that character has a set identity. If set to true the voice and face will be random each time). Default: True. 2: Random Uniform (BOOLEAN)-OPTIONAL: Whether or not random uniform is used, default true, Can be True or False. Examples: [this] call JNA_fnc_redressMFA; -Will give MFA equipment, a greek identity and random uniform, headgear and goggles. IMPORTANT NOTE: Certain classes have set properties, e.g. giving a unit a CLS loadout will not make them able to use a medikit, the same goes for engineers and explosive specialists. */ Private ["_unit","_GREIdent","_Randomise","_role","_Uniforms","_Voice","_Uniform","_Headgear","_Goggles"]; _unit=[_this,0,objNull,[ObjNull]] call Bis_fnc_Param; _GREIdent=[_this,1,true,[true]] call Bis_fnc_Param; _Randomise=[_this,2,true,[true]] call Bis_fnc_Param; _role=typeOf _unit; //Define Valid Clothing Items _Uniforms=["U_BG_Guerilla1_1","U_BG_Guerilla2_1","U_BG_Guerilla2_2","U_BG_Guerilla2_3","U_BG_Guerilla3_1","U_BG_Guerilla3_2","U_BG_Guerrilla_6_1"]; _PossHeadgear=["H_Watchcap_blk","H_Watchcap_cbr","H_Watchcap_camo","H_Watchcap_sgg","H_Watchcap_khk","H_Shemag_khk","H_Shemag_olive","H_Shemag_tan","H_ShemagOpen_khk","H_ShemagOpen_tan","H_Bandanna_khk"]; _PossGoggles=["G_Balaclava_blk","G_Balaclava_oli","G_Bandanna_blk","G_Bandanna_khk","G_Bandanna_oli","G_Bandanna_tan"]; //Disable BIS randomisation _unit setVariable ["BIS_enableRandomization", false]; //Define and set Greek Voices and Faces if (_GREIdent) then { _Voice=["Male01GRE","Male02GRE","Male03GRE","Male04GRE","Male05GRE"] call Bis_fnc_SelectRandom; _Unit setSpeaker _Voice; _Face=["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"] call Bis_fnc_SelectRandom; _Unit setFace _Face; }; //Detect if unit is in vehicle if (_unit isKindOf "LandVehicle"||_unit isKindOf "Ship_F") exitWith {{[_x] call JNA_Fnc_RedressMFA;} forEach crew _unit;}; _RemoveItems = { removeAllWeapons _unit; removeAllAssignedItems _unit; removeAllContainers _unit; removeHeadgear _unit; removeGoggles _unit; }; _AddClothing = { if (_Randomise) then { _Uniform=_Uniforms call Bis_fnc_selectRandom; _Goggles=_PossGoggles call Bis_fnc_selectRandom; _Headgear=_PossHeadgear call Bis_fnc_selectRandom; } else { _Uniform=(_ClothingArray select 0); _Goggles=(_ClothingArray select 4); }; _unit forceAddUniform _Uniform; _unit addVest (_ClothingArray select 1); _unit addBackpack (_ClothingArray select 2); _unit addHeadgear (_ClothingArray select 3); _unit addGoggles _Goggles; }; _AddWeapons = { {[_unit,_x select 0,1] call Bis_fnc_AddWeapon;} forEach _Weapons; removeAllPrimaryWeaponItems _unit; removeAllHandgunItems _unit; if (primaryWeapon _unit !="") then {{if (_x != "") then {_unit addPrimaryWeaponItem _x};} forEach ((_Weapons select 0) select 2)}; if (handgunWeapon _unit !="") then {{if (_x != "") then {_unit addHandgunItem _x};} forEach ((_Weapons select 1) select 2)}; if (secondaryWeapon _unit !="") then {{if (_x != "") then {_unit addSecondaryWeaponItem _x};} forEach ((_Weapons select 2) select 2)}; }; switch (true) do { case (_role == "I_Soldier_F"): { //Removal [] call _removeItems; //Clothing _ClothingArray=["U_BG_Guerilla1_1","V_TacVestIR_blk","B_Carryall_mcamo","H_Watchcap_camo","G_Bandanna_oli"]; [] call _AddClothing; //Uniform Items _UniformItems=[["30Rnd_556x45_Stanag",2],["FirstAidKit",1]]; {for "_i" from 1 to (_x select 1) do {_unit addItemToUniform (_x select 0)};} forEach _UniformItems; //Vest Items _VestItems=[["SmokeShellGreen",1],["Chemlight_blue",1],["30Rnd_556x45_Stanag",5],["HandGrenade",2]]; {for "_i" from 1 to (_x select 1) do {_unit addItemToVest (_x select 0)};} forEach _VestItems; //Backpack Items _BackpackItems=[["MiniGrenade",5],["FirstAidKit",2],["HandGrenade",2],["SmokeShell",4]]; clearAllItemsFromBackpack _unit; {for "_i" from 1 to (_x select 1) do {_unit addItemToBackpack (_x select 0)};} forEach _BackpackItems; //Weapons _Weapons=[["arifle_Mk20_plain_F","30Rnd_556x45_Stanag",["","acc_flashlight",""]]]; if (count _Weapons > 0) then {[] call _AddWeapons;}; //Items {_unit linkItem _x} forEach ["ItemMap","ItemCompass","ItemWatch","ItemRadio"]; }; case (_role == "I_soldier_GL_F"): { //Removal [] call _removeItems; //Clothing _ClothingArray=["U_BG_Guerilla2_1","V_TacVestIR_blk","B_Carryall_mcamo","H_Watchcap_sgg","G_Balaclava_oli"]; [] call _AddClothing; //Uniform Items _UniformItems=[["30Rnd_556x45_Stanag",2],["FirstAidKit",1]]; {for "_i" from 1 to (_x select 1) do {_unit addItemToUniform (_x select 0)};} forEach _UniformItems; //Vest Items _VestItems=[["HandGrenade",2],["SmokeShellBlue",1],["SmokeShellGreen",1],["Chemlight_blue",2],["30Rnd_556x45_Stanag",4],["UGL_FlareGreen_F",5],["1Rnd_Smoke_Grenade_shell",1],["MiniGrenade",1]]; {for "_i" from 1 to (_x select 1) do {_unit addItemToVest (_x select 0)};} forEach _VestItems; //Backpack Items _BackpackItems=[["1Rnd_HE_Grenade_shell",5],["FirstAidKit",2],["HandGrenade",2],["SmokeShell",4]]; clearAllItemsFromBackpack _unit; {for "_i" from 1 to (_x select 1) do {_unit addItemToBackpack (_x select 0)};} forEach _BackpackItems; //Weapons _Weapons=[["arifle_Mk20_GL_plain_F","30Rnd_556x45_Stanag",["","acc_flashlight",""]]]; if (count _Weapons > 0) then {[] call _AddWeapons;}; //Items {_unit linkItem _x} forEach ["ItemMap","ItemCompass","ItemWatch","ItemRadio"]; }; }; this is example of 1 side , and im using this in units init [this,true] call JNA_Fnc_RedressBrit; this addEventHandler ["Respawn", {[_this select 0] call JNA_Fnc_RedressBrit}]; _nil = this execVM "SA\functions\main\fn_remNvAddLight.sqf"; this addEventHandler ["Respawn",{_this execVM "SA\functions\main\fn_remNvAddLight.sqf"}]; this addMPEventHandler ["MPRespawn", {_this spawn TAG_BodyDelete}]; this addMPEventHandler ["MPKilled",{removeAllWeapons (call TAG_RemoveWeapons)}]; this addEventHandler["Respawn",{[player] call fnc_setPgunHandle}]; this addEventHandler ["Killed",{_this execVM "deathScript.sqf"}]; Share this post Link to post Share on other sites
Beerkan 71 Posted August 20, 2016 You don't need to faff about in the units init. Put something like this in your init.sqf Fnc_Unit_Init = {_ _unit = _this select 0; [_unit,true] call JNA_Fnc_RedressBrit; _unit addEventHandler ['Respawn', {[_this select 0] call JNA_Fnc_RedressBrit}]; 0 = _unit execVM 'SA\functions\main\fn_remNvAddLight.sqf'; _unit addEventHandler ['Respawn',{_this select 0 execVM 'SA\functions\main\fn_remNvAddLight.sqf'}]; _unit addMPEventHandler ['MPRespawn', {_this select 0 spawn TAG_BodyDelete}]; _unit addMPEventHandler ['MPKilled',{removeAllWeapons (call TAG_RemoveWeapons)}]; _unit addEventHandler['Respawn',{[player] call fnc_setPgunHandle}]; _unit addEventHandler ['Killed',{_this select 0 execVM 'deathScript.sqf'}]; }; And to add this to all units you want, add this in your init.sqf after the above // Enable Loadouts // {if (_x IsKindof 'Man' && faction _x isEqualTo 'BLU_CTRG_F') //Tanoa {if (_x IsKindof 'Man' && faction _x isEqualTo 'BLU_F') //Altis/Chernaraus/Stratis then{ [_x] spawn Fnc_Unit_Init; }; // } foreach _myGroup;// All Units in your group. } foreach allunits;// All Blufor Units You might need to adjust Fnc_Unit_Init to suit your own requirements, but hopefully you get the idea. If you need to change the faction, here's the list Factions can be one of the following West: "BLU_F" (NATO), "BLU_G_F" (FIA), "BLU_CTRG_F" (NATO CTRG Tanoa), "BLU_GEN_F" (POLICE Tanoa) East: "OPF_F" (CSAT), "OPF_G_F" (FIA), "OPF_T_F" (CSAT Tanoa) Guer: "IND_F" (AAF), "IND_G_F" (FIA), "IND_C_F" (SYNDIKAT Tanoa) Civ: "CIV_F" (Civilians) Share this post Link to post Share on other sites
dr death jm 117 Posted August 20, 2016 wow nice, i was looking into how to do above, and or start making a lot of fnc.cfg.. ill start working on this now... maybe you could help me with my other issue that keeps showing up, server object errors.. ive got it down to whether object is loading from server or local.. problem is i have no clue, i keep getting lost as i edit.. and changing 1 this at a time and loading back on server is making wanna sleep for a few days..., Share this post Link to post Share on other sites
dr death jm 117 Posted August 21, 2016 ok what i did .......... imade,in a folder (named) Unit_Init. in side folder= cfgfunctions.hpp , Unit_init_Brit.sqf , Unit_init_CSAT.sqf , Unit_init_MFA.sqf. included cfgfunctions in description, call compiled the unit_inits, and edited the code you posted to this... Fnc_Unit_Init_Brit = { params ["_Unit"]; [_Unit,true] call JNA_Fnc_RedressBrit; _Unit addEventHandler ['Respawn', {[_this select 0] call JNA_Fnc_RedressBrit}]; 0 = _Unit execVM 'SA\functions\main\fn_remNvAddLight.sqf'; _Unit addEventHandler ['Respawn',{_this select 0 execVM 'SA\functions\main\fn_remNvAddLight.sqf'}]; _Unit addMPEventHandler ['MPRespawn', {_this spawn TAG_BodyDelete}]; _Unit addMPEventHandler ['MPKilled',{removeAllWeapons (call TAG_RemoveWeapons)}]; _Unit addEventHandler['Respawn',{[player] call fnc_setPgunHandle}]; _Unit addEventHandler ['Killed',{_this execVM 'deathScript.sqf'}]; }; // Enable Loadouts // {if (_x IsKindof 'Man' && faction _x isEqualTo 'BLU_CTRG_F') //Tanoa {if (_x IsKindof 'Man' && faction _x isEqualTo 'BLU_G_F') //Altis/Chernaraus/Stratis then{ [_x] spawn Fnc_Unit_Init_Brit; }; // } foreach _myGroup;// All Units in your group. } foreach allunits;// All Blufor Units i had to edit also body delete , remove weapons, and death script.. so far quick test , seems all is working... i just need to do a better extensive test.. but it awesome.. thanks for the help Share this post Link to post Share on other sites
dr death jm 117 Posted August 21, 2016 new errors 21:49:47 Server: Object info 2:1127 not found. 21:49:47 Can't change owner from 0 to 679587901 21:49:47 Server: Object info 2:1128 not found. 21:49:47 Can't change owner from 0 to 679587901 21:49:47 Server: Object info 2:1129 not found. 21:49:47 Can't change owner from 0 to 679587901 21:49:47 ../lib/Network/networkServer.cpp OnClientStateChanged:NOT IMPLEMENTED - briefing! 21:49:47 Trying to add inventory item with empty name to object [Grenadier] Share this post Link to post Share on other sites