BIS fnc addWeapon: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "{{Inline code|" to "{{ic|")
m (Text replacement - "<dl class="command_description"> <dd class="notedate">" to "<dl class="command_description"> <dt></dt> <dd class="notedate">")
Line 44: Line 44:
<!-- CONTINUE Notes -->
<!-- CONTINUE Notes -->
<dl class="command_description">
<dl class="command_description">
<dt></dt>
<dd class="notedate">Posted on September 29, 2014 - 18:13 (UTC)</dd>
<dd class="notedate">Posted on September 29, 2014 - 18:13 (UTC)</dd>
<dt class="note">[[User:Tryteyker-|Tryteyker-]]</dt>
<dt class="note">[[User:Tryteyker-|Tryteyker-]]</dt>

Revision as of 13:29, 5 April 2021

Hover & click on the images for description

Description

Description:
Description needed
Execution:
call
Groups:
InventoryWeapons

Syntax

Syntax:
Syntax needed
Parameters:
unit: Object - Unit to add weapon to.
weaponClassName: String - Weapon Classname (found in CfgWeapons).
quantity: Number - Amount of magazines.
type: Number or String - (Optional, default 0)
  • Number - Index of magazine name that should be used - found in magazines = {} array.
  • String - Magazine name to be used.
Return Value:
Return value needed

Examples

Example 1:
Add 6 dual-purpose magazines and the underwater gun to the player: newGun = [player, "arifle_SDAR_F", 6] call BIS_fnc_addWeapon;
Example 2:
Adds 2 × 30 Rnd Stanag Tracer (Red) magazines to bluforUnit, with an Mk20_F: newGun = [bluforUnit, "arifle_Mk20_F", 2, 1] call BIS_fnc_addWeapon;
Example 3:
Alternative syntax of second example, with magazine name written out: newGun = [bluforUnit, "arifle_Mk20_F", 2, "30Rnd_556x45_Stanag_Tracer_red"] call BIS_fnc_addWeapon;

Additional Information

See also:
addWeaponselectWeapon

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



Posted on September 29, 2014 - 18:13 (UTC)
Tryteyker-
This function only returns the primary muzzle name of a gun. For more info on how to select guns' secondary muzzle names (like an underhand grenade launcher), view the notes on selectWeapon.