addWeaponWithAttachmentsCargo: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Implement latest changes)
m (Text replacement - "(\|[pr][0-9]+ *= *[^- ]*) *- *N([a-z ])" to "$1 - n$2")
 
(40 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Command|=
{{RV|type=command
____________________________________________________________________________________________


| arma3dev |Game=
|game1= arma3
|version1= 1.94


|1.95|Game Version=
|arg= global


|arg= global |Arguments in MP=
|eff= local


|eff= local |Effects in MP=
|gr1= Vehicle Inventory
____________________________________________________________________________________________


|  
|descr= Adds a weapon into the cargo space of a vehicle / box with given attachments / magazines. Ignores available cargo space. If the weapon class has any pre-attached items (LinkedItems), they are removed and new items, supplied via command arguments, are added.
Add a weapon into cargo space of vehicles, but with pre-attached attachments/magazines. Ignores available cargo space.<br>
This clears all pre-attached items if the weapon class has LinkedItems.<br><br>


{{Important|
|s1= container [[addWeaponWithAttachmentsCargo]] [weaponConfiguration, weaponsCount]
The cargo object this is applied on can be remote. But only local player will see the changed inventory.<br>
You most likely want [[addWeaponWithAttachmentsCargoGlobal]] in any multiplayer scenario
}}|Description=
____________________________________________________________________________________________


| container addWeaponWithAttachmentsCargo [weapon, muzzleAttachment, sideAttachment, topAttachment, bipodAttachment, [(primaryMagazine), (primaryAmmoCount), (secondaryMagazine), (secondaryAmmoCount)], (count)] |SYNTAX=
|p1= container: [[Object]] - container to add the weapon to. Might be a backpack, ammobox or vehicle.


|p1= container: [[Object]] - Container to add the weapon to, might be backpack, ammobox or vehicle. |Parameter 1=
|p2= weaponConfiguration: [[Array]] in format [weapon, muzzle, flashlight, optics, primaryMuzzle, secondaryMuzzle, bipod]
* weapon: [[String]] - Weapon class name from [[:Category:CfgWeapons|CfgWeapons]]
* muzzle: [[String]] - Muzzle attachment class name. Use "" if not needed.
* flashlight: [[String]] - Side rail attachment class name. Use "" if not needed.
* optics: [[String]] - Top rail attachment class name. Use "" if not needed.
* primaryMuzzle: [[Array]] in format [primaryMuzzleMagazine, primaryAmmoCount] - Use [] if not needed
** primaryMuzzleMagazine: [[String]] - Magazine class name
** primaryAmmoCount: [[Number]] - Ammo count in magazine (will be clipped to values between 0 and the maximum capacity of the magazine class)
* secondaryMuzzle: [[Array]] in format [secondaryMuzzleMagazine, secondaryAmmoCount] - Use [] if not needed
** secondaryMuzzleMagazine: [[String]] - Magazine class name
** secondaryAmmoCount: [[Number]] - Ammo count in magazine (will be clipped to values between 0 and the maximum capacity of the magazine class)
* bipod: [[String]] - Underbarrel rail attachment class name. Use "" if not needed.
This array has the same format as the array returned by the [[weaponsItems]] command.


|p2= weapon: [[String]] - Weapon classname. See the topic [[:Category:Weapons]] for reference about possible values. |Parameter 2=
|p3= weaponsCount: [[Number]] - number of weapons to add


|p3= muzzleAttachment: [[String]] - Muzzle attachment classname. If you don't want any just supply empty string. |Parameter 3=
|r1= [[Nothing]]


|p4= sideAttachment: [[String]] - Side rail attachment classname. If you don't want any just supply empty string. |Parameter 4=
|x1= <sqf>cursorObject addWeaponWithAttachmentsCargo [["arifle_MX_GL_F", "muzzle_snds_H", "", "optic_aco", ["30Rnd_65x39_caseless_mag", 15], ["3Rnd_HE_Grenade_shell", 2], ""], 2];</sqf>


|p5= topAttachment: [[String]] - Top rail attachment classname. If you don't want any just supply empty string. |Parameter 5=
|x2= Add five MX GL rifles, each with flashlight side attachment, a full 30 rounds magazine loaded into the gun and a full 3Rnd HE grenade magazine loaded into the grenade launcher:
<sqf>cursorObject addWeaponWithAttachmentsCargo [["arifle_MX_GL_F", "", "acc_flashlight", "", ["30Rnd_65x39_caseless_mag", 30], ["3Rnd_HE_Grenade_shell", 2], ""], 5];</sqf>


|p6= bipodAttachment: [[String]] - Underbarrel rail attachment classname. If you don't want any just supply empty string. |Parameter 6=
|x3= Add one MX rifle without any attachments or magazines event though the class has linked items:
<sqf>cursorObject addWeaponWithAttachmentsCargo [["arifle_MX_Holo_pointer_F", "", "", "", [], [], ""], 1];</sqf>


|p7= primaryMagazine (Optional): [[String]] - Primary magazine classname. If you don't want any just supply empty string or leave the whole magazine array empty. |Parameter 7=
|x4= Add all weapons on player with attachments:
<sqf>{ cursorObject addWeaponWithAttachmentsCargo [_x, 1] } forEach weaponsItems player;</sqf>


|p8= primaryAmmoCount (Optional): [[Number]] - Ammo count in primary magazine. If you want a full magazine you can use -1. |Parameter 8=
|seealso= [[addWeaponWithAttachmentsCargoGlobal]] [[weaponsItems]] [[addWeaponCargo]] [[addWeaponCargoGlobal]] [[clearWeaponCargo]] [[getWeaponCargo]]
}}


|p9= secondaryMagazine (Optional): [[String]] - Secondary magazine classname. If you don't want any just supply empty string or leave the whole magazine array empty. |Parameter 9=
{{Note
 
|user= Andrew_S90
|p10= secondaryAmmoCount (Optional): [[Number]] - Ammo count in secondary magazine. If you want a full magazine you can use -1. |Parameter 10=
|timestamp= 20201028210300
 
|text= This command also allows you to add a weapon with attachments directly to the players backpack.
|p11= count (Optional): [[Number]] - Number of weapons to add. Default is 1. |Parameter 11=
<sqf>(backpackContainer player) addWeaponWithAttachmentsCargo [["arifle_MX_F","muzzle_snds_H","acc_pointer_IR","optic_Hamr",["30Rnd_65x39_caseless_mag",30],[],"bipod_03_F_blk"], 1];</sqf>
 
}}
| [[Nothing]] |Return Value=
 
____________________________________________________________________________________________
 
|x1= <code>cursorTarget addWeaponWithAttachmentsCargo ["arifle_MX_GL_F", "muzzle_snds_H", "acc_flashlight", "optic_aco", "", ["30Rnd_65x39_caseless_mag", 15, "3Rnd_HE_Grenade_shell", 2], 2]
</code> |Example 1=
____________________________________________________________________________________________
 
|x2= <code>cursorTarget addWeaponWithAttachmentsCargo ["arifle_MX_GL_F", "", "acc_flashlight", "", "", ["30Rnd_65x39_caseless_mag", 30, "3Rnd_HE_Grenade_shell"], 2] </code> Add's two MX GL rifles with flashlight side attachment and a full 30 round magazine loaded into the gun, and 3Rnd HE grenade magazine loaded into the grenade launcher |Example 2=
____________________________________________________________________________________________
 
|x3= <code>cursorTarget addWeaponWithAttachmentsCargo ["arifle_MX_GL_F", "", "", "", "", []]</code> Same as a simple [[addWeaponCargo]]. This is the minimum number of arguments you need to supply. |Example 3=
____________________________________________________________________________________________


| [[addWeaponWithAttachmentsCargoGlobal]], [[addWeaponCargo]], [[addWeaponCargoGlobal]], [[clearWeaponCargo]], [[getWeaponCargo]], |See Also=
{{Note
|user= DreadedEntity
|timestamp= 20220402025200
|text= This command will let you add millions of weapons across multiple vehicles, but be warned, weird things start happening in-game:
<sqf>(vehicle player) addWeaponWithAttachmentsCargoGlobal [["arifle_MX_F","","","",[],[],""],1000000];</sqf>
I don't recommend running the above too many times in the console
}}
}}
<dl class="command_description">
<!-- BEGIN Note Section -->
<!-- For example:
<dd class="notedate">Posted on Month Day, Year - Time (UTC)</dd>
<dt class="note">'''[[User:User Name|User Name]]'''</dt>
<dd class="note">This is an example note. It is true and verifiable, and contains a little code snippet.
<code>[[if]] ([[_this]] == anExample) [[then]] { [[hint]] "Leave it here for others to read"; };</code></dd>
-->
<!-- END Note Section -->
</dl>
<h3 style="display:none">Bottom Section</h3>
<!-- Appropriate categories go here -->
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]

