Jump to content
rakowozz

Added Uniform Disappears in Multiplayer

Recommended Posts

Don't know what to say then bud. For us the loadouts are applied properly and without any naked soldiers, initially and for JIP players. Countless times we (4 of us) were JIP and trying to purposely render naked soldiers and missing gear. Never happened. Good luck in any case, I hope you and the others that have the problem get it sorted out.

Share this post


Link to post
Share on other sites

Just to keep this thread up to date. the code provided in this thread works but only if the unit selected is a Playable unit. Iceman is looking into this.

I.e the loadouts will only load for human players not ai units. So if you have a squad and your the team leader only the loadouts will apply to you so if you get killed and switch to a ai unit he will have is default gear. ( not ideal if your on a night op mission)

Share this post


Link to post
Share on other sites

I'm tied up 8 ways from sunday atm. But I haven't forgotten about our little project :). I'll try and get to it sometime within the next days.

Share this post


Link to post
Share on other sites

I have ran the method rakowozz has posted, #131 and it works quite well. Of a group of about 30 people JIPing in at different times on a dedi only 1 player had no uniform. Thanks for the help and research everyone put into this issue.

Share this post


Link to post
Share on other sites

Must say Iceman77 love your loadout script, however I noticed when you "disable AI" then there are a script error, most likely because the unit is not present, this does not stop the script in completing, its just an eye score. Are there any way to make this script error disapear without having all playable AI unit in the game?

Share this post


Link to post
Share on other sites

Scripting noob here.. Am I right in reading that this problem of no uniforms can only be fixed if you're running a dedicated server? And if you're running a local MP server for you and a couple of friends then there's no fix?

Share this post


Link to post
Share on other sites

I've found that

waitUntil {time > 0]

Works a lot better than

waitUntil {!isNull player}

No idea why..

Share this post


Link to post
Share on other sites

Will the solution supplied at the top of page 14 work for adding a different factions uniform?

EG: BLUFOR wearing a CIV U_C_ uniform?

Share this post


Link to post
Share on other sites
the code provided in this thread works but only if the unit selected is a Playable unit.

Yes, as intended. "player" values differ from client to client, and will return nothing valid for AI, since they're not players. It's what we can use as a filter within our if/then condition, having each player read only the necessary function, their specific loadout.

AI should be owned by the server, though. So, if you want to customize AI units, you could read their loadouts for the server only -- using isServer as condition, maybe. I usually leave friendly AI disabled, but I'd test this out, just get "player" out of the equation.

And remember to call the function again when respawning. One way of doing that:

/*from units init line*/

this addEventHandler ["Respawn", {_this call FNC_SL}];

Scripting noob here.. Am I right in reading that this problem of no uniforms can only be fixed if you're running a dedicated server? And if you're running a local MP server for you and a couple of friends then there's no fix?

Scripting noob replying: Haven't encountered any problems running either local MP or dedicated. But only your testing will tell for sure if it works with your mission as intended.

I'm sure this is definitely not the only way of "fixing" it, though.

Will the solution supplied at the top of page 14 work for adding a different factions uniform?

EG: BLUFOR wearing a CIV U_C_ uniform?

Although not recommended, I have used a custom independent faction uniform in BLUFOR units, making sure both factions were friendly towards each other. Worked fine, and OPFOR AI were still mad at me at all times. I didn't test with civilian uniforms, but it's worth a shot, while knowing it's been stated before by BIS that this could bring AI issues into your mission.

Then again, trial and error is often the best remedy... especially in cases like my own, where I don't have much of a programming background.

Share this post


Link to post
Share on other sites
Although not recommended, I have used a custom independent faction uniform in BLUFOR units, making sure both factions were friendly towards each other. Worked fine, and OPFOR AI were still mad at me at all times. I didn't test with civilian uniforms, but it's worth a shot, while knowing it's been stated before by BIS that this could bring AI issues into your mission.

Then again, trial and error is often the best remedy... especially in cases like my own, where I don't have much of a programming background.

Thanks for the reply dude!

I guess I could also try the other method mentioned in page 1; group playable civilians to a 0-probability, high-ranking BLUFOR Officer... does this cause other AI bugs tho?

