Jump to content
Tankbuster

removing first aid kits?

Recommended Posts

There's an additemcargoglobal command, so I can add FAKs to unit and vehicles, but after an hour of messing with various commands, I think there's no way of removing first aid kits from vehicles.

Unless someone knows better. :)

Share this post


Link to post
Share on other sites

Ah well done. Didn't spot that one, thanks, K. :)

Share this post


Link to post
Share on other sites

If you want to remove all items from UAV inventory (First Aid Kits etc), in initPlayerLocal.sqf in mission file add
 

player addEventHandler ["WeaponAssembled", {clearItemCargoGlobal (_this select 1);}];

Then assembling a UAV backpack will spawn the UAV with an empty inventory

Share this post


Link to post
Share on other sites

this will get all of the items in the container and the amount of them, then it will loop through the items to find the FAK in the array, then delete it from the array of items, then clear the items from the container and readd all of the items but without the FAK

_AllItems = GetItemCargo Container;

_Items = (_AllItems Select 0);
_Amount = (_AllItems Select 1);

_IndexOfFAK = 0;
{
	if (_x == "FirstAidKit") then
	{
		_IndexOfFAK = _ForEachIndex;
	};
} ForEach _Items;

_Items DeleteAt _IndexOfFAK;
_Amount DeleteAt _IndexOfFAK;

ClearItemCargoGlobal Container;

{
	_Item = _x;
	_Count = (_Amount Select _ForEachIndex);
	Container AddItemCargoGlobal [_Item, _Count];
} ForEach _Items;

 

Share this post


Link to post
Share on other sites
TAG_fnc_removeItemsCargo = {
	params[ "_container", "_itemsToRemove" ];
	
	_items = itemCargo _container call BIS_fnc_consolidateArray;
	clearItemCargoGlobal _container;
	{
		_x params[ "_item" ];
		if ( _itemsToRemove findIf{ _x == _item } isEqualTo -1 ) then {
			_container addItemCargoGlobal _x;
		};
	}forEach _items;
};

[ cursorObject, [ "FirstAidKit" ] ] call TAG_fnc_removeItemsCargo;

 

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

×