How to recover magazine class from weapon config

Darce

Member
So I'm writing a routine to randomise the contents of a cache. I provide an array of gear and it then fills the box with a random assortment. That bit works fine. Weapons without ammo suck, so I want to make sure the right ammo is in the box for the weapons and thought to use the config to provide a suitable list. No luck. Any ideas?

My routine as it stands...
Code:
//load primary
_scount = count _primaryList;
    for "_x" from 0 to 3 do {
        _sSelect = floor(random _sCount);
        _item = _primaryList select _sSelect;
        _crate addWeaponCargoGlobal [_item,1];
        _mags = [] + getArray (configFile >> "cfgWeapons" >> _iItem >> "magazines");
        if (count _mags > 0) then {
            _crate addMagazineCargoGlobal [(_mags select 0),(round(random 4))];
        };
    };

(I'm getting the weapons, but no ammo :()
 
Back
Top