Jump to content
rakowozz

Added Uniform Disappears in Multiplayer

Recommended Posts

I think something official should be done by the devs , bug or not I dont know but we are talking about making custom gear soldiers , should be a basic and easy thing to do ...

Most certainly, it doesn't make any sense for addUniform to have local effect, there is zero practical use of this behavior, especially considering all other clothing commands are global.

Share this post


Link to post
Share on other sites

Is there a work around for this on a dedicated server?

Cheers

GC

Share this post


Link to post
Share on other sites
^^^ +1

Yeah. It used to be fine before the update. I dont mind coding but it just seems so long winded now.

Share this post


Link to post
Share on other sites
Is there a work around for this on a dedicated server?

Cheers

GC

Not that I know of, I'd be interested to see if someone does though personally.

Share this post


Link to post
Share on other sites

I am also having a problem getting a loadout script to work on dedicated servers. The problem always occurs with JIPs. Either the players uniform disappears or gear gets duplicated/reassigned when someone JIPs in. A ticket has been made here http://feedback.arma3.com/view.php?id=16485

Share this post


Link to post
Share on other sites

I believe I can help. The key is not to use the init field in the editor, since that'll run your code for everyone, server and client, upon initialization -- JIP or not.

The answer's within this thread. Combining tips from Iceman77, Deadfast and everyone else, I haven't had any problems at all with uniforms or ammo nonsense. This is especially useful when you use addUniform, which is now known to have local effect only (http://feedback.arma3.com/view.php?id=15298).

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;};
		};
      };

};

2. Defining the functions called up there. Line 11 of client.sqf calls for loadouts.sqf, which is below, in this format:

/*scripts\loadouts.sqf*/

FNC_SL = 
{
 _unit = _this select 0;

removeallweapons _unit; 
removevest _unit; 
removeuniform _unit; 
removeheadgear _unit;
removeallassigneditems _unit;

sleep 1;

[[{}, _unit addUniform "Uniform Classname Here"], "BIS_fnc_spawn", true] call BIS_fnc_MP; //attention to the syntax here. This, and only this syntax worked for me, even with other resources showing differently
_unit addbackpack "B_AssaultPack_blk";  
_unit addheadgear "H_Watchcap_blk"; 

_unit addweapon "RH_M4A1_ris";  
_unit addweapon "Binocular";

_unit addmagazine "30Rnd_556x45_STANAG"; 
_unit addmagazine "30Rnd_556x45_STANAG";  
_unit addmagazine "30Rnd_556x45_STANAG";  
_unit addmagazine "30Rnd_556x45_STANAG";  
_unit addmagazine "30Rnd_556x45_STANAG";  
_unit addmagazine "30Rnd_556x45_STANAG";

_unit addmagazine "SmokeShell";  
_unit addmagazine "SmokeShell";  
_unit addmagazine "HandGrenade";  
_unit addmagazine "HandGrenade"; 

_unit addPrimaryWeaponItem "RH_compm4s";  
_unit addPrimaryWeaponItem "RH_SFM952V";

_unit additem "FirstAidKit";  
_unit additem "ACRE_PRC148";  
_unit assignitem "ACRE_PRC148";    
_unit additem "ItemMap";  
_unit assignitem "ItemMap";  
_unit additem "ItemGPS"; 
_unit assignitem "ItemGPS"; 
_unit additem "ItemCompass";  
_unit assignitem "ItemCompass";  
_unit additem "ItemWatch"; 
_unit assignitem "ItemWatch"; 

removegoggles _unit; 

_unit addmagazine "chemlight_blue"; 
_unit addmagazine "chemlight_yellow";
};

