setWeaponReloadingTime: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<!-- Note Section [A-Z]+ --> " to "")
m (Text replacement - "<dl class='command_description'>" to "<dl class="command_description">")
Line 30: Line 30:
}}
}}


<dl class='command_description'>
<dl class="command_description">
<dt><dt>
<dt><dt>
<dd class="notedate">Posted on January 15, 2012</dd>
<dd class="notedate">Posted on January 15, 2012</dd>

Revision as of 17:00, 21 May 2021

Hover & click on the images for description

Description

Description:
Description needed
Groups:
Weapons

Syntax

Syntax:
Syntax needed
Parameters:
vehicle: Object
gunner: Object - alive and able gunner operating desired turret
muzzleName: String - muzzle on desired turret
reloadTime: Number
Return Value:
Return value needed

Examples

Example 1:
_success = _vehicle setWeaponReloadingTime [gunner (vehicle player), currentMuzzle (gunner (vehicle player)), 0.5];
Example 2:
Boost RPM: unit addEventHandler ["Fired", { _this # 0 setWeaponReloadingTime [_this # 0, _this # 2, 1/3]; }];

Additional Information

See also:
weaponsmagazinesselectWeaponloadMagazineweaponStatereload

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 January 15, 2012
kju
The description is confusing to me. What the command essential does is to set the reloading state/time of the given weapon. For example you can fire a missile, and make the weapon available to fire again instantly if you apply 0. Or you can delay or stop the reload event indefinitely. The 0-1 range is a percentage - the reload time is taken from the weapons's config value (either reloadTime or magazineReloadTime - not sure). The effect is one time only each - it does not modify the weapon's general reload time.

Works also for infantry weapons - probably useful weapons with longer reload time like sniper weapons or launchers: player setWeaponReloadingTime [player,currentWeapon player,0];

No idea what's point of the return value.
Posted on May 14, 2017
Demellion
Note that setWeaponReloadingTime is only having effect on a current weapon state (loaded projectile) so since the projectile is fired the next one will be reverted to a weapon config defaults. To keep the fire rate speed changed over time, use this code: player addEventHandler ["FiredMan",{ params ["","_weapon","_muzzle"]; private _type = _weapon call BIS_fnc_itemType; private _time = -1; switch (_type select 1) do { case 'SniperRifle' : {_time = 0.5}; case 'AssaultRifle' : {}; case 'Handgun' : {}; case 'Rifle' : {}; case 'SubmachineGun' : {}; case 'MachineGun' : {}; case 'Mortar' : {}; case 'GrenadeLauncher' : {}; case 'BombLauncher' : {}; case 'MissileLauncher' : {}; case 'RocketLauncher' : {}; case 'Cannon' : {}; case 'Throw' : {}; }; if (_time isEqualTo -1) exitWith {}; (vehicle player) setWeaponReloadingTime [(vehicle player), _muzzle, _time]; }]; This Event Handler makes the gun of specific type shoot at a desired rate on each weapon state (sniper rifle will shoot 50% faster in this example). For more information about weapon kinds are there, visit BIS_fnc_itemType.