Share this post


Link to post
Share on other sites

Rakowozz,

I have tried your provided scripts, and I am happy to report that they work perfectly. I am hosting a game locally on my computer and the loadouts I created using your script worked perfectly. Thank you!

To anyone who is looking at those and thinking they are too complicated (I was one) they aren't. I recommend you try this because it works and for us, it makes the game awesome again! Respawn also works perfectly!!

Share this post


Link to post
Share on other sites

Hey all, sorry to keep flogging this dead horse.

The good news is that I have no trouble giving human players new uniforms in MP and for them to be immune to JIP-underpants syndrome. Thanks to all the contributors in this thread for their valuable info, without which I'd never have twigged to the locality issues around add/removeUniform.

My trouble is with changing AI uniforms. I've got a bunch of generated units spawning mid-mission (thanks to Alive's CQB module), and I want to change their uniforms. I have a script that finds all the units, strips them, adds a random hat and uniform from some arrays. The headgear's fine, which is no surpirse, but the uniform doesn't work (also no surprise). I'm obviously suffering from the same "addUniform is local" issue - combined with the "BIS_fnc_MP doesn't work on a dedicated server" issue.

At the relevant part of the script (not a function) where the uniform has just been removed and the script's slept for 1 second, a I've tried the following:

// _x is the current unit in a { ... } forEach allUnits loop
// _uniform is a selected uniform name selected randomly from a predefined list of uniforms

_x addUniform _uniform;

// or
[[_x, {_this addUniform _uniform}], "BIS_fnc_spawn", true] call BIS_fnc_MP;  

// or
[[{}, _x addUniform _uniform], "BIS_fnc_spawn", true] call BIS_fnc_MP;

In every case it works fine on a locally-hosted MP mission. In no case does it work for a mission hosted on a Dedicated server. I know BIS_fnc_MP doesn't fire properly on a Dedi Server, but I was hoping that it would work in this case by giving the units the right uniform on all the human machines anyway.

Can anyone point out where I've made a stupid and obvious mistake? Or point at an existing, working, AI loadout-changing script I can butcher? Thanks.

Share this post


Link to post
Share on other sites

Updated: my problem was that Alive was messing with the locality of the units, I think. My workaround is to have all the units whose uniforms I want to mess with as standard editor-placed units, and let Alive profile the rest.

Share this post


Link to post
Share on other sites

It works fine for Players but as soon as you have AI on your team the loadouts dont apply. Crap when you make maps for two players with ai squads that need certain kit for the mission like night op gear.

Share this post


Link to post
Share on other sites

@foxtrot1787

yeah this is a problem , can someone adjust the script in a way that even if no one use the unit the loadout still apply ?

I' am a scripting noob myself and this problem about uniforms is keeping me away from the editor since months now ...

Share this post


Link to post
Share on other sites

so is there a way to make working custom loadout with respawn side ? something that work for AI and Human at the same time ?

