Jump to content
fn_Quiksilver

Best way to remove an item type from a crate

Recommended Posts

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

 

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×