setWeaponReloadingTime: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - ";[ ]+ " to "; ") |
Lou Montana (talk | contribs) (Fix description) |
||
Line 11: | Line 11: | ||
|arg= local | |arg= local | ||
|eff= local | |eff= local | ||
|gr1= Weapons | |gr1= Weapons | ||
|descr= Sets reloading phase on the given weapon's current ammo round. | |descr= Sets reloading '''phase''' on the given weapon's current ammo round. | ||
{{Feature|important|This command does '''not''' change a weapon's (e.g soldier's rifle) reloading time but changes '''the ammo reloading state''' before the next round is shot.}} | |||
|s1= vehicle [[setWeaponReloadingTime]] [gunner, muzzleName, reloadTime] | |s1= vehicle [[setWeaponReloadingTime]] [gunner, muzzleName, reloadTime] | ||
|p1= vehicle: [[Object]] | |p1= vehicle: [[Object]] | ||
|p2= gunner: [[Object]] - alive and able gunner operating | |p2= gunner: [[Object]] - alive and able gunner operating the targeted turret | ||
|p3= muzzleName: [[String]] - muzzle | |p3= muzzleName: [[String]] - turret's muzzle | ||
|p4= | |p4= reloadTime: [[Number]] - in range 0..1 where 0: reload complete, 1: reload started | ||
|r1= [[Boolean]] - [[true]] if given weapon is found | |r1= [[Boolean]] - [[true]] if given weapon is found | ||
|x1= <code>_success | |x1= <code>_success = _vehicle [[setWeaponReloadingTime]] [<nowiki/>[[gunner]] ([[vehicle]] [[player]]), [[currentMuzzle]] [[gunner]] [[vehicle]] [[player]], 0.5];</code> | ||
|x2= Boost RPM: <code>unit [[addEventHandler]] [ | |x2= Boost RPM: <code>unit [[addEventHandler]] ["Fired", { | ||
_this # 0 [[setWeaponReloadingTime]] [ | _this # 0 [[setWeaponReloadingTime]] [_this # 0, _this # 2, 1/3]; | ||
} | }];</code> | ||
|seealso= [[weaponReloadingTime]], [[weapons]], [[magazines]], [[selectWeapon]], [[loadMagazine]], [[weaponState]], [[reload]] | |seealso= [[weaponReloadingTime]], [[weapons]], [[magazines]], [[selectWeapon]], [[loadMagazine]], [[weaponState]], [[reload]] | ||
}} | }} | ||
< | {{Note | ||
|user= kju | |||
|timestamp= 20120115 | |||
|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. | |||
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.<br><br> | |||
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. | |||
}} | |||
{{Note | |||
|user= Demellion | |||
|timestamp= 20170514 | |||
|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: | |||
<code>[[player]] [[addEventHandler]] ["FiredMan", { | |||
[[params]] ["", "_weapon", "_muzzle"]; | |||
[[private]] _[[type]] [[a = b|=]] _weapon [[call]] [[BIS_fnc_itemType]]; | |||
[[private]] _[[time]] [[a = b|=]] [[-]]1; | |||
[[switch]] (_[[type]] [[select]] 1) [[do]] { | |||
[[case]] 'SniperRifle' [[a : b|:]] {_[[time]] [[a = b|=]] 0.5}; | |||
[[case]] 'AssaultRifle' [[a : b|:]] {}; | |||
[[case]] 'Handgun' [[a : b|:]] {}; | |||
<code>player addEventHandler ["FiredMan",{ | [[case]] 'Rifle' [[a : b|:]] {}; | ||
params ["","_weapon","_muzzle"]; | [[case]] 'SubmachineGun' [[a : b|:]] {}; | ||
private | [[case]] 'MachineGun' [[a : b|:]] {}; | ||
private | [[case]] 'Mortar' [[a : b|:]] {}; | ||
switch ( | [[case]] 'GrenadeLauncher' [[a : b|:]] {}; | ||
case 'SniperRifle' : { | [[case]] 'BombLauncher' [[a : b|:]] {}; | ||
case 'AssaultRifle' : {}; | [[case]] 'MissileLauncher' [[a : b|:]] {}; | ||
case 'Handgun' : {}; | [[case]] 'RocketLauncher' [[a : b|:]] {}; | ||
case 'Rifle' : {}; | [[case]] 'Cannon' [[a : b|:]] {}; | ||
case 'SubmachineGun' : {}; | [[case]] 'Throw' [[a : b|:]] {}; | ||
case 'MachineGun' : {}; | |||
case 'Mortar' : {}; | |||
case 'GrenadeLauncher' : {}; | |||
case 'BombLauncher' : {}; | |||
case 'MissileLauncher' : {}; | |||
case 'RocketLauncher' : {}; | |||
case 'Cannon' : {}; | |||
case 'Throw' : {}; | |||
}; | }; | ||
if ( | [[if]] (_[[time]] [[isEqualTo]] [[-]]1) [[exitWith]] {}; | ||
(vehicle player) setWeaponReloadingTime [(vehicle player), _muzzle, _time]; | ([[vehicle]] [[player]]) [[setWeaponReloadingTime]] [([[vehicle]] [[player]]), _muzzle, _time]; | ||
}]; | }]; | ||
</code> | </code> | ||
This [[ | This [[Arma 3: Event Handlers|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]]. | ||
}} |
Revision as of 23:39, 1 September 2021
Description
- Description:
- Sets reloading phase on the given weapon's current ammo round.
- Groups:
- Weapons
Syntax
- Syntax:
- vehicle setWeaponReloadingTime [gunner, muzzleName, reloadTime]
- Parameters:
- vehicle: Object
- gunner: Object - alive and able gunner operating the targeted turret
- muzzleName: String - turret's muzzle
- reloadTime: Number - in range 0..1 where 0: reload complete, 1: reload started
- Return Value:
- Boolean - true if given weapon is found
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
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 Jan 15, 2012 - 00:00 (UTC)
-
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 - 00:00 (UTC)
-
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.