any help would be really appreciated, my mission is broken :(

and still nothing official by BIS.......

Share this post


Link to post
Share on other sites

Create in your mission folder sqf file like "tl.sqf" in wich wiil be write code:

*******************************************************************
//in init
//null = [this] execVM "loadout.sqf"; 
//this addeventhandler ["respawn","_this execVM 'loadout.sqf'"];

waitUntil {!isNull player};       //to prevent MP / JIP issues

_unit = _this select 0;

If (local _unit) then {

Removeuniform _unit;
removeallcontainers _unit;
removeAllWeapons _unit; 
removeGoggles _unit; 
removeHeadgear _unit; 
removeVest _unit;  
removeAllAssignedItems _unit;
removebackpack _unit;


_unit addHeadgear "H_Booniehat_khk_hs"; _unit addUniform "U_B_CombatUniform_mcam_vest"; 
_unit addVest "V_TacVestIR_blk"; _unit addBackpack "B_Kitbag_mcamo"; _unit addMagazine "11Rnd_45ACP_Mag";
_unit addMagazine "30Rnd_65x39_caseless_mag"; _unit addMagazine "1Rnd_HE_Grenade_shell"; 
_unit addWeapon "arifle_MX_GL_Black_F"; _unit addWeapon "hgun_Pistol_heavy_01_F"; 
_unit addPrimaryWeaponItem "muzzle_snds_H"; _unit addPrimaryWeaponItem "acc_pointer_IR"; 
_unit addPrimaryWeaponItem "optic_Hamr"; _unit addHandgunItem "muzzle_snds_acp"; _unit addMagazine "11Rnd_45ACP_Mag"; 
_unit addMagazine "11Rnd_45ACP_Mag"; _unit addMagazine "11Rnd_45ACP_Mag"; _unit addMagazine "11Rnd_45ACP_Mag"; 
_unit addMagazine "1Rnd_HE_Grenade_shell"; _unit addMagazine "1Rnd_HE_Grenade_shell"; _unit addItem "FirstAidKit"; 
_unit addItem "FirstAidKit"; _unit addMagazine "30Rnd_65x39_caseless_mag"; _unit addMagazine "30Rnd_65x39_caseless_mag"; 
_unit addMagazine "30Rnd_65x39_caseless_mag"; _unit addMagazine "30Rnd_65x39_caseless_mag"; 
_unit addMagazine "30Rnd_65x39_caseless_mag_Tracer"; _unit addMagazine "30Rnd_65x39_caseless_mag_Tracer"; 
_unit addMagazine "30Rnd_65x39_caseless_mag_Tracer"; _unit addMagazine "1Rnd_HE_Grenade_shell"; 
_unit addMagazine "1Rnd_HE_Grenade_shell"; _unit addMagazine "1Rnd_HE_Grenade_shell"; _unit addMagazine "UGL_FlareGreen_F"; 
_unit addMagazine "UGL_FlareRed_F"; _unit addItem "FirstAidKit"; _unit addItem "FirstAidKit"; _unit addItem "FirstAidKit"; 
_unit addMagazine "MiniGrenade"; _unit addMagazine "MiniGrenade"; _unit addMagazine "MiniGrenade"; _unit addMagazine "MiniGrenade"; 
_unit addMagazine "SmokeShellGreen"; _unit addMagazine "SmokeShell"; _unit addMagazine "SmokeShell"; _unit addMagazine "APERSTripMine_Wire_Mag"; 
_unit addMagazine "SmokeShell"; _unit addMagazine "APERSTripMine_Wire_Mag"; _unit addMagazine "DemoCharge_Remote_Mag"; 
_unit addMagazine "B_IR_Grenade"; _unit addMagazine "30Rnd_65x39_caseless_mag"; _unit addMagazine "30Rnd_65x39_caseless_mag"; 
_unit linkItem "ItemMap"; _unit linkItem "ItemCompass"; _unit linkItem "ItemWatch"; _unit linkItem "ItemRadio"; 
_unit linkItem "ItemGPS"; _unit linkItem "NVGoggles"; _unit linkItem "Rangefinder"};

if(true) exitWith{};

***************************************************************************************

In unit init write code: null = [this] execVM "tl.sqf"; this addeventhandler ["respawn","_this execVM 'tl.sqf'"];

Edited by [FRL]Myke
Please use [code] tags next time ;)

Share this post


Link to post
Share on other sites
See 4th written line from top.

Last time I used that code(waitUntil {!isNull player}) it didn't work.

Edited by Coolfact

Share this post


Link to post
Share on other sites

Coolfact, are you running a dedicated server?

Player is null in dedi.

Maybe try..

if (isDedicated) exitWith {};

waitUntil {!isNull player}

..and see if it works?

Share this post


Link to post
Share on other sites

Does every client now see the same uniform added by "adduniform"? Or is this important issue still buggy?

Share this post


Link to post
Share on other sites
Coolfact, are you running a dedicated server?

Player is null in dedi.

Maybe try..

if (isDedicated) exitWith {};

waitUntil {!isNull player}

..and see if it works?

Yeah I found out I made a rookie mistake :D

Share this post


Link to post
Share on other sites

From the PG Services mod, the mod is currently plagued by this bug. I have been trying to fix it so both AI and player units appear with their uniform. The mod has a randomizer script inside it to randomize each unit with different uniforms, vests, and headgear. This is the source of the uniform bug inside the mod.

