Jump to content
rakowozz

Added Uniform Disappears in Multiplayer

Recommended Posts

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?

Yes.....one ammoboxe for each player...yes i know , i have a little problem, but the original idea was a closet for each soldier.

Edited by Cota

Share this post


Link to post
Share on other sites
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?

wWhat this command supposed to do? Not done anything different in mission. In the init i put

if (_x IsKindof "Man") then {removeAllWeapons _x;removeAllAssignedItems _x;removeAllContainers _x;removeHeadgear _x;removeGoggles _x;} forEach allUnits;

and the command to remove task force radio

tf_no_auto_long_range_radio = true;

and nothing happened

Share this post


Link to post
Share on other sites

So after many attempts I was unable to make units without uniforms entered the mission without making them lose the uniform later.

The whole general idea of the mission was that each player find a locker in front and could customize it your way. Each could choose between 3 or 4 helmets, jackets, uniforms, of course within a certain camouflage pattern that would be defined by the type of mission.

Some of the problems that was going on, beyond the problem of the uniform was that every time someone entered the game, the items in the box increased. If five people came after the mission began, were added 5 items each in the boxes.

Until that time was using the following, direct on the init of each box

clearweaponcargoglobal _this;
clearmagazinecargoglobal _this;
this addItemCargoglobal ["U_mas_mar_B_CombatUniform_des",1]; 
this addItemCargoglobal ["U_mas_mar_B_CombatUniform_des_vest",1];
this addItemCargoglobal ["U_mas_mar_B_CombatUniform_des_tshirt",1];
this addItemCargoglobal ["H_mas_mar_helmetd_us",1];
this addItemCargoglobal ["H_mas_mar_helmetdgog_us",1];
this addItemCargoglobal ["H_mas_mar_Booniehat_des",1];
this addItemCargoglobal ["V_mas_mar_PlateCarrier1_rgr_d",1];
this addItemCargoglobal ["V_mas_mar_PlateCarrierGL_rgr_d",1];
this addItemCargoglobal ["NeckTight_DMBLK",1];
this addItemCargoglobal ["L_Shemagh_Tan",1];
this addItemCargoglobal ["NeckTight_TanO",1];
this addWeaponCargoglobal ["RH_M4_ris",1];
this addItemCargoglobal ["FHQ_optic_ACOG",1];
this addWeaponCargoglobal ["RH_m9",1];
this addItemCargo ["30RND_556x45_Stanag",15];
this addMagazineCargoglobal ["RH_15Rnd_9x19_M9",5];
this addItemCargoglobal ["HandGrenade",2];
this addItemCargoglobal ["Chemlight_blue",2];
this addItemCargoglobal ["1Rnd_HE_Grenade_shell",2];
this addItemCargoglobal ["1Rnd_Smoke_Grenade_shell",2];
this addItemCargoglobal ["ItemGPS",1];
this addItemCargoglobal ["ItemMap",1];
this addItemCargoglobal ["ItemCompass",1];
this addItemCargoglobal ["ItemWatch",1];
this addItemCargoglobal ["TFA_NVGoggles2",1];
this addBackpackCargoGlobal ["B_AssaultPack_cbr",1];
this addWeaponCargoglobal ["FirstAidKit",10];
this addItemCargoglobal ["tf_rf7800str_2",1];

After several tests, the only way I found to avoid this was to change the code from addItemCargoglobal to additemcargoglobal

the new code came to be that way

removeallweapons this;
removeallassigneditems this;
removeuniform this;
removevest this;
removebackpack this;
removeallMagazines;
ClearWeaponCargo this; 
ClearMagazineCargo this;

this addItemCargo ["U_mas_mar_B_CombatUniform_des",1]; 
this addItemCargo ["U_mas_mar_B_CombatUniform_des_vest",1];
this addItemCargo ["U_mas_mar_B_CombatUniform_des_tshirt",1];

this addItemCargo ["H_mas_mar_helmetd_us",1];
this addItemCargo ["H_mas_mar_helmetdgog_us",1];
this addItemCargo ["H_mas_mar_Booniehat_des",1];

this addItemCargo ["V_mas_mar_PlateCarrier1_rgr_d",1];
this addItemCargo ["V_mas_mar_PlateCarrierGL_rgr_d",1];

this addItemCargo ["NeckTight_DMBLK",1];
this addItemCargo ["L_Shemagh_Tan",1];
this addItemCargo ["NeckTight_TanO",1];

this addWeaponCargo ["RH_M4_ris_M203",1];
this addItemCargo ["FHQ_optic_ACOG",1];

this addWeaponCargo ["RH_m9",1];

this addItemCargo ["30RND_556x45_Stanag",15];
this addItemCargo ["RH_15Rnd_9x19_M9",5];
this addMagazineCargo ["1Rnd_HE_Grenade_shell",20];

