getUnitLoadout: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(empty loadout)
m (Remove syntaxhighlight spoiler hack)
 
(34 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|Comments=  
{{RV|type=command
|arma3|name= Game name
 
|1.58|version= Game version
|game1= arma3
| Returns a [[Unit Loadout Array]] with all assigned items, weapons, containers and their stored items. When [[String]] for class name is supplied, the command will search <tt>CfgVehicles</tt> for the given class in order to extract the loadout from config. If [[Config]] is given, it will search given config (including [[missionConfigFile | mission config]]) for the loadout information. In either case, the config should contain the following entries, which is standard for any unit class, for example:
|version1= 1.58
<syntaxhighlight lang=cpp>
 
|gr1= Unit Inventory
 
|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
class MyLoadout
{
{
uniformClass = "U_B_CombatUniform_mcam";
uniformClass = "U_B_CombatUniform_mcam";
backpack = "B_AssaultPack_mcamo";
backpack = "B_AssaultPack_mcamo";
linkedItems[] = {"V_PlateCarrier1_rgr","H_HelmetB","ItemCompass","ItemWatch","ItemRadio","NVGoggles"};
linkedItems[] = { "V_PlateCarrier1_rgr", "H_HelmetB", "ItemCompass", "ItemWatch", "ItemRadio", "NVGoggles" };
weapons[] = {"arifle_MX_ACO_pointer_F","hgun_P07_F"};
weapons[] = { "arifle_MX_ACO_pointer_F", "hgun_P07_F" };
items[] = {"FirstAidKit","FirstAidKit","FirstAidKit"};
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","HandGrenade","HandGrenade","HandGrenade"};
magazines[] = {
};</syntaxhighlight>
"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>
}}
 
|s1= [[getUnitLoadout]] unit
 
|p1= unit: [[Object]]


{{Informative | Since Arma 3 v1.92 an empty loadout could be obtained with <tt>[[getUnitLoadout]] ([[configFile]] >> "EmptyLoadout")</tt>}}
|r1= [[Array]] format [[Unit Loadout Array]]


|DESCRIPTION=
|s2= [[getUnitLoadout]] [unit, fullMagazines]
____________________________________________________________________________________________


| [[getUnitLoadout]] unit |SYNTAX1=
|p21= unit: [[Object]]
|p1= unit: [[Object]] |PARAMETER1=


| [[Array]] - [[Unit Loadout Array]] |RETURNVALUE1=
|p22= fullMagazines: [[Boolean]] - [[true]] to top up used magazines
____________________________________________________________________________________________
|s2= [[getUnitLoadout]] [unit, fullMagazines] |SYNTAX2=
|p21 = [unit, fullMagazines]: [[Array]] |PARAMETER21=
|p22= unit: [[Object]] |PARAMETER22=
|p23= fullMagazines: [[Boolean]] - [[true]] to top up used magazines|PARAMETER23=


|r2= [[Array]] - [[Unit Loadout Array]] |RETURNVALUE2=
|r2= [[Array]] format [[Unit Loadout Array]]
____________________________________________________________________________________________
|s3= [[getUnitLoadout]] name |SYNTAX3=
|p41= name: [[String]] - class name (see description)|PARAMETER41=


|r3= [[Array]] - [[Unit Loadout Array]] |RETURNVALUE3=
|s3= [[getUnitLoadout]] name
____________________________________________________________________________________________
|s4= [[getUnitLoadout]] config |SYNTAX4=
|p61= config: [[Config]] - config class (see description) |PARAMETER61=


|r4= [[Array]] - [[Unit Loadout Array]] |RETURNVALUE4=
|p41= name: [[String]] - {{hl|CfgVehicles}} classname from which to extract the loadout
____________________________________________________________________________________________
|x1= <code>[[getUnitLoadout]] [[player]];</code>|EXAMPLE1=
|x2= <code>[[getUnitLoadout]] <nowiki>[</nowiki>[[player]], [[true]]];</code>|EXAMPLE2=
|x3= <code>[[getUnitLoadout]] "B_Soldier_F";</code>|EXAMPLE3=
|x4= <code>[[getUnitLoadout]] ([[configFile]] >> "CfgVehicles" >> "B_Soldier_F");</code>|EXAMPLE4=
|x5= <code>[[getUnitLoadout]] ([[missionConfigFile]] >> "MyLoadout");</code>|EXAMPLE5=


| [[setUnitLoadout]]|SEEALSO=  
|r3= [[Array]] format [[Unit Loadout Array]]
| |MPBEHAVIOUR=  
 
}}
|s4= [[getUnitLoadout]] config
 
|p61= config: [[Config]] - loadout config class
 
|r4= [[Array]] format [[Unit Loadout Array]]
 
|x1= <sqf>getUnitLoadout player;</sqf>
 
|x2= <sqf>getUnitLoadout [player, true];</sqf>
 
|x3= <sqf>getUnitLoadout "B_Soldier_F";</sqf>


<h3 style='display:none'>Bottom Section</h3>
|x4= <sqf>getUnitLoadout (configFile >> "CfgVehicles" >> "B_Soldier_F");</sqf>
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]


<h3 style='display:none'>Notes</h3>
|x5= <sqf>getUnitLoadout (missionConfigFile >> "MyLoadout");</sqf>
<dl class="command_description">
<!-- BEGIN Note Section -->
<!-- END Note Section -->
</dl>


<h3 style="display:none">Bottom Section</h3>
|seealso= [[setUnitLoadout]]
}}

Latest revision as of 14:44, 23 June 2023

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:
Array format Unit Loadout Array

Syntax 2

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

Syntax 3

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

Syntax 4

Syntax:
getUnitLoadout config
Parameters:
config: Config - loadout config class
Return Value:
Array format 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 or on the Forums.
Only post proven facts here! Add Note