Comrades in Arms Discussion Board

Full Version: crate load out
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Seems there is a problem preventing item to be taken from an ammo crate. This bug is not very consistent. Sometimes it manifests itslef sometimes not.
Sometimes i can't even drag items out of the box.

This is what i use. Can i do anything else to make more reliable? Thanks!

* i put this in the init field of the box:
nul =[this] execVM "scripts\box_akm.sqf";


In the box_akm.sqf script i have this:


_div = _this select 0;

clearMagazineCargoGlobal _div;
clearItemCargoGlobal _div;
clearWeaponCargoGlobal _div;
clearBackpackCargoGlobal _div;

_div addWeaponCargoGlobal ["CUP_M32_EP1",1];
_div addMagazineCargoGlobal ["CUP_6Rnd_HE_M203",17];
_div addMagazineCargoGlobal ["CUP_20Rnd_TE1_Red_Tracer_762x51_SCAR",33];

_div addMagazineCargoGlobal ["20Rnd_762x51_Mag",13];
_div addMagazineCargoGlobal ["CUP_Javelin_M",3];
_div addMagazineCargoGlobal ["130Rnd_338_Mag",7];

_div addMagazineCargoGlobal ["CUP_MAAWS_HEDP_M",5];
_div addMagazineCargoGlobal ["CUP_MAAWS_HEAT_M",5];
_div addMagazineCargoGlobal ["CUP_100Rnd_TE1_Red_Tracer_556x45_BetaCMag",13];
_div addMagazineCargoGlobal ["CUP_1Rnd_HE_M203",7];
_div addMagazineCargoGlobal ["CUP_6Rnd_FlareRed_M203",3];
I think "call compile preprocessFileLineNumbers" might be better to use than execVm, can't remember why but I saw something about that somewhere on BI forums.


Also execute it only on server or where the crate is local, otherwise it'll execute on all clients and you'll get multiplied loadouts, ie. put "if (!isServer) exitWith {};" at the top of the script



(05-25-2015, 01:56 PM)Outlawz7 link Wrote: [ -> ]Also execute it only on server or where the crate is local, otherwise it'll execute on all clients and you'll get multiplied loadouts, ie. put "if (!isServer) exitWith {};" at the top of the script


I wouldn't have a problem with this as long you can still pick up stuff from crate Smile


I'll try as you suggested, thanks!



Execvm is basically a spawn, and thus not available in unscheduled environments. Always use the code Outlawz provided in init fields, since the execvm exevution will be postponed.

Also, some you are using global variants, I'd only execute the code on the server. Plus I would ward off against multiple execztion, too... You never know
did several test, didn't encounter the bug denying you to pick up stuff yet.
i used this:


* in init field
[this] call compile preprocessFileLineNumbers "Scripts\box_diverse.sqf";

* in script

if (!isServer) exitWith {};

_div = _this select 0;

clearMagazineCargoGlobal _div;
clearItemCargoGlobal _div;
clearWeaponCargoGlobal _div;
clearBackpackCargoGlobal _div;


_div addWeaponCargoGlobal ["CUP_M32_EP1",1];
_div addMagazineCargoGlobal ["CUP_6Rnd_HE_M203",17];
_div addMagazineCargoGlobal ["CUP_20Rnd_TE1_Red_Tracer_762x51_SCAR",33];
etc...