{"name":"setWeaponReloadingTime","title":"setWeaponReloadingTime","type":"command","url":"https://community.bistudio.com/wiki/setWeaponReloadingTime","revid":364086,"updated":"2024-05-03T19:33:29Z","groups":["Weapons"],"status":"ok","games":{"arma2oa":"1.60","tkoh":"1.00","arma3":"0.50"},"since":"arma2oa 1.60","arma3_since":"0.50","locality":{"argument":"local","effect":"local"},"description":"Sets reloading **phase** on the given weapon's current ammo round.\n\n> [!IMPORTANT]\n> This command does **not** change a weapon's (e.g soldier's rifle) *magazine* reloading time but changes **the ammo reloading state** before the next round is shot.","syntaxes":[{"syntax":"vehicle setWeaponReloadingTime [gunner, muzzleName, reloadTime]","params":[{"name":"vehicle","type":"Object","type_expr":"Object"},{"name":"gunner","type":"Object","description":"alive and able gunner operating the targeted turret","type_expr":"Object"},{"name":"muzzleName","type":"String","description":"turret's muzzle","type_expr":"String"},{"name":"reloadTime","type":"Number","description":"in range 0..1 where 0: reload complete, 1: reload started","type_expr":"Number"}],"returns":{"type":"Boolean","type_expr":"Boolean","description":"true if given weapon is found"},"form":"binary","left":{"text":"vehicle"},"right":{"text":"[gunner, muzzleName, reloadTime]"}}],"examples":[{"code":["_success = _vehicle setWeaponReloadingTime [gunner vehicle player, currentMuzzle gunner vehicle player, 0.5];"]},{"text":"Boost RPM:\n\n```sqf\nunit addEventHandler [\"Fired\", {\n    _this # 0 setWeaponReloadingTime [_this # 0, _this # 2, 1/3];\n}];\n```","code":["unit addEventHandler [\"Fired\", {\n\t_this # 0 setWeaponReloadingTime [_this # 0, _this # 2, 1/3];\n}];"]}],"see_also":["weaponReloadingTime","weapons","magazines","selectWeapon","loadMagazine","weaponState","reload"],"notes":[{"user":".kju","text":"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.\nOr 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.\n\nWorks also for infantry weapons - probably useful weapons with longer reload time like sniper weapons or launchers:\n\n```\nplayer setWeaponReloadingTime [player,currentWeapon player,0];\n```\n\nNo idea what's point of the return value."},{"user":"Demellion","text":"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:\n\n```sqf\nplayer addEventHandler [\"FiredMan\", {\n    params [\"\", \"_weapon\", \"_muzzle\"];\n    private _type = _weapon call BIS_fnc_itemType;\n    private _time = -1;\n    switch (_type select 1) do {\n        case \"SniperRifle\" : {_time = 0.5};\n        case \"AssaultRifle\" : {};\n        case \"Handgun\" : {};\n        case \"Rifle\" : {};\n        case \"SubmachineGun\" : {};\n        case \"MachineGun\" : {};\n        case \"Mortar\" : {};\n        case \"GrenadeLauncher\" : {};\n        case \"BombLauncher\" : {};\n        case \"MissileLauncher\" : {};\n        case \"RocketLauncher\" : {};\n        case \"Cannon\" : {};\n        case \"Throw\" : {};\n    };\n    if (_time isEqualTo -1) exitWith {};\n    (vehicle player) setWeaponReloadingTime [(vehicle player), _muzzle, _time];\n}];\n```\n\nThis 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."}]}