setWeaponReloadingTime: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) mNo edit summary |
Lou Montana (talk | contribs) m (Text replacement - "\<dt class\=\"note\"\>\'\'\'\[\[(.*)\]\]\'\'\'" to "<dt class="note">$1") |
||
(17 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{Command|= | {{Command|Comments= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| arma2oa | | | arma2oa |Game name= | ||
|1.60| | |1.60|Game version= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| 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. |= | | 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. |DESCRIPTION= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| vehicle '''setWeaponReloadingTime''' [gunner, muzzleName, reloadTime] |= | | vehicle '''setWeaponReloadingTime''' [gunner, muzzleName, reloadTime] |SYNTAX= | ||
|p1= vehicle: [[Object]] |= | |p1= vehicle: [[Object]] |PARAMETER1= | ||
|p2= [gunner, muzzleName, reloadTime]: [[Array]] |PARAMETER2= | |||
|p3= gunner: [[Object]] - alive and able gunner operating desired turret|PARAMETER3= | |||
|p4= muzzleName: [[String]] - muzzle on desired turret|PARAMETER4= | |||
|p5= reloadTime: [[Number]]|= | |p5= reloadTime: [[Number]]|= | ||
| [[Boolean]] - [[true]] | | [[Boolean]] - [[true]] if given weapon is found|RETURNVALUE= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1= <code>_done <nowiki>=</nowiki> _vehicle '''setWeaponReloadingTime''' <nowiki | |x1= <code>_done <nowiki>=</nowiki> _vehicle '''setWeaponReloadingTime''' [<nowiki/>[[gunner]] ([[vehicle]] [[player]]), [[currentMuzzle]] ([[gunner]] ([[vehicle]] [[player]])), 0.5];</code>|EXAMPLE1= | ||
|x2= Boosts RPM:<code>unit [[addEventHandler]] [<nowiki/>"Fired",{ | |||
_this#0 [[setWeaponReloadingTime]] [<nowiki/>_this#0,_this#2,1/3<nowiki>]</nowiki> ; | |||
}<nowiki>]</nowiki> ;</code>|EXAMPLE2= | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [[weapons]], [[magazines]], [[selectWeapon]], [[loadMagazine]], [[weaponState]] |= | | [[weapons]], [[magazines]], [[selectWeapon]], [[loadMagazine]], [[weaponState]], [[reload]] |SEEALSO= | ||
| |= | | |MPBEHAVIOUR= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Line 37: | Line 43: | ||
<dd class="notedate">Posted on January 15, 2012 | <dd class="notedate">Posted on January 15, 2012 | ||
<dt class="note"> | <dt class="note">[[User:kju|kju]] | ||
<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. | <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. | 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. | ||
Line 44: | Line 50: | ||
<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>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]; | |||
}]; | |||
</code> | |||
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 --> | <!-- Note Section END --> | ||
</dl> | </dl> | ||
Line 50: | Line 83: | ||
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting Commands | [[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]] | ||
[[Category: | [[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]] | ||
[[Category: | [[Category:Arma 2: Operation Arrowhead: New Scripting Commands List|{{uc:{{PAGENAME}}}}]] |
Revision as of 16:23, 17 May 2020
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];
- Example 2:
- Boosts 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
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:
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.
Bottom Section
Categories:
- Scripting Commands
- Introduced with Arma 2: Operation Arrowhead version 1.60
- Arma 2: Operation Arrowhead: New Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Command Group: Uncategorised
- Scripting Commands Arma 2
- Scripting Commands Arma 3
- Scripting Commands Take On Helicopters
- Arma 2: Operation Arrowhead: New Scripting Commands List