BIS fnc limitWeaponItems: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (1 revision imported: BIS Functions update 2/7)
m (pf)
Line 1: Line 1:
{{Function|Comments=
____________________________________________________________________________________________


{{Function|= Comments
| arma3 |Game name=
 
|1.00|Game version=
____________________________________________________________________________________________
____________________________________________________________________________________________


| arma3 |= Game name
| Keeps or remove unit's weapon attachments based on probability user sets. Apply for primary, secondary or handgun weapon separately.|Description=
____________________________________________________________________________________________


|1.00|= Game version
| [unit,mode,chanceOptics,chanceAttach,chanceMuzzle,chanceUnderbarrel] call [[BIS_fnc_limitWeaponItems]] |Syntax=
____________________________________________________________________________________________
 
 
|p1= unit: [[Object]] - Target unit|Parameter 1=


| <pre>/*
|p2= mode: [[Number]] - (Optional, default 0) Can be:
Author: Vaclav "Watty Watts" Oliva
*1 = primary weapon
*2 = secondary weapon
*3 = handgun|Parameter 2=


Description:
|p3= chanceOptics: [[Number]] or [[Array]] in format ["itemClass",chance] - (Optional, default 50) Chance to keep optics from 0 to 100%
Keeps or remove unit's weapon attachments based on probability user sets. Apply for primary, secondary or handgun weapon separately.
- use 0-100 to randomize the chance of keeping the current attachment
- use 100 to always keep the attachment
- use 0 to always remove the attachment


Parameters:
*If you use ["itemClassname",number], the function will add that attachment if it passes the check. If not, current will be removed.|Parameter 3=
Select 0 - OBJECT: Target unit
Select 1 - NUMBER: Mode - 0 for primary weapon, 1 for secondary, 2 for handgun. Defult is 0.
Select 2 - NUMBER or ARRAY: Chance to keep the current optics, in %. Default is 50.
Select 3 - NUMBER or ARRAY: Chance to keep the current side attachment, in %. Default is 50.
Select 4 - NUMBER or ARRAY: Chance to keep the current muzzle attachment, in %. Default is 50.
Select 5 - NUMBER or ARRAY: Chance to keep the current underbarrel attachment, in %. Default is 50.


If you use ["itemClassname",number], the function will add that attachment if it passes the check. If not, current will be removed.
|p4= chanceAttach: [[Number]] or [[Array]] in format ["itemClass",chance] - (Optional, default 50) Chance to keep side attachments from 0 to 100%|Parameter 4=


Returns:
|p5= chanceMuzzle: [[Number]] or [[Array]] in format ["itemClass",chance] - (Optional, default 50) Chance to keep muzzle attachment from 0 to 100%|Parameter 5=
Boolean


Examples:
|p6= chanceUnderbarrel: [[Number]] or [[Array]] in format ["itemClass",chance] - (Optional, default 50) Chance to keep underbarrel attachment from 0 to 100%|Parameter 6=
_limit = [player] call BIS_fnc_limitWeaponItems;
_limit = [player,0,25,50,75,100] call BIS_fnc_limitWeaponItems;
_limit = [player,0,25,["acc_flashlight",50],75,100] call BIS_fnc_limitWeaponItems;
_limit = [player,2,["optic_Yorris",50]] call BIS_fnc_limitWeaponItems;
_limit = [player,0,["optic_lrps",100],["acc_pointer_ir",100],["muzzle_snds_B",100],["bipod_01_F_blk",100]] call BIS_fnc_limitWeaponItems;
*/


// Params
| [[Boolean]] |Return value=
</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_limitWeaponItems]]; --> |= Syntax
|x1= <code>[[player]] [[call]] [[BIS_fnc_limitWeaponItems]];</code>|Example 1=
|p1= |= Parameter 1


| |= Return value
|x2= <code>[ [ [[player]], 0, 25, 50, 75, 100 ] ]  [[call]] [[BIS_fnc_limitWeaponItems]];</code>|Example 2=
____________________________________________________________________________________________


|x1= <code></code> |=  
|x3= <code>[ [ [[player]], 0, ["optic_lrps",100], ["acc_pointer_ir",100], ["muzzle_snds_B",100], ["bipod_01_F_blk",100] ] ]  [[call]] [[BIS_fnc_limitWeaponItems]];</code>|Example 3=
____________________________________________________________________________________________
____________________________________________________________________________________________


| |= See also
| [[removeAllWeapons]], [[currentWeapon]], [[addWeapon]] |See also=
}}


}}


<h3 style="display:none">Notes</h3>
<h3 style="display:none">Notes</h3>

Revision as of 14:38, 19 June 2018

Hover & click on the images for description

Description

Description:
Keeps or remove unit's weapon attachments based on probability user sets. Apply for primary, secondary or handgun weapon separately.
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
[unit,mode,chanceOptics,chanceAttach,chanceMuzzle,chanceUnderbarrel] call BIS_fnc_limitWeaponItems
Parameters:
unit: Object - Target unit
mode: Number - (Optional, default 0) Can be:
  • 1 = primary weapon
  • 2 = secondary weapon
  • 3 = handgun
chanceOptics: Number or Array in format ["itemClass",chance] - (Optional, default 50) Chance to keep optics from 0 to 100%
  • If you use ["itemClassname",number], the function will add that attachment if it passes the check. If not, current will be removed.
chanceAttach: Number or Array in format ["itemClass",chance] - (Optional, default 50) Chance to keep side attachments from 0 to 100%
chanceMuzzle: Number or Array in format ["itemClass",chance] - (Optional, default 50) Chance to keep muzzle attachment from 0 to 100%
chanceUnderbarrel: Number or Array in format ["itemClass",chance] - (Optional, default 50) Chance to keep underbarrel attachment from 0 to 100%
Return Value:
Boolean

Examples

Example 1:
player call BIS_fnc_limitWeaponItems;
Example 2:
[ [ player, 0, 25, 50, 75, 100 ] ] call BIS_fnc_limitWeaponItems;
Example 3:
[ [ player, 0, ["optic_lrps",100], ["acc_pointer_ir",100], ["muzzle_snds_B",100], ["bipod_01_F_blk",100] ] ] call BIS_fnc_limitWeaponItems;

Additional Information

See also:
removeAllWeaponscurrentWeaponaddWeapon

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note


Notes

Bottom Section