Larrow 2823 Posted April 20, 2014 Can anyone identify why the "["BIS_fnc_spawn", true] call BIS_fnc_MP;" portion doesn't work?You syntax for BIS_fnc_spawn is slightly wrong. [ [_this, { _this adduniform "U_PMC_CombatUniformRS_BSGPBB";}], "BIS_fnc_spawn", true] call BIS_fnc_MP; [ [params to use, {code to spawn}], "BIS_fnc_spawn"....... Something like below should look a lot cleaner and save all those switch cases.. _uniforms = [ "U_PMC_CombatUniformRS_BSGPBB", "U_PMC_CombatUniformRS_BSGPSB", "U_PMC_CombatUniformRS_BSSPBB", "U_PMC_CombatUniformRS_BSSPSB", "U_PMC_CombatUniformRS_GSBPBB", "U_PMC_CombatUniformRS_GSSPBB", "U_PMC_CombatUniformRS_IndPBSBB", "U_PMC_CombatUniformRS_SSBPBB", "U_PMC_CombatUniformRS_SSGPBB", "U_PMC_CombatUniformRS_SSGPSB", "U_PMC_CombatUniformRS_ChckDBS_GPSB", "U_PMC_CombatUniformRS_ChckLB_GPBB", "U_PMC_CombatUniformRS_ChckLR_SPBB", "U_PMC_CombatUniformRS_ChckP_BPBB", "U_PMC_CombatUniformLS_BSGPBB", "U_PMC_CombatUniformLS_BSGPSB", "U_PMC_CombatUniformLS_BSSPBB", "U_PMC_CombatUniformLS_BSSPSB", "U_PMC_CombatUniformLS_GSBPBB", "U_PMC_CombatUniformLS_GSSPBB", "U_PMC_CombatUniformLS_IndPBSBB", "U_PMC_CombatUniformLS_SSBPBB", "U_PMC_CombatUniformLS_SSGPBB", "U_PMC_CombatUniformLS_SSGPSB", "U_PMC_CombatUniformLS_ChckDBS_GPSB", "U_PMC_CombatUniformLS_ChckLB_GPBB", "U_PMC_CombatUniformLS_ChckLR_SPBB", "U_PMC_CombatUniformLS_ChckP_BPBB" ]; _uniform = _uniforms select (floor (random (count _uniforms))); [ [ [_this, _uniform], {(_this select 0) addUniform (_this select 1);} ], "BIS_fnc_spawn", true] call BIS_fnc_MP; Share this post Link to post Share on other sites
kilo1-1 1 Posted April 21, 2014 (edited) Great news! Thanks so much for this addition, Larrow! With this new method of using BIS_fnc_spawn, the player and AI units have their uniforms locally (before they didn't). Unfortunately, when I put this edited .pbo up on my dedicated server, when there is a JIP player that happens to join, all uniforms are lost again. Additionally, on a few occasions when I started a mission where my team are PG PMCs, our characters didn't have a uniform. But when there aren't any JIP players, the AI PG units have their uniforms, which is great! Since I am still very new to scripting, I cannot identify what is causing these issues. Would you happen to have a workaround for these two issues? I apologize for all these scripts but since the mod creator abandoned the project, this is what I have to work with. randomize_CombatUniform.sqf if (isServer) then { waitUntil {!isNull _this}; }; _magazines = magazines _this; _items = items _this; // Medkits, ToolKits etc. _assitems = assignedItems _this; // NVG's, GPS etc. Removeuniform _this; Removevest _this; removeAllItems _this; //------------ Uniforms ------------ _uniforms = [ "U_PMC_CombatUniformRS_BSGPBB", "U_PMC_CombatUniformRS_BSGPSB", "U_PMC_CombatUniformRS_BSSPBB", "U_PMC_CombatUniformRS_BSSPSB", "U_PMC_CombatUniformRS_GSBPBB", "U_PMC_CombatUniformRS_GSSPBB", "U_PMC_CombatUniformRS_IndPBSBB", "U_PMC_CombatUniformRS_SSBPBB", "U_PMC_CombatUniformRS_SSGPBB", "U_PMC_CombatUniformRS_SSGPSB", "U_PMC_CombatUniformRS_ChckDBS_GPSB", "U_PMC_CombatUniformRS_ChckLB_GPBB", "U_PMC_CombatUniformRS_ChckLR_SPBB", "U_PMC_CombatUniformRS_ChckP_BPBB", "U_PMC_CombatUniformLS_BSGPBB", "U_PMC_CombatUniformLS_BSGPSB", "U_PMC_CombatUniformLS_BSSPBB", "U_PMC_CombatUniformLS_BSSPSB", "U_PMC_CombatUniformLS_GSBPBB", "U_PMC_CombatUniformLS_GSSPBB", "U_PMC_CombatUniformLS_IndPBSBB", "U_PMC_CombatUniformLS_SSBPBB", "U_PMC_CombatUniformLS_SSGPBB", "U_PMC_CombatUniformLS_SSGPSB", "U_PMC_CombatUniformLS_ChckDBS_GPSB", "U_PMC_CombatUniformLS_ChckLB_GPBB", "U_PMC_CombatUniformLS_ChckLR_SPBB", "U_PMC_CombatUniformLS_ChckP_BPBB" ]; _uniform = _uniforms select (floor (random (count _uniforms))); [ [ [_this, _uniform], {(_this select 0) addUniform (_this select 1);} ], "BIS_fnc_spawn", true] call BIS_fnc_MP; //------------ Body Armour ------------ _armour = (ceil (random 6)); switch (_armour ) do { case 1: { _this addvest "V_PlateCarrier1_PMC_rgr"; }; case 2: { _this addvest "V_PlateCarrier1_PMC_blk"; }; case 3: { _this addvest "V_PlateCarrier1_PMC_marpat"; }; case 4: { _this addvest "V_PlateCarrier1_PMC_khki"; }; case 5: { _this addvest "V_PlateCarrierInd_PMC_blk"; }; case 6: { _this addvest "V_PlateCarrierInd_PMC_grn"; }; }; Removeheadgear _this; //------------ Helmet/Hat ------------ _hat = (ceil (random 4)); switch (_hat ) do { case 1: { _this addheadgear "H_Cap_pmc"; }; case 2: { _this addheadgear "H_Cap_tan_pmc"; }; case 3: { _this addheadgear "H_HelmetB_plain_blk"; }; case 4: {}; }; {_this addItem _x} forEach _items; {_this addMagazine _x} forEach _magazines; {_this addItem _x} forEach _assitems; {_this assignItem _x} forEach _assitems; randomize_PoloCargoPants.sqf if (isServer) then { waitUntil {!isNull _this}; }; _magazines = magazines _this; _items = items _this; // Medkits, ToolKits etc. _assitems = assignedItems _this; // NVG's, GPS etc. Removeuniform _this; Removevest _this; removeAllItems _this; //------------ Uniforms ------------ _uniforms = [ "U_PMC_BluPolo_BgPants", "U_PMC_BgPolo_GrnPants", "U_PMC_BlckPolo_BgPants", "U_PMC_BlckPolo_BluPants", "U_PMC_BluPolo_GrnPants", "U_PMC_BrnPolo_BgPants", "U_PMC_BrnPolo_BluPants", "U_PMC_GrnPolo_BgPants", "U_PMC_WhtPolo_BgPants", "U_PMC_WhtPolo_BluPants", "U_PMC_WhtPolo_GrnPants" ]; _uniform = _uniforms select (floor (random (count _uniforms))); [ [ [_this, _uniform], {(_this select 0) addUniform (_this select 1);} ], "BIS_fnc_spawn", true] call BIS_fnc_MP; //------------ Body Armour ------------ _armour = (ceil (random 6)); switch (_armour ) do { case 1: { _this addvest "V_PlateCarrier1_PMC_rgr"; }; case 2: { _this addvest "V_PlateCarrier1_PMC_blk"; }; case 3: { _this addvest "V_PlateCarrier1_PMC_marpat"; }; case 4: { _this addvest "V_PlateCarrier1_PMC_khki"; }; case 5: { _this addvest "V_PlateCarrierInd_PMC_blk"; }; case 6: { _this addvest "V_PlateCarrierInd_PMC_grn"; }; }; Removeheadgear _this; //------------ Helmet/Hat ------------ _hat = (ceil (random 4)); switch (_hat ) do { case 1: { _this addheadgear "H_Cap_pmc"; }; case 2: { _this addheadgear "H_Cap_tan_pmc"; }; case 3: { _this addheadgear "H_HelmetB_plain_blk"; }; case 4: {}; }; {_this addItem _x} forEach _items; {_this addMagazine _x} forEach _magazines; {_this addItem _x} forEach _assitems; {_this assignItem _x} forEach _assitems; randomize_Shirt_Cords.sqf if (isServer) then { waitUntil {!isNull _this}; Removeuniform _this; }; //------------ Uniforms ------------ _uniforms = [ "U_PMC_BluePlaidShirt_BeigeCords", "U_PMC_RedPlaidShirt_DenimCords", "U_PMC_BlackPoloShirt_BeigeCords" ]; _uniform = _uniforms select (floor (random (count _uniforms))); [ [ [_this, _uniform], {(_this select 0) addUniform (_this select 1);} ], "BIS_fnc_spawn", true] call BIS_fnc_MP; randomize_TShirtJeans.sqf if (isServer) then { waitUntil {!isNull _this}; }; _magazines = magazines _this; _items = items _this; // Medkits, ToolKits etc. _assitems = assignedItems _this; // NVG's, GPS etc. Removeuniform _this; Removevest _this; removeAllItems _this; //------------ Uniforms ------------ _uniforms = [ "U_PMC_GTShirt_DJeans", "U_PMC_GTShirt_SJeans", "U_PMC_BlkTShirt_DJeans", "U_PMC_BlkTShirt_SJeans", "U_PMC_WTShirt_DJeans", "U_PMC_BluTShirt_SJeans" ]; _uniform = _uniforms select (floor (random (count _uniforms))); [ [ [_this, _uniform], {(_this select 0) addUniform (_this select 1);} ], "BIS_fnc_spawn", true] call BIS_fnc_MP; //------------ Body Armour ------------ _armour = (ceil (random 6)); switch (_armour ) do { case 1: { _this addvest "V_PlateCarrier1_PMC_rgr"; }; case 2: { _this addvest "V_PlateCarrier1_PMC_blk"; }; case 3: { _this addvest "V_PlateCarrier1_PMC_marpat"; }; case 4: { _this addvest "V_PlateCarrier1_PMC_khki"; }; case 5: { _this addvest "V_PlateCarrierInd_PMC_blk"; }; case 6: { _this addvest "V_PlateCarrierInd_PMC_grn"; }; }; {_this addItem _x} forEach _items; {_this addMagazine _x} forEach _magazines; {_this addItem _x} forEach _assitems; {_this assignItem _x} forEach _assitems; Edited April 21, 2014 by Kilo1-1 Share this post Link to post Share on other sites
Magirot 14 Posted May 12, 2014 (edited) For Kilo1-1's problem above: with AI, all you need is to make sure the server (and only the server) manages to execute all relevant stuff before the players get into that phase. A function containing an isServer check run from the unit's init field works great, and doesn't require BIS_fnc_MP, since apparently the data manages to get synced in time. Only executing on the server through a function actually works even with player units, and similarly doesn't need BIS_fnc_MP with addUniform, but this fails on JIP/respawn. 1. First, I'm running from init.sqf a script: /*init.sqf*/ execVM "scripts\client.sqf"; This is meant to run on each client individually. The following is applied to a 16 player PvP/TvT mission, though it's absolutely the same principle with cooperative. I named my units b1,b2,...,o7,o8. /*scripts\client.sqf*/ if !(isDedicated) then { waitUntil { !IsNull Player }; if (local player) then { waitUntil { time > 1 }; switch (faction player) do { case "BLU_F": { [] call compile preprocessFile "scripts\loadouts.sqf";}; case "OPF_F": { [] call compile preprocessFile "scripts\loadoutsopf.sqf";}; }; switch (player) do { case b1: {[b1] call FNC_SL;}; case b2: {[b2] call FNC_RFL1;}; case b3: {[b3] call FNC_RFL2;}; case b4: {[b4] call FNC_GL;}; case b5: {[b5] call FNC_AR;}; case b6: {[b6] call FNC_AMM;}; case b7: {[b7] call FNC_MRK;}; case b8: {[b8] call FNC_MED;}; case o1: {[o1] call FNC_OSL;}; case o2: {[o2] call FNC_AUX;}; case o3: {[o3] call FNC_ORFL1;}; case o4: {[o4] call FNC_ORFL2;}; case o5: {[o5] call FNC_OMRK;}; case o6: {[o6] call FNC_OAR;}; case o7: {[o7] call FNC_OAMM;}; case o8: {[o8] call FNC_OMED;}; }; }; }; Doesn't it cause problems if even one of the units is missing (due to the slot not being selected), because the variable will be undefined? That's what I instantly hit with a similar setup, at least. Edited May 12, 2014 by Magirot Share this post Link to post Share on other sites
rakowozz 14 Posted May 12, 2014 Doesn't it cause problems if even one of the units is missing (due to the slot not being selected), because the variable will be undefined? That's what I instantly hit with a similar setup, at least. I thought it'd cause problems too, but it turns out it doesn't. It does return an undefined variable error, but the functions are called anyways, even if you're "b8" and the only player in. No idea why haha, I suppose it's 'cause of the way switch do works? A quick way to have empty slots become defined, though, is: { if (isNil _x) then { missionNamespace setVariable [_x, objNull]; }; } forEach ["player1","player2","player3","player4"]; Share this post Link to post Share on other sites
coolfact 10 Posted May 22, 2014 Is it possible to make the loadout script, to look at roles instead of names, for example by using setvariable in the units init unit init: this setVariable [ "Loadout", "AR", true ]; and then use the client.sqf to call that role client.sqf: If (!IsDedicated) Then { if (isServer) then { waitUntil {sleep 0.3; !isNull player && time > 0}; }; if (local player) then { [] call compile preprocessFile "loadoutsBlu.sqf"; _role = player getVariable "Loadout"; switch (_role) do { case AR: {[] call TAG_FNC_AR;}; case MEDIC: {[] call TAG_FNC_MEDIC;}; case OSCAR: {[] call TAG_FNC_OSCAR;}; case LEADER: {[] call TAG_FNC_LEADER;}; }; }; }; I'm not that experienced with coding so any help would be much appreciated. Share this post Link to post Share on other sites
Beerkan 71 Posted May 29, 2014 Is....... this...... finally..... fixed... :pray: Fixed: addUniform script command didn't work well in MP I don't believe it... Share this post Link to post Share on other sites
HaZZarD 2 Posted May 29, 2014 WoW, can someone confirm the fix ? : O I also have a question , what's the difference between forceAddUniform and addUniform ? Share this post Link to post Share on other sites
SilentSpike 84 Posted May 29, 2014 Quotes from biki. addUniform: "Create a new uniform and try to link it into uniform slot (given uniform has to be supported by allowedUniforms list of target soldier)." forceAddUniform: "Create a new uniform and hard link it into slot (without any restrictions)." Also worth noting that forceAddUniform might be missing from the latest patch, haven't checked this myself yet. Share this post Link to post Share on other sites
wiggum2 31 Posted May 29, 2014 So whats the difference between add and forceAdd ? Share this post Link to post Share on other sites
sxp2high 23 Posted May 29, 2014 West uniforms can only be worn by west units and so on, from now on. forceAddUniform can circumvent this (weird) restriction. Script command addUniform now only works for uniforms of a units' side. If you were using it on uniforms of a different side in your previous projects, please change the command to forceAddUniform to prevent having naked soldiers in your scenarios! You can also use the new isUniformAllowed command to check if it is actually possible to don the uniform. Source: SITREP #00058 Share this post Link to post Share on other sites
HaZZarD 2 Posted May 30, 2014 Thanks guys So, now that this uniform bug is fixed (true?), what's the ultimate system to make custom loadout which 100% work on spawn and respawn ? what will be your easy and quick way to make custom loadout ? Share this post Link to post Share on other sites
bardosy 158 Posted May 30, 2014 I read about fordeAddUniform before the patch downloaded yesterday, but when I tried my old mission with 1.20, all uniform was correct (added with old addUniform). Is it possible my missions will work in MP other then in SP? I added west uniform to independent units with simple addUniform command. Will it work in future or I have to use forceAddUniform? Share this post Link to post Share on other sites
tomturner 10 Posted May 30, 2014 I read about fordeAddUniform before the patch downloaded yesterday, but when I tried my old mission with 1.20, all uniform was correct (added with old addUniform). Is it possible my missions will work in MP other then in SP?I added west uniform to independent units with simple addUniform command. Will it work in future or I have to use forceAddUniform? https://community.bistudio.com/wiki?title=Category:Introduced_with_Arma_3_version_1.22 Share this post Link to post Share on other sites
kilo1-1 1 Posted May 31, 2014 I can confirm this works because the PG Services mod works correctly in MP now. No more naked PMC units! Share this post Link to post Share on other sites
tomturner 10 Posted May 31, 2014 (edited) I can confirm this works because the PG Services mod works correctly in MP now. No more naked PMC units! Did you try it on a Dedicated Server yet? It doesn't seem to work for me, forceAddUniform is ignored. The addUniform will work for the client, but only he sees his uniform. Everyone else sees his underwear. I am using a blufor character and changing to a civ racing uniform (Karts). According to the biki, it won't be available until Stable ver 1.22 as I stated above. Edited May 31, 2014 by tomturner Share this post Link to post Share on other sites
kilo1-1 1 Posted June 1, 2014 Did you try it on a Dedicated Server yet? It doesn't seem to work for me, forceAddUniform is ignored. The addUniform will work for the client, but only he sees his uniform. Everyone else sees his underwear. I am using a blufor character and changing to a civ racing uniform (Karts).According to the biki, it won't be available until Stable ver 1.22 as I stated above. Yes, addUniform works correctly as a global command now on a dedicated server Share this post Link to post Share on other sites
tomturner 10 Posted June 1, 2014 (edited) Yes, addUniform works correctly as a global command now on a dedicated server It works, but as I said, your uniform changes in your view, but others still see you as in your underwear. blufor character changing uniform to civilian: _soldier addUniform "U_C_Driver_4"; and _soldier forceAddUniform "U_C_Driver_4"; errors out. Edited June 1, 2014 by tomturner Share this post Link to post Share on other sites
HaZZarD 2 Posted July 27, 2014 Hey guys It's a while now that I don't try to make missions with custom loadouts, do the uniforms work now in MP ? have you tried to just put in soldiers init what you get from the Virtual Loadout creator ? well hopefully no more naked soldiers : ) thanks Share this post Link to post Share on other sites
haleks 8212 Posted July 27, 2014 It works, but as I said, your uniform changes in your view, but others still see you as in your underwear. My Unlocked_Uniforms addon will fix that. ;) Share this post Link to post Share on other sites
rakowozz 14 Posted July 27, 2014 Hey guys It's a while now that I don't try to make missions with custom loadouts, do the uniforms work now in MP ? have you tried to just put in soldiers init what you get from the Virtual Loadout creator ? well hopefully no more naked soldiers : ) thanks They always worked in MP. But now it should be simpler overall, given the new commands after version 1.22. https://community.bistudio.com/wiki/addUniform - was updated and should be global now https://community.bistudio.com/wiki/forceAddUniform Share this post Link to post Share on other sites
Cota 1 Posted September 5, 2014 They always worked in MP. But now it should be simpler overall, given the new commands after version 1.22.https://community.bistudio.com/wiki/addUniform - was updated and should be global now https://community.bistudio.com/wiki/forceAddUniform I continue with this problem. I'm doing a mission where the uniforms and equipment are in boxes and each player chooses what it will take. Except that every player who enters after the beginning of the match, which makes the other players lose their equipment. I tried to use a .sqf file and also tried pasting the items into the init of the box. Nothing worked. Items added in the box, only the weapons remain with the player. I need suggestions please Share this post Link to post Share on other sites
Magirot 14 Posted September 5, 2014 I continue with this problem. I'm doing a mission where the uniforms and equipment are in boxes and each player chooses what it will take. Except that every player who enters after the beginning of the match, which makes the other players lose their equipment. I tried to use a .sqf file and also tried pasting the items into the init of the box. Nothing worked. Items added in the box, only the weapons remain with the player. I need suggestions please You probably have removeUniform in the init fields of the units? The command is global, and Join-In-Progress players execute init fields for everyone. You either need to remove the command or make sure it's only executed once (with local and get/setVariable, for example). Share this post Link to post Share on other sites
Cota 1 Posted September 5, 2014 You probably have removeUniform in the init fields of the units? The command is global, and Join-In-Progress players execute init fields for everyone. You either need to remove the command or make sure it's only executed once (with local and get/setVariable, for example). To remove all itens i used this: this disableAI "MOVE"; removeAllWeapons this; removeUniform this;removeAllAssignedItems this;removeBackpack this; removeHeadgear this; removeGoggles this; removeVest this; And for de ammo box i used this: //Clearing the box clearweaponcargoglobal _this; clearmagazinecargoglobal _this; //Uniform _this addUniform ["U_mas_mar_B_CombatUniform_des_tshirt",1]; //Headgear _this addItemCargoglobal ["H_mas_mar_helmetd_us",1]; _this addItemCargoglobal ["H_mas_mar_helmetdgog_us",1]; _this addItemCargoglobal ["H_mas_mar_Booniehat_des",1]; //Vest _this addItemCargoglobal ["V_mas_mar_PlateCarrier1_rgr_d",1]; _this addItemCargoglobal ["V_mas_mar_PlateCarrierGL_rgr_d",1]; //Shemagh _this addItemCargoglobal ["NeckTight_DMBLK",1]; _this addItemCargoglobal ["L_Shemagh_Tan",1]; _this addItemCargoglobal ["NeckTight_TanO",1]; //Weapons _this addWeaponCargoglobal ["ej_iar30",1]; _this addItemCargoglobal ["FHQ_optic_ACOG",1]; //Pistol _this addWeaponCargoglobal ["RH_m9",1]; //Ammo _this addItemCargo ["30RND_556x45_Stanag",15]; _this addMagazineCargoglobal ["RH_15Rnd_9x19_M9",5]; //Grenade _this addItemCargoglobal ["HandGrenade",2]; _this addItemCargoglobal ["Chemlight_blue",2]; _this addItemCargoglobal ["SmokeShell",2]; _this addItemCargoglobal ["SmokeShellBlue",2]; _this addItemCargoglobal ["SmokeShellGreen",2]; _this addItemCargoglobal ["SmokeShellRed",2]; //Item _this addItemCargoglobal ["ItemGPS",1]; _this addItemCargoglobal ["ItemMap",1]; _this addItemCargoglobal ["ItemCompass",1]; _this addItemCargoglobal ["ItemWatch",1]; _this addItemCargoglobal ["TFA_NVGoggles2",1]; //Backpack _this addBackpackCargoGlobal ["B_AssaultPack_cbr",1]; //FirstAid _this addWeaponCargoglobal ["FirstAidKit",10]; //Radio _this addItemCargoglobal ["tf_rf7800str_2",1]; // null = this execVM "usmc_AR_M27.sqf" Share this post Link to post Share on other sites
Beerkan 71 Posted September 5, 2014 To remove all itens i used this: this disableAI "MOVE"; removeAllWeapons this; removeUniform this;removeAllAssignedItems this;removeBackpack this; removeHeadgear this; removeGoggles this; removeVest this; Yea, get rid of that from all units.Put this in your init.sqf if (_x IsKindof "Man") then {removeAllWeapons _x;removeAllAssignedItems _x;removeAllContainers _x;removeHeadgear _x;removeGoggles _x;} forEach allUnits; And your ammobox is a bit sparse. Only 1 uniform? Do you have ammoboxes for each player? Share this post Link to post Share on other sites