BIS fnc addWeapon: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "<code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^<]*)<\/code>" to "<code>$1$2$3</code>") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 26: | Line 26: | ||
|x1= Add 6 dual-purpose magazines and the underwater gun to the player: | |x1= Add 6 dual-purpose magazines and the underwater gun to the player: | ||
< | <sqf>newGun = [player, "arifle_SDAR_F", 6] call BIS_fnc_addWeapon;</sqf> | ||
|x2= Adds 2 × 30 Rnd Stanag Tracer (Red) magazines to bluforUnit, with an Mk20_F: | |x2= Adds 2 × 30 Rnd Stanag Tracer (Red) magazines to bluforUnit, with an Mk20_F: | ||
Line 37: | Line 37: | ||
}} | }} | ||
{{Note | |||
|user= Tryteyker- | |||
|timestamp= 20140929181300 | |||
|text= 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]]. | |||
}} | |||
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]]. | |||
Revision as of 17:08, 13 July 2022
Description
- Description:
- Adds a weapon to the specified unit, with magazine classnames taken from the weapon's config (in CfgWeapons). This function does not remove magazines nor weapons prior to adding the new weapon, so that still has to be done manually.
- Execution:
- call
- Groups:
- InventoryWeapons
Syntax
- Syntax:
- [unit, weaponClassName, quantity, type] call BIS_fnc_addWeapon
- 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)
- Return Value:
- String - Primary(!) muzzle name of weapon.
Examples
- Example 1:
- Add 6 dual-purpose magazines and the underwater gun to the player:
- Example 2:
- Adds 2 × 30 Rnd Stanag Tracer (Red) magazines to bluforUnit, with an Mk20_F:
- Example 3:
- Alternative syntax of second example, with magazine name written out:
Additional Information
- See also:
- addWeapon selectWeapon
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 Sep 29, 2014 - 18:13 (UTC)
- 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.