Jump to content
Sign in to follow this  
Smoerble

Script runs in Preview but not on server?

Recommended Posts

Hi all,

I created a mission that workes as planned when using the editor preview. But when running the mission on a server, the script is not executed or not working. Any ideas?

Init of ammo crate in editor:

_nul = [this] execVM "loadoutAmmoBoxAtObjective1.sqf"; 

loadoutAmmoBoxAtObjective1.sqf

/////////   MP Ammo Box script
/////////   By: Riouken
/////////   For Arma 3
if (! isServer) exitWith {};

refillTimeout = 600; // seconds before refill) 
thisCrate = _this select 0;
while {alive thisCrate} do
{
clearMagazineCargo thisCrate;
clearWeaponCargo thisCrate;
clearBackpackCargo thisCrate;
clearItemCargo thisCrate;

// wepaons + ammo:
thisCrate addWeaponCargo ["arifle_MXM_Hamr_pointer_F", 3];
thisCrate addWeaponCargo ["arifle_MX_GL_Hamr_pointer_F", 1];
thisCrate addItemCargo ["30Rnd_65x39_caseless_mag_Tracer", 20];
thisCrate addItemCargo ["1Rnd_HE_Grenade_shell", 6];
thisCrate addWeaponCargo ["srifle_EBR_SOS_F", 1];
thisCrate addItemCargo ["20Rnd_762x51_Mag", 4];
thisCrate addWeaponCargo ["launch_NLAW_F", 3];
thisCrate addItemCargo ["NLAW_F", 12];
thisCrate additemcargo ["launch_B_Titan_F", 2];
thisCrate additemcargo ["Titan_AA", 6];
thisCrate addItemCargo ["HandGrenade", 9];

// items:
thisCrate additemcargo ["FirstAidKit", 10];
thisCrate additemcargo ["Medikit", 2];
thisCrate additemcargo ["Toolkit", 1];
thisCrate addWeaponCargo ["Binocular", 8];
thisCrate addItemCargo ["ItemMap", 8];
thisCrate addWeaponCargo ["optic_Holosight", 4];
thisCrate addBackpackCargo ["B_AssaultPack_Base", 3];
thisCrate addBackpackCargo ["B_AssaultPack_dgtl", 1];

// armor:
thisCrate addItemCargo ["V_PlateCarrier1_rgr", 4];
thisCrate addItemCargo ["H_HelmetB", 4];

sleep refillTimeout;
}

Edited by Smoerble

Share this post


Link to post
Share on other sites

Hi, Smoerble because these commands only have local effects, which means only the server sees the newly added items, you may need to use addWeaponCargoGlobal command

i think publicvariable "ammobox" maybe another way to make this script work

Edited by benw

Share this post


Link to post
Share on other sites

Thanks for the quick response.

Sorry, what do you mean with "publicvariable ammobox"?

What happens, when I replace additemcargo with additemcargoGlobal: will it work for Preview and server or only on the server?

As I want to have dfferent loadouts for different ammo boxes, what do you suggest please?

Share this post


Link to post
Share on other sites

Yes, additemCargoGlobal will work on servers.

Same as addweaponCargoGlobal, addMagazineCargoGlobal ect.

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  

×