removeWeapon: Difference between revisions

From Bohemia Interactive Community
m (add. see also)
m (Some wiki formatting)
 
(64 intermediate revisions by 13 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| ofp |= Game name
|game1= ofp
|version1= 1.00


|1.00|= Game version
|game2= ofpe
____________________________________________________________________________________________
|version2= 1.00


| Remove weapon from the unit. <br>
|game3= arma1
'''Note''': You may create '''''invalid'''' combinations with this command. When doing so, application behaviour is undefined. |= Description
|version3= 1.00
____________________________________________________________________________________________


| [[Object#Unit|Unit]] '''removeWeapon''' "weaponName" |= Syntax
|game4= arma2
|version4= 1.00


|p1= weaponName: [[String]] |= Parameter 1
|game5= arma2oa
|version5= 1.50


| [[Nothing]] |= Return value
|game6= tkoh
____________________________________________________________________________________________
|version6= 1.00
 
|x1= <code>[[player]] removeWeapon "M16"</code> |= Example 1
____________________________________________________________________________________________


| [[addWeapon]], [[removeAllWeapons]] |= See also
|game7= arma3
|version7= 0.50


|eff= global
|arg= local
|gr1= Unit Inventory
|gr2= Vehicle Inventory
|descr= Remove weapon from a unit. The unit must be [[Multiplayer Scripting#Locality|local]] to the computer where command is executed.
For a global version of this command, see [[removeWeaponGlobal]].
{{Feature|informative|
It is possible to create invalid combinations with this command (e.g attempting to remove a weapon that a unit does not possess).
When doing so, application behaviour is undefined.
}}
}}


<h3 style="display:none">Notes</h3>
|s1= unit [[removeWeapon]] weapon
<dl class="command_description">
<!-- Note Section BEGIN -->
You may create invalid combinations with this function.


When doing so, application behaviour is undefined.
|p1= unit: [[Object]] - unit or vehicle
<!-- Note Section END -->
</dl>


<h3 style="display:none">Bottom Section</h3>
|p2= weapon: [[String]] - weapon class name
[[Category:Scripting Commands|REMOVEWEAPON]]
 
[[Category:Scripting Commands OFP 1.96|REMOVEWEAPON]]
|r1= [[Nothing]]
[[Category:Scripting Commands OFP 1.46|REMOVEWEAPON]]
 
[[Category:Scripting Commands ArmA|REMOVEWEAPON]]
|s2= object [[removeWeapon]] [weapon, autoselect]
[[Category:Command_Group:_Unit_Control|{{uc:{{PAGENAME}}}}]]
|s2since= arma3 2.20
[[Category:Command_Group:_Weapons|{{uc:{{PAGENAME}}}}]]
 
|p21= object: [[Object]] - unit or vehicle
 
|p22= weapon: [[String]] - weapon class name
 
|p23= autoselect: [[String]] - (Optional, default [[true]]) [[false]] to abort weapon autoselection when removing primary weapon.
 
|r2= [[Nothing]]
 
|x1= <sqf>player removeWeapon "BAF_L85A2_RIS_SUSAT";</sqf>
 
|x2= <sqf>An_2 removeWeapon "M240_veh";</sqf>
 
|seealso= [[removeWeaponGlobal]] [[addWeapon]] [[removeAllWeapons]]
}}
 
{{Note
|user= zGuba
|timestamp= 20090527143000
|text= CTD may occur in certain conditions: when shooter is AI and is currently shooting at target in some proximity (tested with M136 on ACE 1.08 and Compact Fix 1.14H+). Even "dropweapon" action may cause CTD with AI.
}}

Latest revision as of 00:27, 15 October 2025

Hover & click on the images for description

Description

Description:
Remove weapon from a unit. The unit must be local to the computer where command is executed. For a global version of this command, see removeWeaponGlobal.
It is possible to create invalid combinations with this command (e.g attempting to remove a weapon that a unit does not possess). When doing so, application behaviour is undefined.
Groups:
Unit InventoryVehicle Inventory

Syntax

Syntax:
unit removeWeapon weapon
Parameters:
unit: Object - unit or vehicle
weapon: String - weapon class name
Return Value:
Nothing

Alternative Syntax

Syntax:
object removeWeapon [weapon, autoselect]
Parameters:
object: Object - unit or vehicle
weapon: String - weapon class name
autoselect: String - (Optional, default true) false to abort weapon autoselection when removing primary weapon.
Return Value:
Nothing

Examples

Example 1:
player removeWeapon "BAF_L85A2_RIS_SUSAT";
Example 2:
An_2 removeWeapon "M240_veh";

Additional Information

See also:
removeWeaponGlobal addWeapon removeAllWeapons

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
zGuba - c
Posted on May 27, 2009 - 14:30 (UTC)
CTD may occur in certain conditions: when shooter is AI and is currently shooting at target in some proximity (tested with M136 on ACE 1.08 and Compact Fix 1.14H+). Even "dropweapon" action may cause CTD with AI.