Latest revision as of 15:39, 8 November 2023

Hover & click on the images for description

Description

Description:
Adds a weapon into the cargo space of a vehicle / box with given attachments / magazines. Ignores available cargo space. If the weapon class has any pre-attached items (LinkedItems), they are removed and new items, supplied via command arguments, are added.
Groups:
Vehicle Inventory

Syntax

Syntax:
container addWeaponWithAttachmentsCargo [weaponConfiguration, weaponsCount]
Parameters:
container: Object - container to add the weapon to. Might be a backpack, ammobox or vehicle.
weaponConfiguration: Array in format [weapon, muzzle, flashlight, optics, primaryMuzzle, secondaryMuzzle, bipod]
  • weapon: String - Weapon class name from CfgWeapons
  • muzzle: String - Muzzle attachment class name. Use "" if not needed.
  • flashlight: String - Side rail attachment class name. Use "" if not needed.
  • optics: String - Top rail attachment class name. Use "" if not needed.
  • primaryMuzzle: Array in format [primaryMuzzleMagazine, primaryAmmoCount] - Use [] if not needed
    • primaryMuzzleMagazine: String - Magazine class name
    • primaryAmmoCount: Number - Ammo count in magazine (will be clipped to values between 0 and the maximum capacity of the magazine class)
  • secondaryMuzzle: Array in format [secondaryMuzzleMagazine, secondaryAmmoCount] - Use [] if not needed
    • secondaryMuzzleMagazine: String - Magazine class name
    • secondaryAmmoCount: Number - Ammo count in magazine (will be clipped to values between 0 and the maximum capacity of the magazine class)
  • bipod: String - Underbarrel rail attachment class name. Use "" if not needed.
