setWeaponReloadingTime: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(true is weapon found)
(extended details with examples.)
Line 44: Line 44:
<br><br>No idea what's point of the return value.
<br><br>No idea what's point of the return value.


<dd class="notedate">Posted on May 14, 2017
<dt class="note">'''[[User:Demellion|Demellion]]'''
<dd class="note">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>while {true} do {
    private _muzzle = currentMuzzle player;
    if (_muzzle isEqualType "") then {
        (vehicle player) setWeaponReloadingTime [player, _muzzle, 0];
    };
    uiSleep 0.15; // loop speed controls the reload time
};
</code>
'''WARNING:''' Current script controls muzzle speed not by reloadTime argument, but with loop speed. If the reloadTime > 0 weapon will stuck reloading. You might use alternative code for more accurate actions. 
<!-- Note Section END -->
<!-- Note Section END -->
</dl>
</dl>

Revision as of 06:15, 14 May 2017

Hover & click on the images for description

Description

Description:
Sets states and/or makes an action of/on weapon. Reload time is between 0 and 1 inclusive, where 1 is 100% of maximum reloading time.
Groups:
Uncategorised

Syntax

Syntax:
vehicle setWeaponReloadingTime [gunner, muzzleName, reloadTime]
Parameters:
vehicle: Object
[gunner, muzzleName, reloadTime]: Array
gunner: Object - alive and able gunner operating desired turret
muzzleName: String - muzzle on desired turret
reloadTime: Number
Return Value:
Boolean - true if given weapon is found

Examples

Example 1:
_done = _vehicle setWeaponReloadingTime [gunner (vehicle player), currentMuzzle (gunner (vehicle player)), 0.5];

Additional Information

See also:
weaponsmagazinesselectWeaponloadMagazineweaponState

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 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: while {true} do { private _muzzle = currentMuzzle player; if (_muzzle isEqualType "") then { (vehicle player) setWeaponReloadingTime [player, _muzzle, 0]; }; uiSleep 0.15; // loop speed controls the reload time }; WARNING: Current script controls muzzle speed not by reloadTime argument, but with loop speed. If the reloadTime > 0 weapon will stuck reloading. You might use alternative code for more accurate actions.

Bottom Section