{"name":"BIS_fnc_limitWeaponItems","title":"BIS fnc limitWeaponItems","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_limitWeaponItems","revid":348030,"updated":"2023-11-08T11:26:29Z","groups":["Inventory"],"status":"ok","games":{"arma3":"1.00"},"since":"arma3 1.00","arma3_since":"1.00","description":"Keeps or remove unit's weapon attachments based on probability user sets. Apply for primary, secondary or handgun weapon separately.","syntaxes":[{"syntax":"[unit, mode, chanceOptics, chanceAttach, chanceMuzzle, chanceUnderbarrel] call BIS_fnc_limitWeaponItems","params":[{"name":"unit","type":"Object","description":"target unit","type_expr":"Object"},{"name":"mode","type":"Number","optional":true,"default":"0","description":"can be:\n\n- 1 = primary weapon\n- 2 = secondary weapon\n- 3 = handgun","type_expr":"Number","text":"mode: Number - (Optional, default 0) can be:\n\n- 1 = primary weapon\n- 2 = secondary weapon\n- 3 = handgun"},{"name":"chanceOptics","type":"Number or Array in format [\"itemClass\", chance]","optional":true,"default":"50","description":"chance to keep optics from 0 to 100%\n\n- if [\"itemClassname\", number] is used, the function will add that attachment if it passes the check. If not, the current attachment will be removed.","type_expr":"Number | Array","text":"chanceOptics: Number or Array in format [\"itemClass\", chance] - (Optional, default 50) chance to keep optics from 0 to 100%\n\n- if [\"itemClassname\", number] is used, the function will add that attachment if it passes the check. If not, the current attachment will be removed."},{"name":"chanceAttach","type":"Number or Array in format [\"itemClass\", chance]","optional":true,"default":"50","description":"chance to keep side attachments from 0 to 100%","type_expr":"Number | Array","text":"chanceAttach: Number or Array in format [\"itemClass\", chance] - (Optional, default 50) chance to keep side attachments from 0 to 100%"},{"name":"chanceMuzzle","type":"Number or Array in format [\"itemClass\", chance]","optional":true,"default":"50","description":"chance to keep muzzle attachment from 0 to 100%","type_expr":"Number | Array","text":"chanceMuzzle: Number or Array in format [\"itemClass\", chance] - (Optional, default 50) chance to keep muzzle attachment from 0 to 100%"},{"name":"chanceUnderbarrel","type":"Number or Array in format [\"itemClass\",chance]","optional":true,"default":"50","description":"chance to keep underbarrel attachment from 0 to 100%","type_expr":"Number | Array","text":"chanceUnderbarrel: Number or Array in format [\"itemClass\",chance] - (Optional, default 50) chance to keep underbarrel attachment from 0 to 100%"}],"returns":{"type":"Boolean","type_expr":"Boolean"}}],"examples":[{"code":["player call BIS_fnc_limitWeaponItems;"]},{"code":["[[player, 0, 25, 50, 75, 100]]  call BIS_fnc_limitWeaponItems;"]},{"code":["[[player, 0, [\"optic_lrps\", 100], [\"acc_pointer_ir\", 100], [\"muzzle_snds_B\", 100], [\"bipod_01_F_blk\", 100]]] call BIS_fnc_limitWeaponItems;"]}],"see_also":["BIS_fnc_limitAmmunition","BIS_fnc_limitItems"]}