fn_Quiksilver 1636 Posted April 21, 2016 Hi guys, In your opinion what's the cleanest way to remove all of a certain item class from a crate. Trying to remove smoke grenades. At the moment all I can think of doing is storing all the contents in a variable, filtered to remove the unwanted items, clearing the items from the crate and putting them back in. basically this is what I have so far: _magCargo = getMagazineCargo _box; clearMagazineCargoGlobal _box; _index = 0; for '_x' from 0 to ((count (_magCargo select 0)) - 1) step 1 do { if (!(['SmokeShell',((_magCargo select 0) select _index),FALSE] call (missionNamespace getVariable 'BIS_fnc_inString'))) then { _box addMagazineCargoGlobal [((_magCargo select 0) select _index),((_magCargo select 1) select _index)]; }; _index = _index + 1; }; Share this post Link to post Share on other sites
Nikander 123 Posted April 21, 2016 In your opinion what's the cleanest way to remove all of a certain item class from a crate. Trying to remove smoke grenades. Hi mdcclxxvi, your method is fine I think, only I would use isKindOf, like this: _mags = magazineCargo _box; clearMagazineCargoGlobal _box; { if !(_x isKindOf "SmokeShell") then {_box addMagazineCargoGlobal [_x, 1]}; } forEach _mags; Regards, Nikander Share this post Link to post Share on other sites
Tajin 348 Posted April 22, 2016 Why not remove them directly ? https://community.bistudio.com/wiki/removeMagazines Share this post Link to post Share on other sites
dscha 147 Posted April 22, 2016 Why not remove them directly ? https://community.bistudio.com/wiki/removeMagazines afaik removeXXX-Commands doesn't work with Objects/vehicles/Cars/everything else, that is not a player. Share this post Link to post Share on other sites