setUnitLoadout: Difference between revisions
Jump to navigation
Jump to search
m (template:command argument fix) |
Killzone Kid (talk | contribs) (example) |
||
Line 1: | Line 1: | ||
{{Command|= | {{Command|Comments= | ||
|arma3|= Game name | |arma3|name= Game name | ||
|1.58|= Game version | |1.58|version= Game version | ||
|arg= global |= | |arg= global |Arguments= in MP | ||
|eff= global |= | |eff= global |Effects= in MP | ||
| Creates a loadout from given inventory structure and applies it to a unit. 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: | | Creates a loadout from given inventory structure and applies it to a unit. 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> | <syntaxhighlight lang=cpp> | ||
Line 16: | Line 16: | ||
};</syntaxhighlight> | };</syntaxhighlight> | ||
| unit [[setUnitLoadout]] loadout| | | unit [[setUnitLoadout]] loadout|SYNTAX1= | ||
|p1= unit: [[Object]] |PARAMETER1= | |p1= unit: [[Object]] |PARAMETER1= | ||
|p2= loadout: [[Array]] - [[Unit Loadout Array]] |PARAMETER2= | |p2= loadout: [[Array]] - [[Unit Loadout Array]] |PARAMETER2= | ||
| [[Nothing]] | | | [[Nothing]] |RETURNVALUE1= | ||
| s2= unit [[setUnitLoadout]] [loadout, fullMagazines]| | | s2= unit [[setUnitLoadout]] [loadout, fullMagazines]|SYNTAX2= | ||
|p21= unit: [[Object]] | | |p21= unit: [[Object]] |PARAMETER21= | ||
|p22=[loadout, fullMagazines] : [[Array]]|= | |p22=[loadout, fullMagazines] : [[Array]]|PARAMETER22= | ||
|p23= loadout: [[Array]] - [[Unit Loadout Array]] | | |p23= loadout: [[Array]] - [[Unit Loadout Array]] |PARAMETER23= | ||
|p24= fullMagazines: [[Boolean]] - Partially emptied magazines will be refilled when the loadout is applied| | |p24= fullMagazines: [[Boolean]] - Partially emptied magazines will be refilled when the loadout is applied|PARAMETER24= | ||
| r2= [[Nothing]] | | | r2= [[Nothing]] |RETURNVALUE2= | ||
|s3= unit [[setUnitLoadout]] name | | |s3= unit [[setUnitLoadout]] name |SYNTAX3= | ||
|p41= unit: [[Object]] | | |p41= unit: [[Object]] |PARAMETER41= | ||
|p42= name: [[String]] - class name (see description)| | |p42= name: [[String]] - class name (see description)|PARAMETER42= | ||
|r3= [[Nothing]] | | |r3= [[Nothing]] |RETURNVALUE3= | ||
|s4= unit [[setUnitLoadout]] config | | |s4= unit [[setUnitLoadout]] config |SYNTAX4= | ||
|p61= unit: [[Object]] | | |p61= unit: [[Object]] |PARAMETER61= | ||
|p62= config: [[Config]] - config class (see description) | | |p62= config: [[Config]] - config class (see description) |PARAMETER62= | ||
|r4= [[Nothing]] | | |r4= [[Nothing]] |RETURNVALUE4= | ||
|x1= <code>player_2 [[setUnitLoadout]] ([[getUnitLoadout]] player_1); // Copies loadout from player_1 and applies it to player_2 </code>|EXAMPLE1= | |x1= <code>player_2 [[setUnitLoadout]] ([[getUnitLoadout]] player_1); // Copies loadout from player_1 and applies it to player_2 </code>|EXAMPLE1= | ||
|x2= <code>player_2 [[setUnitLoadout]] <nowiki>[</nowiki>[[getUnitLoadout]] player_1, [[true]]]; // Copies loadout from player_1 and applies it to player_2 while topping up all magazines</code>|EXAMPLE2= | |x2= <code>player_2 [[setUnitLoadout]] <nowiki>[</nowiki>[[getUnitLoadout]] player_1, [[true]]]; // Copies loadout from player_1 and applies it to player_2 while topping up all magazines</code>|EXAMPLE2= | ||
|x3= <code>_unit [[setUnitLoadout]] "B_Soldier_F";</code>|= | |x3= <code>_unit [[setUnitLoadout]] "B_Soldier_F";</code>|EXAMPLE3= | ||
|x4= <code>_unit [[setUnitLoadout]] ([[configFile]] >> "CfgVehicles" >> "B_Soldier_F");</code>|= | |x4= <code>_unit [[setUnitLoadout]] ([[configFile]] >> "CfgVehicles" >> "B_Soldier_F");</code>|EXAMPLE4= | ||
|x5= <code>_unit [[setUnitLoadout]] ([[missionConfigFile]] >> "MyLoadout");</code>|= | |x5= <code>_unit [[setUnitLoadout]] ([[missionConfigFile]] >> "MyLoadout");</code>|EXAMPLE5= | ||
|x6= Strip unit of everything (after Arma 3 v1.93):<code>_unit [[setUnitLoadout]] ([[configFile]] >> "EmptyLoadout");</code>|EXAMPLE6= | |||
| [[getUnitLoadout]]|SEEALSO= | | [[getUnitLoadout]]|SEEALSO= |
Revision as of 20:03, 9 April 2019
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");
- Example 6:
- Strip unit of everything (after Arma 3 v1.93):
_unit setUnitLoadout (configFile >> "EmptyLoadout");
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