Here is one of the randomizer scripts inside one of the .pbos:

if (isServer) then {

   waitUntil {!isNull _this};

};
_vest = vest _this;
_magazines = magazines _this;
_items = items _this; // Medkits, ToolKits etc.
_assitems = assignedItems _this; // NVG's, GPS etc.

Removeuniform _this;
Removevest _this;
removeAllItems _this;

_uniform = (ceil (random 28));

switch (_uniform ) do 
{
   case 1: {
       [[{}, _this adduniform "U_PMC_CombatUniformRS_BSGPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 2: {
       [[{}, _this adduniform "U_PMC_CombatUniformRS_BSGPSB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 3: {
       [[{}, _this adduniform "U_PMC_CombatUniformRS_BSSPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 4: {
       [[{}, _this adduniform "U_PMC_CombatUniformRS_BSSPSB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 5: {
       [[{}, _this adduniform "U_PMC_CombatUniformRS_GSBPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 6: {
       [[{}, _this adduniform "U_PMC_CombatUniformRS_GSSPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 7: {
       [[{}, _this adduniform "U_PMC_CombatUniformRS_IndPBSBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 8: {
       [[{}, _this adduniform "U_PMC_CombatUniformRS_SSBPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 9: {
       [[{}, _this adduniform "U_PMC_CombatUniformRS_SSGPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 10: {
       [[{}, _this adduniform "U_PMC_CombatUniformRS_SSGPSB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 11: {
       [[{}, _this adduniform "U_PMC_CombatUniformRS_ChckDBS_GPSB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 12: {
       [[{}, _this adduniform "U_PMC_CombatUniformRS_ChckLB_GPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 13: {
       [[{}, _this adduniform "U_PMC_CombatUniformRS_ChckLR_SPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 14: {
       [[{}, _this adduniform "U_PMC_CombatUniformRS_ChckP_BPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 15: {
       [[{}, _this adduniform "U_PMC_CombatUniformLS_BSGPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 16: {
       [[{}, _this adduniform "U_PMC_CombatUniformLS_BSGPSB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 17: {
       [[{}, _this adduniform "U_PMC_CombatUniformLS_BSSPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 18: {
       [[{}, _this adduniform "U_PMC_CombatUniformLS_BSSPSB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 19: {
       [[{}, _this adduniform "U_PMC_CombatUniformLS_GSBPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 20: {
       [[{}, _this adduniform "U_PMC_CombatUniformLS_GSSPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 21: {
       [[{}, _this adduniform "U_PMC_CombatUniformLS_IndPBSBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 22: {
       [[{}, _this adduniform "U_PMC_CombatUniformLS_SSBPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 23: {
       [[{}, _this adduniform "U_PMC_CombatUniformLS_SSGPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 24: {
       [[{}, _this adduniform "U_PMC_CombatUniformLS_SSGPSB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 25: {
       [[{}, _this adduniform "U_PMC_CombatUniformLS_ChckDBS_GPSB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 26: {
       [[{}, _this adduniform "U_PMC_CombatUniformLS_ChckLB_GPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 27: {
       [[{}, _this adduniform "U_PMC_CombatUniformLS_ChckLR_SPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
   case 28: {
       [[{}, _this adduniform "U_PMC_CombatUniformLS_ChckP_BPBB";], "BIS_fnc_spawn", true] call BIS_fnc_MP;
       };
};

   Removeheadgear _this;

//------------ Helmet/Hat ------------

_hat = (ceil (random 3));

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";
       };
};
_this addVest _vest;

{_this addItem _x} forEach _items;
{_this addMagazine _x} forEach _magazines;
{_this addItem _x} forEach _assitems;
{_this assignItem _x} forEach _assitems;  

Can anyone identify why the "["BIS_fnc_spawn", true] call BIS_fnc_MP;" portion doesn't work? As it is now, with this edited script to try and fix the bug, units don't appear with anything at all except their headgear and weapon. How can this script be tweaked to provide a solution to disappearing uniforms on AI and player units on a dedicated server?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×