serena 151 Posted May 13, 2016 Is there a legal way to detect item in binocular slot separate with same items in unit gear containers, without using getUnitLoadout command? Weapons and weaponsItems return all unit weapons include stored in gear. First approach: _onlyAssignedWeaponsIncludeOneInBinocularSlot = player call Fn_Gear_GetUnitAssignedWeaponsItems; Fn_Gear_GetUnitAssignedWeaponsItems = { private _res = []; { private _wpc = _x select 0; if (_this hasWeapon _wpc) then { if (isNil {{if (_x select 0 isEqualTo _wpc) exitWith {_x}} forEach _res}) then { _res pushBack _x} } } forEach weaponsItems _this; _res }; Share this post Link to post Share on other sites
killzone_kid 1329 Posted May 14, 2016 You mean _itemInBinocularSlot = binocular player; Share this post Link to post Share on other sites
serena 151 Posted May 14, 2016 Yes, this is what I need. Thank you Second approach: Fn_Gear_GetUnitAssignedWeaponsItems = { private _unt = _this; private _wis = weaponsItems _unt; [primaryWeapon _unt, secondaryWeapon _unt, handgunWeapon _unt, binocular _unt] apply { private _wpc = _x; if (_wpc isEqualTo "") then {[]} else {{if (_x select 0 isEqualTo _wpc) exitWith {_x}} forEach _wis}} }; Share this post Link to post Share on other sites
killzone_kid 1329 Posted May 15, 2016 fnc = { private _weaponsItems = getUnitLoadout _this; (_weaponsItems select [0, 3]) + [_weaponsItems select 8] }; Don't understand why you are against using getUnitLoadout Share this post Link to post Share on other sites
serena 151 Posted May 16, 2016 I'm just trying to operate with only a necessary minimum amount of data Share this post Link to post Share on other sites
Guest Posted September 18, 2016 Those commands, getUnitLoadout and setUnitLoadout are amazing. Best way to save players on DB and get from. Transform many, many lines, in one line. But they are safe to use? Sorry for off-topic. Share this post Link to post Share on other sites