this addItemCargo ["HandGrenade",2];
this addItemCargo ["SmokeShell",2];
this addItemCargo ["SmokeShellBlue",2];
this addItemCargo ["SmokeShellGreen",2];
this addItemCargo ["SmokeShellRed",2];
this addItemCargo ["Chemlight_blue",2];

this addItemCargo ["ItemGPS",1];
this addItemCargo ["ItemMap",1];
this addItemCargo ["ItemCompass",1];
this addItemCargo ["ItemWatch",1];

this addItemCargo ["TFA_NVGoggles2",1];

this addItemCargo ["Rangefinder",1];

this addWeaponCargo ["FirstAidKit",10];

this addItemCargo ["tf_anprc152_4",1];
this addItemCargo ["tf_rf7800str_2",1];

this addBackpackCargo ["B_AssaultPack_cbr",1];

Today, I went to test again with a server using a LAN, but nothing worked, boxes only worked for the host

so I changed again, to global what worked and began to not work and what did not work started functioning

I also did tests using sqf, and had the same errors

basically, what I need to solve is:1) players enter without unifomers without items and unarmed mission 2)the items of the boxes appear for all

Share this post


Link to post
Share on other sites
wWhat this command supposed to do? Not done anything different in mission. In the init i put

if (_x IsKindof "Man") then {removeAllWeapons _x;removeAllAssignedItems _x;removeAllContainers _x;removeHeadgear _x;removeGoggles _x;} forEach allUnits;

The problem with this was two missing brackets, it should be:

[b]{[/b] if (_x IsKindof "Man") then {removeAllWeapons _x;removeAllAssignedItems _x;removeAllContainers _x;removeHeadgear _x;removeGoggles _x; } [b]}[/b] forEach allUnits;

However, it wouldn't have solved your problem in any way, because without a check to see if it has already been run, Join-In-Progress players would still remove all gear from everyone upon joining. And if you'd add a check, JIP players would be left with the default gear.

Arma is really annoying with locality. One way around your problem is to do this:

1. Switch the unit gear removal to a script. Put this in your unit's init field:

this execVM "clearInventory.sqf";

Create a file called clearInventory.sqf and put this as its contents:

// Get the "this" variable that was passed to the script
_unit = _this;

// Check that the unit is local to the computer,
// and that the items haven't been removed already
if (!local _unit || _unit getVariable ["loadoutDone", FALSE]) exitWith {};

// clear inventory
removeAllWeapons       _unit;
removeAllAssignedItems _unit;
removeAllContainers    _unit;
removeHeadgear         _unit;
removeGoggles          _unit;

// set the variable so that they won't get removed again
_unit setVariable ["loadoutDone", TRUE, TRUE];

2. Same with the cargo box, don't put it directly in the init line. Return to the script setup like you did earlier:

this execVM "cargoBox.sqf";

// Only run for the server, the important part
if (!isServer) exitWith {};

//Clearing the box
clearWeaponCargoGlobal _this;
clearMagazineCargoGlobal _this;