This array has the same format as the array returned by the weaponsItems command.
weaponsCount: Number - number of weapons to add
Return Value:
Nothing

Examples

Example 1:
cursorObject addWeaponWithAttachmentsCargo [["arifle_MX_GL_F", "muzzle_snds_H", "", "optic_aco", ["30Rnd_65x39_caseless_mag", 15], ["3Rnd_HE_Grenade_shell", 2], ""], 2];
Example 2:
Add five MX GL rifles, each with flashlight side attachment, a full 30 rounds magazine loaded into the gun and a full 3Rnd HE grenade magazine loaded into the grenade launcher:
cursorObject addWeaponWithAttachmentsCargo [["arifle_MX_GL_F", "", "acc_flashlight", "", ["30Rnd_65x39_caseless_mag", 30], ["3Rnd_HE_Grenade_shell", 2], ""], 5];
Example 3:
Add one MX rifle without any attachments or magazines event though the class has linked items:
cursorObject addWeaponWithAttachmentsCargo [["arifle_MX_Holo_pointer_F", "", "", "", [], [], ""], 1];
Example 4:
Add all weapons on player with attachments:
{ cursorObject addWeaponWithAttachmentsCargo [_x, 1] } forEach weaponsItems player;

Additional Information

See also:
addWeaponWithAttachmentsCargoGlobal weaponsItems addWeaponCargo addWeaponCargoGlobal clearWeaponCargo getWeaponCargo

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
Andrew_S90 - c
Posted on Oct 28, 2020 - 21:03 (UTC)
This command also allows you to add a weapon with attachments directly to the players backpack.
(backpackContainer player) addWeaponWithAttachmentsCargo [["arifle_MX_F","muzzle_snds_H","acc_pointer_IR","optic_Hamr",["30Rnd_65x39_caseless_mag",30],[],"bipod_03_F_blk"], 1];
DreadedEntity - c
Posted on Apr 02, 2022 - 02:52 (UTC)
This command will let you add millions of weapons across multiple vehicles, but be warned, weird things start happening in-game:
(vehicle player) addWeaponWithAttachmentsCargoGlobal [["arifle_MX_F","","","",[],[],""],1000000];
I don't recommend running the above too many times in the console