FNC_RFL1 =
{
_unit = _this select 0;

removeallweapons _unit; 
removevest _unit; 
removeuniform _unit; 
removeheadgear _unit; 
removeallassigneditems _unit; 

sleep 1;

[[{}, _unit addUniform "Uniform Classname Here"], "BIS_fnc_spawn", true] call BIS_fnc_MP; 
_unit addbackpack "B_AssaultPack_blk";

_unit addweapon "RH_M4_ris";

_unit addmagazine "30Rnd_556x45_STANAG";  
_unit addmagazine "30Rnd_556x45_STANAG"; 
_unit addmagazine "30Rnd_556x45_STANAG"; 
_unit addmagazine "30Rnd_556x45_STANAG"; 
_unit addmagazine "30Rnd_556x45_STANAG"; 
_unit addmagazine "30Rnd_556x45_STANAG";  
_unit addmagazine "30Rnd_556x45_STANAG"; 
_unit addmagazine "30Rnd_556x45_STANAG";

_unit addmagazine "SmokeShell"; 
_unit addmagazine "SmokeShell"; 
_unit addmagazine "HandGrenade"; 

_unit addPrimaryWeaponItem "RH_eotech553"; 
_unit addPrimaryWeaponItem "RH_SFM952V"; 

_unit additem "FirstAidKit";  
_unit additem "ACRE_PRC148";  
_unit assignitem "ACRE_PRC148";; 
_unit additem "RH_compm4s";   
_unit additem "ItemMap";  
_unit assignitem "ItemMap"; 
_unit additem "ItemGPS"; 
_unit assignitem "ItemGPS"; 
_unit additem "ItemCompass"; 
_unit assignitem "ItemCompass"; 
_unit additem "ItemWatch"; 
_unit assignitem "ItemWatch"; 

_unit addmagazine "chemlight_blue";

};

/*[...continues...]*/

You get an uniform and BIS_fnc_MP delivers the message to everyone else. The same goes for loadoutsopf.sqf, in case of a mission with more than one team, obviously.

I believe that's about it, the process will be executed every time a client runs init.sqf, which is, joins the game and starts the mission. Optionally, you can later add a respawn event handler to read his loadout again.

Remember, avoid running all kinds of stuff from the units init field in the editor. And let me now how it goes.

Edited by rakowozz

Share this post


Link to post
Share on other sites

Nice to see you've got it sorted.

Hello Mr Iceman77,

...

There is a problem within Arma 3 sorry to say.

... who can we talk to ..... to solve this?

Read through the thread ..... or try Rakowozz's example, as he's already done that and apparently is having success.

Edited by Iceman77

Share this post


Link to post
Share on other sites
Nice to see you've got it sorted.

Read through the thread ..... or try Rakowozz's example, as he's already done that and apparently is having success.

The code only works for me if i put i a timer for 10s as the missions starts. Im hosting this on my pc for me and my friend. It sometimes still removes uniforms.

Share this post


Link to post
Share on other sites

Kindness intended, I've a really hard time believing you implemented this correctly as he's posted, without any deviation IE; trying to put your own "spin" on implementation / initialization. Also, it may be due to the fact you're hosting the mission yourself...

In any case, you should be replying to the person who posted the latest solution. Not me LOL. Good luck.

Kind Regards,

David

Edited by Iceman77

Share this post


Link to post
Share on other sites
The code only works for me if i put i a timer for 10s as the missions starts.

waitUntil {time > 1};

...in client.sqf sort of already does that. That's weird. How're you putting this timer? It's supposed to run from initialization.

And although I haven't had problems while testing with me being the host, try setting up a local dedicated server as well. Also, a good thing to know, from the feedback tracker back in October:

I've just tested dev 902 and this is the result:

addUniform => Local

removeUniform => Global

addVest => Global

removeVest => Global

addBackpack => Local

removeBackpack => Local

addHeadgear => Global

removeHeadgear => Global

addGoggles => Global

removeGoggles => Global

Share this post


Link to post
Share on other sites
I believe I can help. The key is not to use the init field in the editor, since that'll run your code for everyone, server and client, upon initialization -- JIP or not.

The answer's within this thread. Combining tips from Iceman77, Deadfast and everyone else, I haven't had any problems at all with uniforms or ammo nonsense. This is especially useful when you use addUniform, which is now known to have local effect only (http://feedback.arma3.com/view.php?id=15298).

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;};
		};
      };

};

2. Defining the functions called up there. Line 11 of client.sqf calls for loadouts.sqf, which is below, in this format:

/*scripts\loadouts.sqf*/

