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.
Description
Description
Details
Details
- Severity
- Crash
- Resolution
- Open
- Reproducibility
- Always
- Operating System
- Windows 10 x64
- Operating System Version
- Build 18362
- Category
- Scripting
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.