Jump to content
Sign in to follow this  
owesome

Init Tab

Recommended Posts

Hi

since a long time I have problems with the initialization of the init tab field in Multiplayer.

I made a few custom crates and using the init field to fill them with my stuff. Nothing complicated - I'm using usually a "Supply Box"

clearMagazineCargo this;

clearItemCargo this;

clearWeaponCargo this;

this addweaponcargo ["arifle_SDAR_F",10];

this addMagazineCargo ["20Rnd_556x45_UW_mag", 30];

this addMagazineCargo ["30Rnd_556x45_Stanag", 30];

this additemcargo ["U_O_Wetsuit", 10];

this additemcargo ["V_RebreatherIR", 10];

this addItemCargo ["Chemlight_yellow", 30];

this addItemCargo ["Chemlight_blue", 30];

this addItemCargo ["Chemlight_red", 30];

this addItemCargo ["Chemlight_green", 30];

this addItemCargo ["AGM_HandFlare_White", 30];

this addItemCargo ["AGM_HandFlare_Green", 30];

this addItemCargo ["AGM_HandFlare_Yellow", 30];

When I preview the mission in the editor it works always fine.

When a friend or me start the server, its a chance of 50/50 that the crate is initialized correct or not.

Is there any way to improve this somehow? Where does this issue come from?

Thanks in advance

Share this post


Link to post
Share on other sites

You should only run this script on the server instead of all machines - wrap the code in an if (isServer) then {};

You also need to use the Global version of these commands.

clearMagazineCargoGlobal this; 
clearItemCargoGlobal this; 
clearWeaponCargoGlobal this; 
clearBackpackCargoGlobal this; 

if (isServer) then {

this addweaponcargoGlobal ["arifle_SDAR_F",10];
this addMagazineCargoGlobal ["20Rnd_556x45_UW_mag", 30]; 
this addMagazineCargoGlobal ["30Rnd_556x45_Stanag", 30]; 
this additemcargoGlobal ["U_O_Wetsuit", 10];
this additemcargoGlobal ["V_RebreatherIR", 10];

};

Share this post


Link to post
Share on other sites

It works like a charm now.

Thanks a lot SavageCDN

Share this post


Link to post
Share on other sites

You're welcome. I also should have explained it better: anything put into the init field of an editor unit (or a trigger) will run on all computers (server and connected clients). Sometimes this is OK but for your case it will cause problems.

Share this post


Link to post
Share on other sites

Aweome, thanks again. Its always good to know the backround.

Just started with editing a few month ago and usually most things are already asked and I just can adapt them.

The issue with the init tab was a tough one for me. Tried it with loadout sqfs etc. but never came to a solid solution.

Now I know how and maybe more important why! ;)

Thanks again I really appreciate your help.

Share this post


Link to post
Share on other sites

This is what got me started:

http://www.armaholic.com/page.php?id=4847

Yes it's for Arma 2 but a lot of the stuff still applies for Arma 3. It's a great starting point.

This is also a good read to help explain locality (which was sorta your problem with the loadouts):

http://killzonekid.com/arma-scripting-tutorials-locality/

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
Sign in to follow this  

×