selectWeapon: Difference between revisions
Jump to navigation
Jump to search
m (classified) |
Dr Eyeball (talk | contribs) (SelectWeapon.sqf example) |
||
Line 31: | Line 31: | ||
<dl class="command_description"> | <dl class="command_description"> | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<dd class="notedate">Posted on 5 Aug, 2008</dd> | |||
<dt class="note">'''[[User:Dr_Eyeball|Dr_Eyeball]]'''</dt><dd class="note"> | |||
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:<br> | |||
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; | |||
}; | |||
}; | |||
</dd> | |||
<!-- Note Section END --> | <!-- Note Section END --> | ||
</dl> | </dl> |
Revision as of 08:49, 5 August 2008
Description
- Description:
- Selects the given weapon. Note that you have to input the muzzle and not the weapon name. Fortunately in most cases both names are the same. But check. For muzzle names see cfgWeapons.
- Groups:
- Uncategorised
Syntax
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; }; };