getUnitLoadout: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\|x([0-9]) *= * <code>([^<]*)<\/code>" to "|x$1= <sqf>$2</sqf>") |
Lou Montana (talk | contribs) 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. 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. | ||
{{Feature|informative|The config should contain the following entries, which is standard for any unit class:<spoiler> | |||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
class MyLoadout | class MyLoadout | ||
Line 24: | Line 25: | ||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</spoiler> | |||
<syntaxhighlight lang="cpp"></syntaxhighlight><!-- for the spoiler to not eat the syntax highlight... --> | |||
}} | |||
|s1= [[getUnitLoadout]] unit | |s1= [[getUnitLoadout]] unit | ||
Line 35: | Line 37: | ||
|s2= [[getUnitLoadout]] [unit, fullMagazines] | |s2= [[getUnitLoadout]] [unit, fullMagazines] | ||
|p21= | |p21= unit: [[Object]] | ||
|p22 | |p22= fullMagazines: [[Boolean]] - [[true]] to top up used magazines | ||
|r2= [[Array]] - [[Unit Loadout Array]] | |r2= [[Array]] - [[Unit Loadout Array]] | ||
Line 56: | Line 56: | ||
|x1= <sqf>getUnitLoadout player;</sqf> | |x1= <sqf>getUnitLoadout player;</sqf> | ||
|x2= <sqf>getUnitLoadout [player, true];</sqf> | |x2= <sqf>getUnitLoadout [player, true];</sqf> | ||
|x3= <sqf>getUnitLoadout "B_Soldier_F";</sqf> | |x3= <sqf>getUnitLoadout "B_Soldier_F";</sqf> | ||
|x4= <sqf>getUnitLoadout (configFile >> "CfgVehicles" >> "B_Soldier_F");</sqf> | |x4= <sqf>getUnitLoadout (configFile >> "CfgVehicles" >> "B_Soldier_F");</sqf> | ||
|x5= <sqf>getUnitLoadout (missionConfigFile >> "MyLoadout");</sqf> | |x5= <sqf>getUnitLoadout (missionConfigFile >> "MyLoadout");</sqf> | ||
|seealso= [[setUnitLoadout]] | |seealso= [[setUnitLoadout]] | ||
}} | }} |
Revision as of 21:34, 4 September 2022
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.
- 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: 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:
- Example 3:
- getUnitLoadout "B_Soldier_F";
- Example 4:
- Example 5:
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