Page MenuHomeFeedback Tracker

addMagazineCargo causes CTD when trying to swap unit weapon after adding magazines
New, NormalPublic


Using addMagazineCargo, at least in the way I am, seems to cause a crash after trying to switch your weapon in the inventory screen with another. I am calling this script on unit with no starting magazines in an init event handler.


Operating System
Windows 10 x64
Operating System Version
Build 18362
Steps To Reproduce

Use this script,

private ["_unitPrimaryWeap","_unitVestContainer"];
_unit = param [0, objNull, [objNull]];

_unitPrimaryWeap = primaryWeapon _unit;
_unitVestContainer = vestContainer _unit;
if(_unitPrimaryWeap == "arifle_MX_f") then {
    _unitVestContainer addMagazineCargo ["30Rnd_65x39_caseless_mag",6];
    systemChat "Added 6x 30Rnd_65x39_caseless_mag";

in a init event handler on a unit with no starting magazines,

class cfgPatches
    class addMagazineCragoCrash
        name = "addMagazineCragoCrash";
        requiredVersion = 0.1;


class cfgVehicles
    class EventHandlers;
    class B_Soldier_F;
    class crashTestMX: B_Soldier_F
        displayName = "soldier mx";
        weapons[] = {"arifle_MX_f"};
        magazines[] = {};
        class EventHandlers: EventHandlers
          init = "if (local (_this select 0)) then {[(_this select 0), [], []] call tst_fnc_testCrash;};";

class cfgFunctions {
    class tst
        class functions
            class testCrash
                file = "addMagazineCargoCrash\testCrash.sqf";

causes a CTD 100% of the time.

Additional Information

Here is a video demoing this. And attached is the PBO I used to test this with.

Event Timeline

Jenkins created this task.Dec 31 2019, 10:13 AM

May be important to note that this occurs with addMagazineCargoGlobal as well.

Also occurs with addMagazine.

BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.May 19 2020, 1:19 PM
BIS_fnc_KK added a subscriber: BIS_fnc_KK.
Wulf added a subscriber: Wulf.May 21 2020, 1:08 PM


Could you please try this addon that I attached to this message if it helps?