getUnitLoadout: Difference between revisions

From Bohemia Interactive Community
(Added link to talk page for more details on the returned array)
mNo edit summary
 
(48 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
|arma3|= Game name
|1.58|= Game version
| Returns an array with all assigned items, weapons, containers and their stored items.
Detailed explanation of the returned array: [[Talk:getUnitLoadout]]


{{warning|This command is not final and might be changed in a near future.}}
|game1= arma3
| [[getUnitLoadout]] unit|= Syntax
|version1= 1.58
|p1= Unit: [[Object]] |= Parameter 1
| [[Array]] - Array containing all inventory items |= RETURNVALUE
|x1= <code>[[getUnitLoadout]] player;</code>|= EXAMPLE1


| [[setUnitLoadout]]|= SEEALSO
|gr1= Unit Inventory
|  |= MPBEHAVIOUR
 
|descr= Returns a '''[[Unit Loadout Array]]''' with all assigned items, weapons, containers and their stored items.
 
{{Feature|informative|
The config should contain the following standard entries: <spoiler>
<syntaxhighlight lang="cpp">
class MyLoadout
{
uniformClass = "U_B_CombatUniform_mcam";
backpack = "B_AssaultPack_mcamo";
linkedItems[] = { "V_PlateCarrier1_rgr", "H_HelmetB", "ItemCompass", "ItemWatch", "ItemRadio", "NVGoggles" };
weapons[] = { "arifle_MX_ACO_pointer_F", "hgun_P07_F" };
items[] = { "FirstAidKit", "FirstAidKit", "FirstAidKit" };
magazines[] = {
"30Rnd_65x39_caseless_mag", "16Rnd_9x21_Mag",
"SmokeShell",
"HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade",
"HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade",
"HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade"
};
};
</syntaxhighlight>
</spoiler>
}}
}}


<h3 style='display:none'>Bottom Section</h3>
|s1= [[getUnitLoadout]] unit
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
 
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
|p1= unit: [[Object]]
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
 
|r1= [[Unit Loadout Array]]
 
|s2= [[getUnitLoadout]] [unit, fullMagazines]
 
|p21= unit: [[Object]]


<h3 style='display:none'>Notes</h3>
|p22= fullMagazines: [[Boolean]] - [[true]] to top up used magazines
<dl class="command_description">
<!-- BEGIN Note Section -->
<!-- END Note Section -->
</dl>


<h3 style="display:none">Bottom Section</h3>
|r2= [[Unit Loadout Array]]
 
|s3= [[getUnitLoadout]] name
 
|p41= name: [[String]] - {{hl|CfgVehicles}} classname from which to extract the loadout
 
|r3= [[Unit Loadout Array]]
 
|s4= [[getUnitLoadout]] config
 
|p61= config: [[Config]] - loadout config class
 
|r4= [[Unit Loadout Array]]
 
|x1= <sqf>getUnitLoadout player;</sqf>
 
|x2= <sqf>getUnitLoadout [player, true];</sqf>
 
|x3= <sqf>getUnitLoadout "B_Soldier_F";</sqf>
 
|x4= <sqf>getUnitLoadout (configFile >> "CfgVehicles" >> "B_Soldier_F");</sqf>
 
|x5= <sqf>getUnitLoadout (missionConfigFile >> "MyLoadout");</sqf>
 
|seealso= [[setUnitLoadout]]
}}

Latest revision as of 07:55, 2 January 2026

Hover & click on the images for description

Description

Description:
Returns a Unit Loadout Array with all assigned items, weapons, containers and their stored items.
The config should contain the following standard entries:
class MyLoadout
{
	uniformClass = "U_B_CombatUniform_mcam";
	backpack = "B_AssaultPack_mcamo";
	linkedItems[] = { "V_PlateCarrier1_rgr", "H_HelmetB", "ItemCompass", "ItemWatch", "ItemRadio", "NVGoggles" };
	weapons[] = { "arifle_MX_ACO_pointer_F", "hgun_P07_F" };
	items[] = { "FirstAidKit", "FirstAidKit", "FirstAidKit" };
	magazines[] = {
		"30Rnd_65x39_caseless_mag", "16Rnd_9x21_Mag",
		"SmokeShell",
		"HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade",
		"HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade",
		"HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade"
	};
};
Groups:
Unit Inventory

Syntax 1

Syntax:
getUnitLoadout unit
Parameters:
unit: Object
Return Value:
Unit Loadout Array

Syntax 2

Syntax:
getUnitLoadout [unit, fullMagazines]
Parameters:
unit: Object
fullMagazines: Boolean - true to top up used magazines
Return Value:
Unit Loadout Array

Syntax 3

Syntax:
getUnitLoadout name
Parameters:
name: String - CfgVehicles classname from which to extract the loadout
Return Value:
Unit Loadout Array

Syntax 4

Syntax:
getUnitLoadout config
Parameters:
config: Config - loadout config class
Return Value:
Unit Loadout Array

Examples

Example 1:
getUnitLoadout player;
Example 2:
getUnitLoadout [player, true];
Example 3:
getUnitLoadout "B_Soldier_F";
Example 4:
getUnitLoadout (configFile >> "CfgVehicles" >> "B_Soldier_F");
Example 5:
getUnitLoadout (missionConfigFile >> "MyLoadout");

Additional Information

See also:
setUnitLoadout

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
Only post proven facts here! Add Note