setUnitLoadout: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) (Add inventory window bug info) |
Lou Montana (talk | contribs) m (Text replacement - "<sqf>([^↵][^\/]*↵[^\/]*)<\/sqf>" to "<sqf> $1 </sqf>") |
||
Line 104: | Line 104: | ||
Will result in 30Rnd magazine with one bullet in it. | Will result in 30Rnd magazine with one bullet in it. | ||
<sqf>player setUnitLoadout [ | <sqf> | ||
player setUnitLoadout [ | |||
["arifle_MX_ACO_pointer_F", "", "acc_pointer_IR", "optic_Aco", [], [], ""], | ["arifle_MX_ACO_pointer_F", "", "acc_pointer_IR", "optic_Aco", [], [], ""], | ||
[], | [], | ||
Line 113: | Line 114: | ||
"H_HelmetB_grass", "", [], ["ItemMap", "", "ItemRadio", "ItemCompass", "ItemWatch", "NVGoggles"] | "H_HelmetB_grass", "", [], ["ItemMap", "", "ItemRadio", "ItemCompass", "ItemWatch", "NVGoggles"] | ||
]; | ]; | ||
</sqf> | </sqf> | ||
Will result in 2 magazines but full, 30 rounds in it. This applies to any magazines count >2. They will never be with specified amount of rounds, even if you force the refill argument to [[false]]. | Will result in 2 magazines but full, 30 rounds in it. This applies to any magazines count >2. They will never be with specified amount of rounds, even if you force the refill argument to [[false]]. |
Revision as of 11:34, 3 September 2024
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" }; };
- Problems:
- Groups:
- Unit Inventory
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: 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:
- _unit setUnitLoadout "B_Soldier_F"; // by class name _unit setUnitLoadout (configFile >> "CfgVehicles" >> "B_Soldier_F"); // by config entry _unit setUnitLoadout (missionConfigFile >> "MyLoadout"); // (also works for mission config) _unit setUnitLoadout getUnitLoadout _otherUnit; // by loadout array
- Example 2:
- player_2 setUnitLoadout (getUnitLoadout player_1); // Copies loadout from player_1 and applies it to player_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:
- Strip unit of everything:
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
- Posted on Dec 17, 2019 - 23:08 (UTC)
-
Empty or used magazines in loadouts will be refilled under specific circumstance, even if the refill argument is false. This seems to happen if amount of used magazines is 2 or more.
Will result in 30Rnd magazine with one bullet in it.player setUnitLoadout [ ["arifle_MX_ACO_pointer_F", "", "acc_pointer_IR", "optic_Aco", [], [], ""], [], ["hgun_P07_F", "", "", "", ["16Rnd_9x21_Mag", 16], [], ""], ["U_B_CombatUniform_mcam", [["30Rnd_65x39_caseless_mag", 1, 1]]], ["V_PlateCarrier1_rgr", []], ["B_AssaultPack_mcamo_Ammo", []], "H_HelmetB_grass", "", [], ["ItemMap", "", "ItemRadio", "ItemCompass", "ItemWatch", "NVGoggles"] ];Will result in 2 magazines but full, 30 rounds in it. This applies to any magazines count >2. They will never be with specified amount of rounds, even if you force the refill argument to false.player setUnitLoadout [ ["arifle_MX_ACO_pointer_F", "", "acc_pointer_IR", "optic_Aco", [], [], ""], [], ["hgun_P07_F", "", "", "", ["16Rnd_9x21_Mag", 16], [], ""], ["U_B_CombatUniform_mcam", [["30Rnd_65x39_caseless_mag", 2, 1]]], ["V_PlateCarrier1_rgr", []], ["B_AssaultPack_mcamo_Ammo", []], "H_HelmetB_grass", "", [], ["ItemMap", "", "ItemRadio", "ItemCompass", "ItemWatch", "NVGoggles"] ];
- Posted on Oct 23, 2020 - 21:16 (UTC)
- Here is a command I wrote up that provides a fix for the ammo bug described by Demellion above. https://pastebin.com/SHX41Jkk Pass a loadout to your compiled command and it will provide one back that will not refill ammo.
- Posted on Aug 23, 2022 - 08:27 (UTC)
-
You can use nil to skip some desired parameter. The skipped part will be ignored and remain the same with old loadout.
This method is very slightly faster than the latter method: