Page MenuHomeFeedback Tracker

setUnitLoadout mess ammocount
Feedback, NormalPublic


I noticed following problem when using setUnitLoadout command.
When more than 1 magazine have same number of bullets (but less than maximum magazine capacity),
this command will not set given bullet count, instead added mags will be fully loaded to its maximum capacity.


Operating System
Windows 10
Steps To Reproduce

execute following

player setUnitLoadout [[],[],[],[],["V_Chestrig_rgr",[["30Rnd_556x45_Stanag",15,3]]],[],"","",[],["","","","","",""]]

This command should give 15 mags with 3 bullets each. It will give 15 full mags instead.

NOTICE!!!!! Adding one magazine will work fine.

player setUnitLoadout [[],[],[],[],["V_Chestrig_rgr",[["30Rnd_556x45_Stanag",15,1]]],[],"","",[],["","","","","",""]]
Additional Information

Huge thanks to BIS!
With this command, one can add deferent items/mags/weps/... to bag/vest/unifrom/... by simply pushBack correct item array to corresponding container array.

Hopefully this command will be fixed, as it is THE VERY BEST item handling command ever!!!
I personally love, how this command handles wrong input and empty arrays, so much more flexible from addMagazine, addItem and others.

Great work BIS! :)

Related Objects


Event Timeline

mind created this task.Jul 19 2016, 2:01 PM
razazel claimed this task.Jul 19 2016, 4:41 PM
razazel changed the task status from New to Reviewed.

while we waiting for the fix, here a simple solution (as long as you are interest in restore or copy a loadout):

Ux_fnc_getUnitLoadout = {
    private _magazines_config = configFile >> "CfgMagazines";
    private _fnc_fixContainerData = {
        if (count _this == 0) exitWith {};
        private _items = _this select 1;
        if (count _items == 0) exitWith {};
        private _new_items = [];
            private _item_count = _x select 1;
            if (count _x == 3 && _item_count > 1) then {
                private _type = _x select 0;
                private _ammo_count = _x select 2;
                private _mag_size = getNumber(_magazines_config >> _type >> "count");
                if (_ammo_count < _mag_size) then {
                    private _n = 0;
                    while { _n < _item_count } do {
                        _new_items pushBack [_type, 1, _ammo_count];
                        _n = _n + 1;
                else {
                    _new_items pushBack _x;
            } else {
                _new_items pushBack _x;
        } forEach _items;
        _this set [1, _new_items];

    private _loadout = getUnitLoadout _this;
    (_loadout select 3) call _fnc_fixContainerData;
    (_loadout select 4) call _fnc_fixContainerData;
    (_loadout select 5) call _fnc_fixContainerData;

This is a replacement for getUnitLoadout, it just reforms the array so




which then dont trigger the error in setUnitLoadout


savedLoadout = player call Ux_fnc_getUnitLoadout;
player setUnitLoadout [savedLoadout, false];
Henne added a subscriber: Henne.Apr 13 2023, 2:29 PM

The error is still persistent.
Is there any news on this?

BIS_fnc_KK added a subscriber: razazel.
BIS_fnc_KK set Ref Ticket to AIII-55697.Sat, May 27, 11:53 AM

Revision: 150667

BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.Sat, May 27, 12:00 PM
BIS_fnc_KK changed the task status from Reviewed to Feedback.
BIS_fnc_KK added a subscriber: BIS_fnc_KK.