FNC_SL = 
{
 _unit = _this select 0;

removeallweapons _unit; 
removevest _unit; 
removeuniform _unit; 
removeheadgear _unit;
removeallassigneditems _unit;

sleep 1;

[[{}, _unit addUniform "Uniform Classname Here"], "BIS_fnc_spawn", true] call BIS_fnc_MP; //attention to the syntax here. This, and only this syntax worked for me, even with other resources showing differently
_unit addbackpack "B_AssaultPack_blk";  
_unit addheadgear "H_Watchcap_blk"; 

_unit addweapon "RH_M4A1_ris";  
_unit addweapon "Binocular";

_unit addmagazine "30Rnd_556x45_STANAG"; 
_unit addmagazine "30Rnd_556x45_STANAG";  
_unit addmagazine "30Rnd_556x45_STANAG";  
_unit addmagazine "30Rnd_556x45_STANAG";  
_unit addmagazine "30Rnd_556x45_STANAG";  
_unit addmagazine "30Rnd_556x45_STANAG";

_unit addmagazine "SmokeShell";  
_unit addmagazine "SmokeShell";  
_unit addmagazine "HandGrenade";  
_unit addmagazine "HandGrenade"; 

_unit addPrimaryWeaponItem "RH_compm4s";  
_unit addPrimaryWeaponItem "RH_SFM952V";

_unit additem "FirstAidKit";  
_unit additem "ACRE_PRC148";  
_unit assignitem "ACRE_PRC148";    
_unit additem "ItemMap";  
_unit assignitem "ItemMap";  
_unit additem "ItemGPS"; 
_unit assignitem "ItemGPS"; 
_unit additem "ItemCompass";  
_unit assignitem "ItemCompass";  
_unit additem "ItemWatch"; 
_unit assignitem "ItemWatch"; 

removegoggles _unit; 

_unit addmagazine "chemlight_blue"; 
_unit addmagazine "chemlight_yellow";
};

FNC_RFL1 =
{
_unit = _this select 0;

removeallweapons _unit; 
removevest _unit; 
removeuniform _unit; 
removeheadgear _unit; 
removeallassigneditems _unit; 

sleep 1;

[[{}, _unit addUniform "Uniform Classname Here"], "BIS_fnc_spawn", true] call BIS_fnc_MP; 
_unit addbackpack "B_AssaultPack_blk";

_unit addweapon "RH_M4_ris";

_unit addmagazine "30Rnd_556x45_STANAG";  
_unit addmagazine "30Rnd_556x45_STANAG"; 
_unit addmagazine "30Rnd_556x45_STANAG"; 
_unit addmagazine "30Rnd_556x45_STANAG"; 
_unit addmagazine "30Rnd_556x45_STANAG"; 
_unit addmagazine "30Rnd_556x45_STANAG";  
_unit addmagazine "30Rnd_556x45_STANAG"; 
_unit addmagazine "30Rnd_556x45_STANAG";

_unit addmagazine "SmokeShell"; 
_unit addmagazine "SmokeShell"; 
_unit addmagazine "HandGrenade"; 

_unit addPrimaryWeaponItem "RH_eotech553"; 
_unit addPrimaryWeaponItem "RH_SFM952V"; 

_unit additem "FirstAidKit";  
_unit additem "ACRE_PRC148";  
_unit assignitem "ACRE_PRC148";; 
_unit additem "RH_compm4s";   
_unit additem "ItemMap";  
_unit assignitem "ItemMap"; 
_unit additem "ItemGPS"; 
_unit assignitem "ItemGPS"; 
_unit additem "ItemCompass"; 
_unit assignitem "ItemCompass"; 
_unit additem "ItemWatch"; 
_unit assignitem "ItemWatch"; 

_unit addmagazine "chemlight_blue";

};

/*[...continues...]*/

You get an uniform and BIS_fnc_MP delivers the message to everyone else. The same goes for loadoutsopf.sqf, in case of a mission with more than one team, obviously.

I believe that's about it, the process will be executed every time a client runs init.sqf, which is, joins the game and starts the mission. Optionally, you can later add a respawn event handler to read his loadout again.

Remember, avoid running all kinds of stuff from the units init field in the editor. And let me now how it goes.

Ok im not very good at coding. Iv tried hard but having issues.

Iv created two missions in the link below. One using your code and one using mine.

With your code i can only get one units loadout to change.

With my code i can only get three working. Tried the forth but no luck.

Can anyone who is good at coding just have a look and let me know what the issue is.

Again this should be easier and was working before the update.

https://www.dropbox.com/s/2gaes2702jvysr6/Armaloadout.zip

Edited by foxtrot1787

Share this post


Link to post
Share on other sites
It sometimes still removes uniforms.

With your code i can only get one units loadout to change.

