selectWeapon: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (Text replacement - "{{uc:{{PAGENAME}}}}" to "") |
||
Line 107: | Line 107: | ||
[[Category:Scripting Commands OFP 1.46|SELECTWEAPON]] | [[Category:Scripting Commands OFP 1.46|SELECTWEAPON]] | ||
[[Category:Scripting Commands Armed Assault|SELECTWEAPON]] | [[Category:Scripting Commands Armed Assault|SELECTWEAPON]] | ||
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]] |
Revision as of 15:16, 27 September 2020
Description
- Description:
- Selects the given weapon.
Note: For weapons that have more than one muzzle, you have to input the muzzlename and not the weaponName.
The only weapons that have muzzleNames seem to be rifles with grenade launchers, handgrenades, smokeshells and satchels.
In all other cases the weaponName must be used. Fortunately, in OFP, in most cases, both names are the same. But check.
In ArmA the weaponNames and muzzleNames are different.
For muzzle names see cfgWeapons.
NOTE: The unit must be local to the PC on which command is executed. - Groups:
- Weapons
Syntax
- Syntax:
- unitName selectWeapon muzzleName
- Parameters:
- unitName: Object
- muzzleName: String
- Return Value:
- Nothing
Examples
- Example 1:
_soldier1 selectWeapon "LAWLauncher";
- Example 2:
player selectWeapon "M203Muzzle";
Additional Information
- See also:
- fireforceWeaponFireprimaryWeaponhandgunWeaponsecondaryWeaponweaponsaction SwitchWeaponaction SwitchMagazine
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
- Posted on 5 Aug, 2008
- Dr_Eyeball
-
Rather than simply using selectWeapon to select your default weapon after adding them to your player, it is recommended you use a script instead similar to the following, which caters for multiple muzzles:
SelectWeapon.sqf// Desc: select default weapon & handle multiple muzzles if (count weapons player > 0) then { private['_type', '_muzzles']; _type = ((weapons player) select 0); // check for multiple muzzles (eg: GL) _muzzles = getArray(configFile >> "cfgWeapons" >> _type >> "muzzles"); if (count _muzzles > 1) then { player selectWeapon (_muzzles select 0); } else { player selectWeapon _type; }; };
- Posted on 22 Mar, 2010
- MaestrO.fr
-
Can be used with primaryWeapon to select the primary weapon.
An example with muzzle care (see Dr_EyeBall note) :
if ( (primaryWeapon player) != "") then { private['_type', '_muzzles']; _type = primaryWeapon player; // check for multiple muzzles (eg: GL) _muzzles = getArray(configFile >> "cfgWeapons" >> _type >> "muzzles"); if (count _muzzles > 1) then { player selectWeapon (_muzzles select 0); } else { player selectWeapon _type; }; };
Bottom Section
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint version 1.27
- Operation Flashpoint: New Scripting Commands
- Operation Flashpoint: Scripting Commands
- Command Group: Weapons
- Scripting Commands: Global Effect
- Scripting Commands OFP 1.99
- Scripting Commands OFP 1.96
- Scripting Commands OFP 1.46
- Scripting Commands Armed Assault
- Scripting Commands Arma 2
- Scripting Commands Arma 3
- Scripting Commands Take On Helicopters