Killzone_Kid
If you do not remove weapon first, using this command from dedicated server will duplicate weapon.
Results appear below as you type; use the arrow keys to move through them.
Command · also in Unit Inventory · Markdown · JSON · original wiki page
Add a weapon to a unit. Infantry units can only carry weapons in their respective slots (primary, secondary and handgun), the addWeaponGlobal command will replace the weapon currently in a slot with the added weapon if it shares the same slot. This command can link items to respective slots as well, in which case the functionality is identical to linkItem.
To make sure the added weapon is loaded and ready, add the magazine first.
Note
This command was broken when used on dedicated server and fixed on Arma 3 v2.00.
object addWeaponGlobal weapon
Parameters:
Returns: Nothing
since arma3 2.20
object addWeaponGlobal [weapon, autoselect]
Parameters:
object: Object - unit or vehicle to add the weapon toweapon: String - weapon class name. See the topic Category:Weapons for reference about possible values.autoselect: String - (Optional, default true) false to abort weapon autoselection if no weapon was selected.Returns: Nothing
{
_x addMagazineGlobal "Laserbatteries";
_x addWeaponGlobal "Laserdesignator";
} forEach allUnits;
{
if (typeOf _x == "O_Heli_Attack_02_black_F") then
{
_x addMagazineGlobal "38Rnd_80mm_rockets";
_x addWeaponGlobal "rockets_Skyfire";
};
} forEach vehicles;
removeWeaponGlobal · addWeapon · addMagazine · addMagazineGlobal
If you do not remove weapon first, using this command from dedicated server will duplicate weapon.