getUnitLoadout: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Some wiki formatting)
m (Some wiki formatting)
Line 6: Line 6:
|gr1= Unit Inventory
|gr1= Unit Inventory


|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 {{hl|CfgVehicles}} 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.
|descr= Returns a '''[[Unit Loadout Array]]''' with all assigned items, weapons, containers and their stored items.
{{Feature|informative|The config should contain the following entries, which is standard for any unit class:<spoiler>
 
{{Feature|informative|
The config should contain the following standard entries: <spoiler>
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
class MyLoadout
class MyLoadout
Line 33: Line 35:
|p1= unit: [[Object]]
|p1= unit: [[Object]]


|r1= [[Array]] - [[Unit Loadout Array]]
|r1= [[Array]] format [[Unit Loadout Array]]


|s2= [[getUnitLoadout]] [unit, fullMagazines]
|s2= [[getUnitLoadout]] [unit, fullMagazines]
Line 41: Line 43:
|p22= fullMagazines: [[Boolean]] - [[true]] to top up used magazines
|p22= fullMagazines: [[Boolean]] - [[true]] to top up used magazines


|r2= [[Array]] - [[Unit Loadout Array]]
|r2= [[Array]] format [[Unit Loadout Array]]


|s3= [[getUnitLoadout]] name
|s3= [[getUnitLoadout]] name


|p41= name: [[String]] - class name (see description)
|p41= name: [[String]] - {{hl|CfgVehicles}} classname from which to extract the loadout


|r3= [[Array]] - [[Unit Loadout Array]]
|r3= [[Array]] format [[Unit Loadout Array]]


|s4= [[getUnitLoadout]] config
|s4= [[getUnitLoadout]] config


|p61= config: [[Config]] - config class (see description)
|p61= config: [[Config]] - loadout config class


|r4= [[Array]] - [[Unit Loadout Array]]
|r4= [[Array]] format [[Unit Loadout Array]]


|x1= <sqf>getUnitLoadout player;</sqf>
|x1= <sqf>getUnitLoadout player;</sqf>

Revision as of 16:57, 29 April 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