selectWeapon: Difference between revisions
Jump to navigation
Jump to search
Dr Eyeball (talk | contribs) (SelectWeapon.sqf example) |
mNo edit summary |
||
Line 7: | Line 7: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Selects the given weapon. Note that you have to input the <u> | | Selects the given weapon. | ||
Note: For weapons that have more than one muzzle, you have to input the <u>muzzlename</u> 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 [[:Category:Weapons|cfgWeapons]]. |= Description | For muzzle names see [[:Category:Weapons|cfgWeapons]]. |= Description | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| | | unitName '''selectWeapon''' muzzleName |= Syntax | ||
|p1= | |p1= unitName: [[Object]] |= Parameter 1 | ||
|p2= muzzleName: [[String]] |= Parameter 2 | |||
| [[Nothing]] |= Return value | | [[Nothing]] |= Return value |
Revision as of 17:31, 25 January 2009
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.
- Groups:
- Uncategorised
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:
- See also needed
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; }; };