Jump to content
Sign in to follow this  
rimblock

Items capacity checks.

Recommended Posts

So, I think I am doing it wrong.

I have a script that will add items from an array in to various eauiped holders on a player (vest, uniform, backpack).

The indication that something was amiss was when I dropped the weapon on the floor (along with associated mags) and then could only pickup one of the three mags I had just dropped.

The script to add items to the player is not checking for load capacity in the items as I assumed ARMA would do that but it would seem not. WHat commands can be used to verify if enough capacity exists in a weaponholder before adding an item ?. Had a quick search but nothing is coming up as a likely lead based on my search terms.

Thanks

Share this post


Link to post
Share on other sites
_playerUniform = uniform player;

_uniformLoad = if (_playerUniform != "") then { // similarly for vests
_containerClass = getText (configFile >> "CfgWeapons" >> _playerUniform >> "ItemInfo" >> "containerclass");

_uniformMaxLoad = parseNumber ([_containerClass, "0123456789"] call BIS_fnc_filterString);

ceil ((1 - (loadUniform player)) * _uniformMaxLoad);
}
else {0};

_playerBackpack = backpack player;

_backpackLoad = if (_playerBackpack != "") then {
_backpackMaxLoad = getNumber (configFile >> "CfgVehicles" >> _playerBackpack >> "maximumload");

ceil ((1 - (loadBackpack player)) * _backpackMaxLoad);
}
else {0};

_weaponMass = getNumber (configFile >> "CfgWeapons" >> _typeName >> "WeaponSlotsInfo" >> "mass");

if (_weaponMass <= _uniformLoad) then {...} else {if (_weaponMass <= _backpackLoad) then {...} else {...}};

Edited by Schatten

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
Sign in to follow this  

×