setWeaponReloadingTime: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]Arma[ _]3(\|.*)\]\]" to "{{GameCategory|arma3|Scripting Commands}}")
m (Some wiki formatting)
 
(97 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma2oa |Game name=
|game1= arma2oa
|1.60|Game version=
|version1= 1.60
|arg= local |Multiplayer Arguments=
|eff= local |Multiplayer Effects=
|gr1= Weapons |GROUP1=
____________________________________________________________________________________________


| Sets reloading 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. <!-- What the hell is that first sentence? Don't have time to fix now. -->|DESCRIPTION=
|game2= tkoh
____________________________________________________________________________________________
|version2= 1.00


| vehicle [[setWeaponReloadingTime]] [gunner, muzzleName, reloadTime] |SYNTAX=
|game3= arma3
|version3= 0.50


|p1= '''vehicle''': [[Object]] |PARAMETER1=
|arg= local


|p2= '''gunner''': [[Object]] - alive and able gunner operating desired turret |PARAMETER2=
|eff= local


|p3= '''muzzleName''': [[String]] - muzzle on desired turret |PARAMETER3=
|gr1= Weapons


|p4= '''reloadTime''': [[Number]] |PARAMETER4=
|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) ''magazine'' reloading time but changes '''the ammo reloading state''' before the next round is shot.}}


| [[Boolean]] - [[true]] if given weapon is found |RETURNVALUE=
|s1= vehicle [[setWeaponReloadingTime]] [gunner, muzzleName, reloadTime]
____________________________________________________________________________________________


|x1= <code>_success <nowiki>=</nowiki> _vehicle '''setWeaponReloadingTime''' [<nowiki/>[[gunner]] ([[vehicle]] [[player]]), [[currentMuzzle]] ([[gunner]] ([[vehicle]] [[player]])), 0.5];</code>|EXAMPLE1=
|p1= vehicle: [[Object]]


|x2= Boost RPM: <code>unit [[addEventHandler]] [<nowiki/>"Fired", {
|p2= gunner: [[Object]] - alive and able gunner operating the targeted turret
_this # 0 [[setWeaponReloadingTime]] [<nowiki/>_this # 0, _this # 2, 1/3<nowiki>]</nowiki>;
}<nowiki>]</nowiki>;</code>|EXAMPLE2=
____________________________________________________________________________________________


| [[weapons]], [[magazines]], [[selectWeapon]], [[loadMagazine]], [[weaponState]], [[reload]] |SEEALSO=
|p3= muzzleName: [[String]] - turret's muzzle


| |MPBEHAVIOUR=  
|p4= reloadTime: [[Number]] - in range 0..1 where 0: reload complete, 1: reload started
____________________________________________________________________________________________


|r1= [[Boolean]] - [[true]] if given weapon is found
|x1= <sqf>_success = _vehicle setWeaponReloadingTime [gunner vehicle player, currentMuzzle gunner vehicle player, 0.5];</sqf>
|x2= Boost RPM:
<sqf>
unit addEventHandler ["Fired", {
_this # 0 setWeaponReloadingTime [_this # 0, _this # 2, 1/3];
}];
</sqf>
|seealso= [[weaponReloadingTime]] [[weapons]] [[magazines]] [[selectWeapon]] [[loadMagazine]] [[weaponState]] [[reload]]
}}
}}


<h3 style='display:none'>Notes</h3>
{{Note
<dl class='command_description'>
|user= kju
<!-- Note Section BEGIN -->
|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.
<dd class="notedate">Posted on January 15, 2012
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>
<dt class="note">[[User:kju|kju]]
Works also for infantry weapons - probably useful weapons with longer reload time like sniper weapons or launchers:
<dd class="note">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];
  player setWeaponReloadingTime [player,currentWeapon player,0];
<br><br>No idea what's point of the return value.
No idea what's point of the return value.
}}


<dd class="notedate">Posted on May 14, 2017
{{Note
<dt class="note">[[User:Demellion|Demellion]]
|user= 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:  
|timestamp= 20170514
<code>player addEventHandler ["FiredMan",{
|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:  
params ["","_weapon","_muzzle"];
<sqf>
player addEventHandler ["FiredMan", {
params ["", "_weapon", "_muzzle"];
private _type = _weapon call BIS_fnc_itemType;
private _type = _weapon call BIS_fnc_itemType;
private _time = -1;
private _time = -1;
switch (_type select 1) do {
switch (_type select 1) do {
case 'SniperRifle' : {_time = 0.5};  
case "SniperRifle" : {_time = 0.5};
case 'AssaultRifle' : {};
case "AssaultRifle" : {};
case 'Handgun' : {};
case "Handgun" : {};
case 'Rifle' : {};
case "Rifle" : {};
case 'SubmachineGun' : {};
case "SubmachineGun" : {};
case 'MachineGun' : {};
case "MachineGun" : {};
case 'Mortar' : {};
case "Mortar" : {};
case 'GrenadeLauncher' : {};  
case "GrenadeLauncher" : {};
case 'BombLauncher' : {};  
case "BombLauncher" : {};
case 'MissileLauncher' : {};  
case "MissileLauncher" : {};
case 'RocketLauncher' : {};  
case "RocketLauncher" : {};
case 'Cannon' : {};  
case "Cannon" : {};
case 'Throw' : {};  
case "Throw" : {};
};
};
if (_time isEqualTo -1) exitWith {};
if (_time isEqualTo -1) exitWith {};
(vehicle player) setWeaponReloadingTime [(vehicle player), _muzzle, _time];
(vehicle player) setWeaponReloadingTime [(vehicle player), _muzzle, _time];
}];
}];
</code>
</sqf>
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]].
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]].
<!-- Note Section END -->
}}
</dl>
 
<h3 style='display:none'>Bottom Section</h3>
 
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
{{GameCategory|arma3|Scripting Commands}}
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Arma 2: Operation Arrowhead: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]

Latest revision as of 10:20, 13 May 2022

Hover & click on the images for description

Description

Description:
Sets reloading phase on the given weapon's current ammo round.
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.
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

See also:
weaponReloadingTime weapons magazines selectWeapon loadMagazine weaponState reload

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
kju - c
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.
Demellion - c
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.