reload: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "Category:Scripting Commands ArmA2" to "Category:Scripting Commands Arma 2")
m (Some wiki formatting)
 
(44 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[Category:Scripting Commands|RELOAD]]
{{RV|type=command
[[Category:Scripting Commands ArmA|RELOAD]]


{{Command|Comments=
|game1= arma1
____________________________________________________________________________________________
|version1= 1.00


| arma |Game name=
|game2= arma2
|version2= 1.00


|1.00|Game version=
|game3= arma2oa
____________________________________________________________________________________________
|version3= 1.50


| Reload all weapons |DESCRIPTION=
|game4= tkoh
____________________________________________________________________________________________
|version4= 1.00


| '''reload''' unitName |SYNTAX=
|game5= arma3
|version5= 0.50


|p1= unitName: [[Object]] |PARAMETER1=
|gr1= Weapons


| [[Nothing]] |RETURNVALUE=
|descr=
Main syntax: Reload first found muzzle that needs reloading (with some inconsistencies).<br>
Alternative syntax: this syntax allows to reload given muzzle with given magazine while playing proper animation.
If ''param'' is omitted or is empty string, default value is used. The default behaviour is to find the best matching magazine for the provided muzzle from the pool of available magazines.
If specific magazine is requested, the reload will fail if unit has run out of this type of magazines. If an empty array <sqf inline>[]</sqf> is given, the behaviour is similar to pressing the "Reload" key.
The command reloads the given muzzle but does not select it. In case of [[currentThrowable|throwable]] muzzles, each throwable has its own muzzle, they are autoreloaded after throw.
Using [[reload]] on the throwable muzzle will just swap throwable for another one of the same type from inventory.


|s1= [[reload]] unitName


|x1= <code>[[if]] ([[needReload]] [[player]] == 1) [[then]] {'''reload''' [[player]]};</code>|EXAMPLE1=
|p1= unitName: [[Object]]
____________________________________________________________________________________________


| [[reloadEnabled]], [[needReload]], [[enableReload]], [[setWeaponReloadingTime]] |SEEALSO=
|r1= [[Nothing]]


}}
|s2= unit [[reload]] [muzzle, magazine]
|s2since= arma3 2.08
 
|p21= unit: [[Object]] - person
 
|p22= muzzle: [[String]] - (Optional, default [[currentMuzzle]]) muzzle name or "" for the current muzzle.
 
|p23= magazine: [[String]] - (Optional, default given muzzle magazine) magazine name or "" for given muzzle's magazine. If given muzzle is [[currentMuzzle]] then [[currentMagazine]]
 
|r2= [[Boolean]] - [[true]] on success
 
|x1= <sqf>if (needReload player == 1) then { reload player };</sqf>


<h3 style="display:none">Notes</h3>
|x2= <sqf>player reload ["GL_3GL_F", "1Rnd_HE_Grenade_shell"];</sqf>
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
|x3= Reload current muzzle:
</dl>
<sqf>player reload [];</sqf>


<h3 style="display:none">Bottom Section</h3>
|seealso= [[reloadEnabled]] [[needReload]] [[enableReload]] [[setWeaponReloadingTime]]
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
}}
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]

Latest revision as of 10:06, 3 October 2023

Hover & click on the images for description

Description

Description:
Main syntax: Reload first found muzzle that needs reloading (with some inconsistencies).
Alternative syntax: this syntax allows to reload given muzzle with given magazine while playing proper animation. If param is omitted or is empty string, default value is used. The default behaviour is to find the best matching magazine for the provided muzzle from the pool of available magazines. If specific magazine is requested, the reload will fail if unit has run out of this type of magazines. If an empty array [] is given, the behaviour is similar to pressing the "Reload" key. The command reloads the given muzzle but does not select it. In case of throwable muzzles, each throwable has its own muzzle, they are autoreloaded after throw. Using reload on the throwable muzzle will just swap throwable for another one of the same type from inventory.
Groups:
Weapons

Syntax

Syntax:
reload unitName
Parameters:
unitName: Object
Return Value:
Nothing

Alternative Syntax

Syntax:
unit reload [muzzle, magazine]
Parameters:
unit: Object - person
muzzle: String - (Optional, default currentMuzzle) muzzle name or "" for the current muzzle.
magazine: String - (Optional, default given muzzle magazine) magazine name or "" for given muzzle's magazine. If given muzzle is currentMuzzle then currentMagazine
Return Value:
Boolean - true on success

Examples

Example 1:
if (needReload player == 1) then { reload player };
Example 2:
player reload ["GL_3GL_F", "1Rnd_HE_Grenade_shell"];
Example 3:
Reload current muzzle:
player reload [];

Additional Information

See also:
reloadEnabled needReload enableReload setWeaponReloadingTime

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