setUnitLoadout: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(alt syntax, description)
(there is no default, this is a required param)
Line 26: Line 26:
|p22=[loadout, fullMagazines] : [[Array]]|=
|p22=[loadout, fullMagazines] : [[Array]]|=
|p23= loadout: [[Array]] - [[Unit Loadout Array]] |= Parameter 2
|p23= loadout: [[Array]] - [[Unit Loadout Array]] |= Parameter 2
|p24= fullMagazines: [[Boolean]] - Partially emptied magazines will be refilled when the loadout is applied - Default: [[false]]|= Parameter3
|p24= fullMagazines: [[Boolean]] - Partially emptied magazines will be refilled when the loadout is applied|= Parameter3
| r2= [[Nothing]] |= RETURNVALUE  
| r2= [[Nothing]] |= RETURNVALUE  



Revision as of 16:38, 15 October 2018

Hover & click on the images for description

Description

Description:
Creates a loadout from given inventory structure and applies it to a unit. 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","HandGrenade","HandGrenade","HandGrenade"};
};
Groups:
Uncategorised

Syntax 1

Syntax:
unit setUnitLoadout loadout
Parameters:
unit: Object
loadout: Array - Unit Loadout Array
Return Value:
Nothing

Syntax 2

Syntax:
unit setUnitLoadout [loadout, fullMagazines]
Parameters:
unit: Object
[loadout, fullMagazines] : Array
loadout: Array - Unit Loadout Array
fullMagazines: Boolean - Partially emptied magazines will be refilled when the loadout is applied
Return Value:
Nothing

Syntax 3

Syntax:
unit setUnitLoadout name
Parameters:
unit: Object
name: String - class name (see description)
Return Value:
Nothing

Syntax 4

Syntax:
unit setUnitLoadout config
Parameters:
unit: Object
config: Config - config class (see description)
Return Value:
Nothing

Examples

Example 1:
player_2 setUnitLoadout (getUnitLoadout player_1); // Copies loadout from player_1 and applies it to player_2
Example 2:
player_2 setUnitLoadout [getUnitLoadout player_1, true]; // Copies loadout from player_1 and applies it to player_2 while topping up all magazines
Example 3:
_unit setUnitLoadout "B_Soldier_F";
Example 4:
_unit setUnitLoadout (configFile >> "CfgVehicles" >> "B_Soldier_F");
Example 5:
_unit setUnitLoadout (missionConfigFile >> "MyLoadout");

Additional Information

See also:
getUnitLoadout

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

Bottom Section

Notes

Bottom Section