But I thought his code still rendered naked soldiers sometimes? Now you're saying you couldn't even get it to work at all to even get to such a point where you could make that claim... :confused:

In any case, in his example he's only provided 1 example function (FNC_SL). The client script is trying to call functions that aren't there (defined) and that's why only 1 units loadouts get changed. In the loadouts.sqf you need to define any additional desired loadouts within a function.

FNC_SL = {

//loadout stuff as he's posted

};

FNC_Another_loadout1 = {

//new loadout stuff 

};

FNC_Another_loadout2 = {

//new loadout stuff 

};

... more loadout functions if needed ...

Also take note that you can't utilize uniforms across sides. That will also render naked soldiers.

Edited by Iceman77

Share this post


Link to post
Share on other sites
Ok im not very good at coding. Iv tried hard but having issues.

Iv created two missions in the link below. One using your code and one using mine.

With your code i can only get one units loadout to change.

With my code i can only get three working. Tried the forth but no luck.

Can anyone who is good at coding just have a look and let me know what the issue is.

Again this should be easier and was working before the update.

https://www.dropbox.com/s/2gaes2702jvysr6/Armaloadout.zip

The switch in your Client.sqf does not have cases. Compare the code.

Share this post


Link to post
Share on other sites

Open the client.sqf & the loadouts.sqf and compare. Notice the client.sqf is calling several functions within the switch statement (based on unit name - ie; b1, b2, b3 etc etc). Also notice the loadouts.sqf only has one of those functions defined >> FNC_SL. You need to define additional loadout functions in the loadouts.sqf. Bottom line, just make sure the functions being ran within the client.sqf exist in the loadouts.sqf.

Rakowozz posted only 1 example loadout function, and you'll need to define any new ones.

Edited by Iceman77

Share this post


Link to post
Share on other sites
Open the client.sqf & the loadouts.sqf and compare. Notice the client.sqf is calling several functions within the switch statement (based on unit name - ie; b1, b2, b3 etc etc). Also notice the loadouts.sqf only has one of those functions defined >> FNC_SL. You need to define additional loadout functions in the loadouts.sqf. You can also remove or add the corresponding functions to the switch statement in the client.sqf.

Rakowozz posted only 1 example loadout function, and you'll need to define any new ones.

Ok iv removed the ones i dont need so i have two functions and 2 loadsouts. But still the same issue so i must be missing something.

How about my other mission example?

Edited by foxtrot1787

Share this post


Link to post
Share on other sites
How about my other mission example?

uhh.. Idk. Didn't bother to take a look.

Share this post


Link to post
Share on other sites

why wont the medic loadout apply to the combat life saver?

The unit is probably not named in the editor or named wrong, or isn't a player controlled unit... if the loadout isn't being applied.

Edited by Iceman77

Share this post


Link to post
Share on other sites
The unit is probably not named in the editor or named wrong, or isn't a player controlled unit... if the loadout isn't being applied.

defo named correct. works fine with the first three units.

Share this post


Link to post
Share on other sites

And he's a player controlled unit?

---------- Post added at 12:09 ---------- Previous post was at 12:07 ----------

Add me on steam.

Share this post


Link to post
Share on other sites
And he's a player controlled unit?

---------- Post added at 12:09 ---------- Previous post was at 12:07 ----------

Add me on steam.

no but i play with one other friend and we have our own ai units. If you download and look at my mission example you will see what i mean

Edited by foxtrot1787

Share this post


Link to post
Share on other sites

No need to look, the ai aren't considered players. So if the medic isn't a player controlled unit, that's where your problem lies. You could evaluate unit type instead. Good luck.

Share this post


Link to post
Share on other sites
No need to look, the ai aren't considered players. So if the medic isn't a player controlled unit, that's where your problem lies. You could evaluate unit type instead. Good luck.

Wow. If i create a second Client2.sqf and execute it client.sqf. It adds the loadouts to the remaining team members and this seems to work.

---------- Post added at 22:00 ---------- Previous post was at 21:33 ----------

Wow. If i create a second Client2.sqf and execute it client.sqf. It adds the loadouts to the remaining team members and this seems to work.

Lolz works fine in the editor. Multiplayer. ALLLLLL NAKED. Joke this game

Share this post


Link to post
Share on other sites

I don't get the joke. Works fine for me on a dedicated server. Which is what it's for. It's not intended for locally hosted MP games. Which has already been stated to you more than once.

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

×