//Uniform    
_this addItemCargoGlobal ["U_mas_mar_B_CombatUniform_des_tshirt",1];
_this addItemCargoGlobal ["U_mas_mar_B_CombatUniform_des_vest",1];
_this addItemCargoGlobal ["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 addMagazineCargoGlobal ["30RND_556x45_Stanag",15];
_this addMagazineCargoGlobal ["RH_15Rnd_9x19_M9",5];

//Grenade
_this addMagazineCargoGlobal ["HandGrenade",2];
_this addMagazineCargoGlobal ["Chemlight_blue",2];
_this addMagazineCargoGlobal ["SmokeShell",2];
_this addMagazineCargoGlobal ["SmokeShellBlue",2];
_this addMagazineCargoGlobal ["SmokeShellGreen",2];
_this addMagazineCargoGlobal ["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 addItemCargoGlobal ["FirstAidKit",10];

//Radio
_this addItemCargoGlobal ["ItemRadio",1]; 

This way they do get created globally, but only once.

(I fixed a couple of the item types; there FirstAidKits are items, not weapons; grenades are magazines, not items; 30RND_556x45_Stanag is assumedly a magazine, not an item)

Also you shouldn't create TFAR radios directly, ItemRadio gets automatically replaced with the appropriate item. If you want to define what that item is, there are commands you can put into init.sqf. Directly creating "tf_rf7800str_2" can lead to problems, the issue is in the "str_2" at the end.

Edited by Magirot
Silly mistake fixed

Share this post


Link to post
Share on other sites

Thank you very much. I will test later today and will report the results

---------- Post added at 20:58 ---------- Previous post was at 20:14 ----------

Almost everything went right. The only problem was with the helmets. When someone enters them disappear.

Share this post


Link to post
Share on other sites

how do I put directly on each soldier? Works the same way as you would for a box of ammo?

How is this command to the radio?

Share this post


Link to post
Share on other sites

this execVM "clearInventory.sqf";  

u need a handle

null = this execVM "clearInventory.sqf"; 

---------------------

and need parentesis

if (!local _unit || _unit getVariable ["loadoutDone", FALSE]) exitWith {};

if (!(local _unidad) || (_unidad getVariable ["loadoutDone", FALSE])) exitWith {};

and maybe replace _unit with player (in my tests, when player disconnect and reconnect, soldier still have loadoutDone = true because (i think) when you assign _unit = _this; takes the name of the unit not the player..)

sorry by my bad english

Edited by KoVValsky

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.

What is it exactly ? FNC_SL, FNC_RFL1 .....are class names ? where I find this list of class names?

Share this post


Link to post
Share on other sites

Those are global variables, to be more precise, code (functions).

Share this post


Link to post
Share on other sites
Those are global variables, to be more precise, code (functions).

Is there a list of this codes ?

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.

rakowozz, I tryed your script but I can't make it works on my dedi, if I try from preview it works fine after some seconds (obviously for me alone) but on my dedicated server, and I'm testing alone, nothing change my unit have the default loadout and I waited for 20/30 sec.

those are my sqf:

Init.sqf

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

//Init UPSMON script
call compile preprocessFileLineNumbers "scripts\Init_UPSMON.sqf";

//shk_FHQ TaskTracker
call compile preprocessFileLineNumbers "scripts\fhqtt2.sqf";
call compile preprocessFileLineNumbers "scripts\briefing.sqf";

//Light Vehicle Respawn
call compile preProcessFile "scripts\vehInitFunctions.sqf";

//Abilita il Dynamic Player markers script
0 = [] execVM "scripts\player_markers.sqf"; 

//Hidemarker
"Obiettivo02" setMarkerAlpha 0;
"Obiettivo03" setMarkerAlpha 0;
"Obiettivo04" setMarkerAlpha 0;
"Obiettivo05" setMarkerAlpha 0;
"Obiettivo06" setMarkerAlpha 0;
"Obiettivo07" setMarkerAlpha 0;

//Download Data from laptop
call compile preprocessFile "scripts\downloadData.sqf";
waitUntil { !isNil "downloadDataDONE" };
if ( !isServer ) exitWith {}; 

sleep 10; // I dont know why, but some sleep is requied or the Actions on the Objects wont work ... this is beyond my knowledge 

[ [ laptop01, laptop02, laptop03, laptop04 ], "T8_fnc_addActionLaptop", true, true] spawn BIS_fnc_MP;

// Loadouts
execVM "scripts\equip\client.sqf";

client.sqf

// a1, a2 etc sono i nomi delle unità

if !(isDedicated) then {

 waitUntil { !IsNull Player };
     if (local player) then {

       waitUntil { time > 1 };

       switch (faction player) do {
              case "BLU_F":
              {
              [] call compile preprocessFile "scripts\equip\loadouts.sqf";};
              };


           switch (player) do {
           case a1: {[a1] call FNC_CS;};
           case a2: {[a2] call FNC_AT;};
           case a3: {[a3] call FNC_DEMO;};
           case a4: {[a4] call FNC_GRA;};
           case a5: {[a5] call FNC_MED;};
		case b5: {[b5] call FNC_MED;};
           case a6: {[a6] call FNC_MG;};
           case a7: {[a7] call FNC_MUNI;};
           };
      };

};  

loadouts.sqf

FNC_CS = 
{
 _unit = _this select 0;

comment "Remove existing items";
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

sleep 1;

[[{}, _unit addUniform "U_B_CombatUniform_mcam"], "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
for "_i" from 1 to 4 do {_unit addItemToUniform "SmokeShell";};
for "_i" from 1 to 3 do {_unit addItemToUniform "20Rnd_mas_762x51_Stanag";};
_unit addItemToUniform "AGM_EarBuds";
_unit addVest "V_PlateCarrier1_rgr";
for "_i" from 1 to 3 do {_unit addItemToVest "20Rnd_mas_762x51_Stanag";};
for "_i" from 1 to 5 do {_unit addItemToVest "HandGrenade";};
_unit addBackpack "tf_rt1523g";
for "_i" from 1 to 8 do {_unit addItemToBackpack "AGM_Bandage";};
for "_i" from 1 to 5 do {_unit addItemToBackpack "AGM_Morphine";};
for "_i" from 1 to 5 do {_unit addItemToBackpack "AGM_Epipen";};
for "_i" from 1 to 1 do {_unit addItemToBackpack "AGM_Bloodbag";};
_unit addHeadgear "H_HelmetSpecB_blk";
_unit addGoggles "G_Lowprofile";

comment "Add weapons";
_unit addWeapon "srifle_mas_mk17s";
_unit addPrimaryWeaponItem "optic_mas_DMS";
_unit addWeapon "AGM_Vector";

comment "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "tf_anprc152";
_unit linkItem "ItemGPS";
};

FNC_AT = 
{
 _unit = _this select 0;

comment "Remove existing items";
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

sleep 1;

[{}, _unit addUniform "U_B_CombatUniform_mcam_vest"], call BIS_fnc_MP; //attention to the syntax here. This, and only this syntax worked for me, even with other resources showing differently
for "_i" from 1 to 8 do {_unit addItemToUniform "AGM_Bandage";};
_unit addVest "V_I_G_resistanceLeader_F";
for "_i" from 1 to 4 do {_unit addItemToVest "HandGrenade";};
for "_i" from 1 to 6 do {_unit addItemToVest "20Rnd_mas_762x51_Stanag";};
_unit addBackpack "B_TacticalPack_ocamo";
for "_i" from 1 to 3 do {_unit addItemToBackpack "RPG32_F";};
for "_i" from 1 to 5 do {_unit addItemToBackpack "AGM_Morphine";};
for "_i" from 1 to 5 do {_unit addItemToBackpack "AGM_Epipen";};
_unit addHeadgear "H_HelmetSpecB_paint2";
_unit addGoggles "G_Combat";

comment "Add weapons";
_unit addWeapon "arifle_mas_mk17";
_unit addPrimaryWeaponItem "optic_Arco";
_unit addWeapon "launch_RPG32_F";
_unit addWeapon "AGM_Vector";

comment "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "tf_anprc152";
_unit linkItem "ItemGPS";
};

FNC_DEMO = 
{
 _unit = _this select 0;

comment "Remove existing items";
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

sleep 1;

[{}, _unit addUniform "U_B_CombatUniform_mcam_vest"], call BIS_fnc_MP; //attention to the syntax here. This, and only this syntax worked for me, even with other resources showing differently
for "_i" from 1 to 3 do {_unit addItemToUniform "20Rnd_mas_762x51_Stanag";};
for "_i" from 1 to 8 do {_unit addItemToUniform "AGM_Bandage";};
_unit addVest "V_I_G_resistanceLeader_F";
for "_i" from 1 to 4 do {_unit addItemToVest "HandGrenade";};
for "_i" from 1 to 3 do {_unit addItemToVest "20Rnd_mas_762x51_Stanag";};
_unit addBackpack "B_Carryall_mcamo";
for "_i" from 1 to 2 do {_unit addItemToBackpack "SLAMDirectionalMine_Wire_Mag";};
for "_i" from 1 to 4 do {_unit addItemToBackpack "DemoCharge_Remote_Mag";};
for "_i" from 1 to 2 do {_unit addItemToBackpack "APERSMine_Range_Mag";};
for "_i" from 1 to 5 do {_unit addItemToBackpack "AGM_Morphine";};  
for "_i" from 1 to 5 do {_unit addItemToBackpack "AGM_Epipen";};
_unit addItemToBackpack "AGM_Clacker";
_unit addItemToBackpack "AGM_DefusalKit";
_unit addHeadgear "H_HelmetSpecB_paint2";
_unit addGoggles "G_Combat";

comment "Add weapons";
_unit addWeapon "arifle_mas_mk17";
_unit addPrimaryWeaponItem "optic_Arco";
_unit addWeapon "AGM_Vector";

comment "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "tf_anprc152";
_unit linkItem "ItemGPS";
};

FNC_GRA = 
{
 _unit = _this select 0;

comment "Remove existing items";
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

sleep 1;

[{}, _unit addUniform "U_B_CombatUniform_mcam_vest"], call BIS_fnc_MP; //attention to the syntax here. This, and only this syntax worked for me, even with other resources showing differently
for "_i" from 1 to 3 do {_unit addItemToUniform "20Rnd_mas_762x51_Stanag";};
for "_i" from 1 to 8 do {_unit addItemToUniform "AGM_Bandage";};
_unit addVest "V_I_G_resistanceLeader_F";
for "_i" from 1 to 3 do {_unit addItemToVest "20Rnd_mas_762x51_Stanag";};
for "_i" from 1 to 2 do {_unit addItemToVest "HandGrenade";};
for "_i" from 1 to 2 do {_unit addItemToVest "MiniGrenade";};
for "_i" from 1 to 2 do {_unit addItemToVest "SmokeShell";};
_unit addBackpack "B_AssaultPack_mcamo";
for "_i" from 1 to 10 do {_unit addItemToBackpack "1Rnd_HE_Grenade_shell";};
for "_i" from 1 to 2 do {_unit addItemToBackpack "HandGrenade";};
for "_i" from 1 to 2 do {_unit addItemToBackpack "MiniGrenade";};
for "_i" from 1 to 2 do {_unit addItemToBackpack "SmokeShell";};
for "_i" from 1 to 5 do {_unit addItemToBackpack "AGM_Morphine";};
for "_i" from 1 to 5 do {_unit addItemToBackpack "AGM_Epipen";};
_unit addHeadgear "H_HelmetSpecB_paint2";
_unit addGoggles "G_Combat";

comment "Add weapons";
_unit addWeapon "arifle_mas_mk17_gl";
_unit addPrimaryWeaponItem "optic_Arco";
_unit addWeapon "AGM_Vector";

comment "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "tf_anprc152";
_unit linkItem "ItemGPS";
};

FNC_MED = 
{
 _unit = _this select 0;

comment "Remove existing items";
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

sleep 1;

[{}, _unit addUniform "U_B_CombatUniform_mcam_vest"], call BIS_fnc_MP; //attention to the syntax here. This, and only this syntax worked for me, even with other resources showing differently
for "_i" from 1 to 2 do {_unit addItemToUniform "20Rnd_mas_762x51_Stanag";};
_unit addVest "V_I_G_resistanceLeader_F";
for "_i" from 1 to 5 do {_unit addItemToVest "SmokeShell";};
for "_i" from 1 to 3 do {_unit addItemToVest "MiniGrenade";};
for "_i" from 1 to 4 do {_unit addItemToVest "20Rnd_mas_762x51_Stanag";};
_unit addBackpack "B_Carryall_oli";
for "_i" from 1 to 20 do {_unit addItemToBackpack "AGM_Bandage";};  
for "_i" from 1 to 10 do {_unit addItemToBackpack "AGM_Morphine";};  
for "_i" from 1 to 10 do {_unit addItemToBackpack "AGM_Epipen";}; 
for "_i" from 1 to 3 do {_unit addItemToBackpack "AGM_Bloodbag";};
_unit addHeadgear "H_HelmetSpecB_paint2";
_unit addGoggles "G_Combat";

comment "Add weapons";
_unit addWeapon "srifle_mas_mk17s";
_unit addPrimaryWeaponItem "optic_mas_DMS";
_unit addWeapon "AGM_Vector";

comment "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "tf_anprc152";
_unit linkItem "ItemGPS";
};

FNC_MG = 
{
 _unit = _this select 0;

comment "Remove existing items";
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

sleep 1;

[{}, _unit addUniform "U_B_CombatUniform_mcam_vest"], call BIS_fnc_MP; //attention to the syntax here. This, and only this syntax worked for me, even with other resources showing differently
_unit addVest "V_I_G_resistanceLeader_F";
for "_i" from 1 to 4 do {_unit addItemToVest "HandGrenade";};
for "_i" from 1 to 2 do {_unit addItemToVest "100Rnd_mas_762x51_Stanag";};
_unit addBackpack "B_TacticalPack_ocamo";
for "_i" from 1 to 2 do {_unit addItemToBackpack "100Rnd_mas_762x51_Stanag";};
for "_i" from 1 to 8 do {_unit addItemToUniform "AGM_Bandage";};
for "_i" from 1 to 5 do {_unit addItemToBackpack "AGM_Morphine";};
for "_i" from 1 to 5 do {_unit addItemToBackpack "AGM_Epipen";};
_unit addHeadgear "H_HelmetSpecB_paint2";
_unit addGoggles "G_Combat";

comment "Add weapons";
_unit addWeapon "LMG_mas_mk48_F";
_unit addPrimaryWeaponItem "optic_Arco";
_unit addWeapon "AGM_Vector";

comment "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "tf_anprc152";
_unit linkItem "ItemGPS";
};

FNC_MUNI = 
{
 _unit = _this select 0;

comment "Remove existing items";
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

sleep 1;

[{}, _unit addUniform "U_B_CombatUniform_mcam_vest"], call BIS_fnc_MP; //attention to the syntax here. This, and only this syntax worked for me, even with other resources showing differently
for "_i" from 1 to 4 do {_unit addItemToUniform "20Rnd_mas_762x51_Stanag";};
_unit addVest "V_I_G_resistanceLeader_F";
for "_i" from 1 to 5 do {_unit addItemToVest "AGM_Bandage";};
for "_i" from 1 to 5 do {_unit addItemToVest "AGM_Morphine";};
for "_i" from 1 to 5 do {_unit addItemToVest "AGM_Epipen";};
for "_i" from 1 to 7 do {_unit addItemToVest "20Rnd_mas_762x51_Stanag";};
_unit addBackpack "B_Carryall_mcamo";
for "_i" from 1 to 5 do {_unit addItemToBackpack "AGM_Morphine";};
for "_i" from 1 to 5 do {_unit addItemToBackpack "AGM_Epipen";};
for "_i" from 1 to 2 do {_unit addItemToBackpack "AGM_Bloodbag";};
for "_i" from 1 to 10 do {_unit addItemToBackpack "AGM_Bandage";};
for "_i" from 1 to 10 do {_unit addItemToBackpack "1Rnd_HE_Grenade_shell";};
for "_i" from 1 to 3 do {_unit addItemToBackpack "RPG32_F";};
for "_i" from 1 to 3 do {_unit addItemToBackpack "20Rnd_mas_762x51_Stanag";};
_unit addHeadgear "H_HelmetSpecB_paint1";
_unit addGoggles "G_Combat";

comment "Add weapons";
_unit addWeapon "arifle_mas_mk17";
_unit addPrimaryWeaponItem "optic_Arco";
_unit addWeapon "AGM_Vector";

comment "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "tf_anprc152";
_unit linkItem "ItemGPS";
};

You will find that only FNC_CS has this:

[[{}, _unit addUniform "U_B_CombatUniform_mcam"], "BIS_fnc_spawn", true] call BIS_fnc_MP;

others has this

[{}, _unit addUniform "U_B_CombatUniform_mcam"], call BIS_fnc_MP;

Because at respawn I have AGM module to save gear when you die and give the same gear and I would like to avoid conflict.

Before I got the custom equipment inside each unit init, but I had JIP issues (JIP player had default equipment). Now your script could avoid this problem if i could make it works.

In my mission I have some killed blufor units (damage 1 in their init) and a bis module to autofill a military base with blufor, but all those are not in any player group, I try to delete those units but nothing changed.

I also double checked the paths "scripts\equip\loadouts.sqf" and "scripts\equip\client.sqf", and they are right.

Share this post


Link to post
Share on other sites

I found a solution, and it worked for me.

At the beginning of the Init.sqf this is the code needed to make it work.

inside init.sqf (better before all other stuff):

if ((!isServer) && (player != player)) then
{
 waitUntil {player == player};
};

Share this post


Link to post
Share on other sites

Or just execute this script in the initPlayerLocal.sqf, has the same effect without the extra code.

Share this post


Link to post
Share on other sites
Or just execute this script in the initPlayerLocal.sqf, has the same effect without the extra code.

Which scripts? And what is initPlayerLocal.sqf? Never heard of it..

Share this post


Link to post
Share on other sites
Which scripts? And what is initPlayerLocal.sqf? Never heard of it..

All th stuff in your client.sqf (without the locality checks) and the lodaout script can be executed in the initPlayerLocal which has all those checks natively included without any extra code.

https://community.bistudio.com/wiki/Event_Scripts

Share this post


Link to post
Share on other sites

One question after months of AIII editor, what's your actual favorite and infallible script to make custom setup units ?

Share this post


Link to post
Share on other sites

I have tried to follow the instructions provided by rakowozz.

The behaviour I am trying to achieve is:

(i) Units have all their starting gear removed and replaced by custom loadouts.

(ii) Upon respawning they are again given the custom gear.

This is take place on an online coop MP server.

Init.sqf:

box1 addaction ["Open Virtual Arsenal", "VABoxinit.sqf"];
box2 addaction ["Open Virtual Arsenal", "VABoxinit.sqf"];
box3 addaction ["Open Virtual Arsenal", "VABoxinit.sqf"];
box4 addaction ["Open Virtual Arsenal", "VABoxinit.sqf"];
box5 addaction ["Open Virtual Arsenal", "VABoxinit.sqf"];
box6 addaction ["Open Virtual Arsenal", "VABoxinit.sqf"];

tf_no_auto_long_range_radio = true;

any= ["Operation Altis (P0)" ,
"Training" ,
"20-02-2019"
] spawn BIS_fnc_infoText;

//Execute scripts
[] execVM "VCOM_Driving\init.sqf";
execVM "client.sqf";  

if(isServer)then{
execVM "AIRS\AIrespawnInit.sqf";
};

Client.sqf

if !(isServer) then {

 waitUntil { !IsNull Player };
     if (local player) then {

       waitUntil { time > 1 };

       switch (faction player) do {
              case "BLU_F":
              {
              [] call compile preprocessFile "Loadouts.sqf";};

             };


           switch (player) do {
           case P1: {[P1] call FNC_DS;};
           case P2: {[P2] call FNC_DS;};
           case P3: {[P3] call FNC_DS;};
		case P4: {[P4] call FNC_DS;};
		case P5: {[P5] call FNC_DS;};
		case P6: {[P6] call FNC_DS;};
		case P7: {[P7] call FNC_DS;};
		case P8: {[P8] call FNC_DS;};
		case P9: {[P9] call FNC_DS;};
		case P10: {[P10] call FNC_DS;};
		case P11: {[P11] call FNC_DS;};
		case P12: {[P12] call FNC_DS;};
		case P13: {[P13] call FNC_DS;};
		case R1: {[R1] call FNC_R;};
		case R2: {[R2] call FNC_R;};
		case R3: {[R3] call FNC_R;};
		case R4: {[R4] call FNC_R;};
		case R5: {[R5] call FNC_R;};
		case R6: {[R6] call FNC_R;};
		case R7: {[R7] call FNC_R;};
		case R8: {[R8] call FNC_R;};
		case R9: {[R9] call FNC_R;};
		case R10: {[R10] call FNC_R;};
		case R11: {[R11] call FNC_R;};
		case R12: {[R12] call FNC_R;};
		case R13: {[R13] call FNC_R;};
		case R14: {[R14] call FNC_R;};

           };
      };

};

Loadouts.sqf

//Drill Sergeants Custom Loadouts

FNC_DS = 
{
 _unit = _this select 0;

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

sleep 1;

[[{}, _unit addUniform "rhs_uniform_cu_ocp_patchless"], "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 addvest "rhsusf_iotv_ocp_rifleman";    
_unit addbackpack "rhsusf_assault_eagleaiii_ocp";     
_unit addheadgear "rhsusf_ach_helmet_headset_ess_ocp";    
(unitBackpack _unit) additemCargoGlobal ["AGM_Bandage",10];  
(unitBackpack _unit) additemCargoGlobal ["AGM_Morphine",3];  
(unitBackpack _unit) additemCargoGlobal ["AGM_M26_Clacker",1];
(unitBackpack _unit) additemCargoGlobal ["AGM_EarBuds",1];  
(unitBackpack _unit) additemCargoGlobal ["AGM_CableTie",2];  
(unitBackpack _unit) addmagazineCargoGlobal ["SatchelCharge_Remote_Mag",1];    

_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";  
_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";  
_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";  
_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";  
_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";  
_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";  
_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";  
_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";    
_unit addweapon "rhs_weap_m4a1";  
_unit addPrimaryWeaponItem "rhsusf_acc_compm4";   
_unit addmagazine "smokeshell";  
_unit addmagazine "smokeshell";  
_unit addmagazine "handgrenade";  
_unit addmagazine "handgrenade";    
_unit additem "rhsusf_ANPVS_15";  
_unit additem "ItemCompass";  
_unit additem "itemgps";  
_unit additem "itemmap";  
_unit additem "tf_anprc152";  
_unit additem "itemwatch";  
_unit addweapon "Binocular";    
_unit assignitem "itemcompass";  
_unit assignitem "itemgps";  
_unit assignitem "itemmap";  
_unit assignitem "itemwatch";
_unit assignitem "rhsusf_ANPVS_15"; 
_unit assignitem "tf_anprc152";  
};

//Recruits Custom Loadouts

FNC_R = 
{
 _unit = _this select 0;

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

sleep 1;

[[{}, _unit addUniform "rhs_uniform_cu_ucp_patchless"], "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 addvest "rhsusf_iotv_ocp_rifleman";    
_unit addbackpack "rhsusf_assault_eagleaiii_ucp";     
_unit addheadgear "rhsusf_ach_helmet_headset_ess_ucp";    
(unitBackpack _unit) additemCargoGlobal ["AGM_Bandage",10];  
(unitBackpack _unit) additemCargoGlobal ["AGM_Morphine",3];  
(unitBackpack _unit) additemCargoGlobal ["AGM_M26_Clacker",1];
(unitBackpack _unit) additemCargoGlobal ["AGM_EarBuds",1];  
(unitBackpack _unit) additemCargoGlobal ["AGM_CableTie",2];  
(unitBackpack _unit) addmagazineCargoGlobal ["SatchelCharge_Remote_Mag",1];    

_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";  
_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";  
_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";  
_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";  
_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";  
_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";  
_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";  
_unit addmagazine "rhs_mag_30Rnd_556x45_M855A1_Stanag";    
_unit addweapon "rhs_weap_m4a1";  
_unit addPrimaryWeaponItem "rhsusf_acc_compm4";   
_unit addmagazine "smokeshell";  
_unit addmagazine "smokeshell";  
_unit addmagazine "handgrenade";  
_unit addmagazine "handgrenade";    
_unit additem "rhsusf_ANPVS_15";  
_unit additem "ItemCompass";  
_unit additem "itemgps";  
_unit additem "itemmap";  
_unit additem "itemwatch";   
_unit assignitem "rhsusf_ANPVS_15";  
_unit assignitem "itemcompass";  
_unit assignitem "itemgps";
_unit assignitem "itemmap";
_unit assignitem "itemwatch";
_unit additem "tf_anprc152";
_unit assignitem "tf_anprc152";
};

Init of individual soldiers:

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

I personally think that the error lies in the first line of the Client.sqf. I tried both "if !(isServer) then {" & "if !(isDedicated) then {" but neither seem to have any effect.

Please note that there are a number of mods being used in the mission but these had no issue, when I initially started this I placed a similar form all this directly into the Init of the individual soldiers which worked fine (using "this" instead of "_unit" etc.) until I noticed that respawning reverted the gear. This has now consumed many hours of my time so I'm reaching out to see if anyone could help me. Any help would be much appreciated, for a while I had this working for only human players in the editor but setting up a quick LAN mission revealed did not work there.

If anyone is wondering the case of the file names are: init.sqf, client.sqf and Loadouts.sqf

Please note that editing is new to me and I'm not very proficient at understanding the actual scripts above.

Edited by Escforreality
Clarification that I'm a noob at this.

Share this post


Link to post
Share on other sites

So I found the issues I was having, there was two of them in total but it took several hours to find:

(1) There was a spelling mistake in this line of Client.sqf:

case "BLU_F":
              {
              [] call compile preprocessFile "Loadouts.sqf";};

The "Loadouts.sqf" is actually "Loadout.sqf".

(2) We are using a total conversion modification from Red Hammer Studios (RHS) which is why the weapons and items are not default Arma 3 items in my Loadout.sqf but there is an additional change that was not immediately obvious to me. The "class" called for in Client.sqf was "BlU_F" here:

switch (faction player) do {
              case "BLU_F":

But RHS has different classes for the units we are using: "rhs_faction_usarmy_wd".

I only found this because I was playing around with Alive mod. Here is a link to the Alive Wiki where I found the faction names: http://alivemod.com/wiki/index.php/Supported_Factions evatently I found it here also: http://doc.rhsmods.org/index.php/Main_Page

In the end the issues were only with Client.sqf which now works and looks like this:

if !(isDedicated) then {

 waitUntil { !IsNull Player };
     if (local player) then {

       waitUntil { time > 1 };

       switch (faction player) do {
              case "rhs_faction_usarmy_wd":
              {
              [] call compile preprocessFile "Loadout.sqf";};

             };


           switch (player) do {
           case P1: {[P1] call FNC_DS;};
           case P2: {[P2] call FNC_DS;};
           case P3: {[P3] call FNC_DS;};
		case P4: {[P4] call FNC_DS;};
		case P5: {[P5] call FNC_DS;};
		case P6: {[P6] call FNC_DS;};
		case P7: {[P7] call FNC_DS;};
		case P8: {[P8] call FNC_DS;};
		case P9: {[P9] call FNC_DS;};
		case P10: {[P10] call FNC_DS;};
		case P11: {[P11] call FNC_DS;};
		case P12: {[P12] call FNC_DS;};
		case P13: {[P13] call FNC_DS;};
		case R1: {[R1] call FNC_R;};
		case R2: {[R2] call FNC_R;};
		case R3: {[R3] call FNC_R;};
		case R4: {[R4] call FNC_R;};
		case R5: {[R5] call FNC_R;};
		case R6: {[R6] call FNC_R;};
		case R7: {[R7] call FNC_R;};
		case R8: {[R8] call FNC_R;};
		case R9: {[R9] call FNC_R;};
		case R10: {[R10] call FNC_R;};
		case R11: {[R11] call FNC_R;};
		case R12: {[R12] call FNC_R;};
		case R13: {[R13] call FNC_R;};
		case R14: {[R14] call FNC_R;};

           };
      };

};

Share this post


Link to post
Share on other sites

So after the latest update to ARMA (1.42) I'm getting this error:

22:47:49 Error in expression <witch (player) do {
case P1: {[P1] call FNC_SL;};
case P2: {[P2] call FNC_SL;};
>
22:47:49   Error position: <FNC_SL;};
case P2: {[P2] call FNC_SL;};
>
22:47:49   Error Undefined variable in expression: fnc_sl
22:47:49 File C:\Users\xxxxxx\Documents\Arma 3 - Other Profiles\1Lt%20Escforreality\missions\Operation%20Altis%20(P3).Altis\client.sqf, line 17

I'm not sure if this relates to the mod being updated but the error being an undefined variable suggests to me that it may be a larger problem. Note that post above includes the "client.sqf" and "loadout.sqf".

From the 1.42 update change log I saw this:

Fixed: For security reasons, it's no longer possible to overwrite the path of official BIS functions in CfgFunctions

Is there anyone here that can help?

Edited by Escforreality

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

×