getUnitLoadout: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(alt syntax)
m (Text replacement - "\{\{GameCategory\|(arma[0123])\|[ _]?New[ _]Scripting[ _]Commands[ _]List\}\}" to "{{GameCategory|$1|New Scripting Commands}}")
(13 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{Command|Comments=
|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]]|= Description
____________________________________________________________________________________________


| [[getUnitLoadout]] unit |= Syntax
|game1= arma3
|p1= unit: [[Object]] |= Parameter 1


| [[Array]] - Array containing all inventory items |= Return Value
|version1= 1.58
____________________________________________________________________________________________
|s2= [[getUnitLoadout]] [unit, fullMagazines] |= Syntax
|p21 = [unit, fullMagazines]: [[Array]] |= Parameter 1
|p22= unit: [[Object]] |= Parameter 2
|p23= fullMagazines: [[Boolean]] |= Parameter 3


|r2= [[Array]] - Array containing all inventory items |= Return value
|gr1= Unit Inventory |GROUP1=
____________________________________________________________________________________________
|s3= [[getUnitLoadout]] name |= Syntax
|p41= name: [[String]] - class name |= Parameter 1


|r3= [[Array]] - Array containing all inventory items |= Return value
|descr= 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:
____________________________________________________________________________________________
<syntaxhighlight lang="cpp">
|s4= [[getUnitLoadout]] config |= Syntax
class MyLoadout
|p61= config: [[Config]] - config class |= Parameter 1
{
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>


|r4= [[Array]] - Array containing all inventory items |= Return value
{{Informative | Since {{arma3}} v1.92 an empty loadout could be obtained with <tt>[[getUnitLoadout]] ([[configFile]] >> "EmptyLoadout")</tt>}}
____________________________________________________________________________________________
|x1= <code>[[getUnitLoadout]] [[player]];</code>|=
|x2= <code>[[getUnitLoadout]] <nowiki>[</nowiki>[[player]], [[true]]];</code>|=
|x3= <code>[[getUnitLoadout]] "B_Soldier_F";</code>|=
|x4= <code>[[getUnitLoadout]] ([[configFile]] >> "CfgVehicles" >> "B_Soldier_F");</code>|=


| [[setUnitLoadout]]|= SEEALSO
 
| |= MPBEHAVIOUR
|s1= [[getUnitLoadout]] unit
 
|p1= unit: [[Object]]
 
|r1= [[Array]] - [[Unit Loadout Array]]
 
 
|s2= [[getUnitLoadout]] [unit, fullMagazines]
 
|p21 = [unit, fullMagazines]: [[Array]]
 
|p22= unit: [[Object]]
 
|p23= fullMagazines: [[Boolean]] - [[true]] to top up used magazines
 
|r2= [[Array]] - [[Unit Loadout Array]]
 
 
|s3= [[getUnitLoadout]] name
 
|p41= name: [[String]] - class name (see description)
 
|r3= [[Array]] - [[Unit Loadout Array]]
 
 
|s4= [[getUnitLoadout]] config
 
|p61= config: [[Config]] - config class (see description)
 
|r4= [[Array]] - [[Unit Loadout Array]]
 
|x1= <code>[[getUnitLoadout]] [[player]];</code>
|x2= <code>[[getUnitLoadout]] [<nowiki/>[[player]], [[true]]];</code>
|x3= <code>[[getUnitLoadout]] "B_Soldier_F";</code>
|x4= <code>[[getUnitLoadout]] ([[configFile]] >> "CfgVehicles" >> "B_Soldier_F");</code>
|x5= <code>[[getUnitLoadout]] ([[missionConfigFile]] >> "MyLoadout");</code>
 
|seealso= [[setUnitLoadout]]
}}
}}


<h3 style='display:none'>Bottom Section</h3>
[[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>
<h3 style='display:none'>Notes</h3>
Line 49: Line 76:


<h3 style="display:none">Bottom Section</h3>
<h3 style="display:none">Bottom Section</h3>
{{GameCategory|arma3|Scripting Commands}}
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
{{GameCategory|arma3|New Scripting Commands}}

Revision as of 00:10, 13 January 2021

Hover & click on the images for description

Description

Description:
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 CfgVehicles for the given class in order to extract the loadout from config. If Config is given, it will search given config (including 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:
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"
	};
};
Since Arma 3 v1.92 an empty loadout could be obtained with getUnitLoadout (configFile >> "EmptyLoadout")
Groups:
Unit Inventory

Syntax 1

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

Syntax 2

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

Syntax 3

Syntax:
getUnitLoadout name
Parameters:
name: String - class name (see description)
Return Value:
Array - Unit Loadout Array

Syntax 4

Syntax:
getUnitLoadout config
Parameters:
config: Config - config class (see description)
Return Value:
Array - 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


Notes

Bottom Section