BIS fnc loadInventory: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\|s1= +" to "|s1= ") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 6: | Line 6: | ||
|gr1= Inventory | |gr1= Inventory | ||
|descr= Adds a predefined loadout (either via CfgVehicles, CfgRespawnInventory, or a custom inventory saved via [[BIS_fnc_saveInventory]]) to a specified unit. | |descr= Adds a predefined loadout (either via {{hl|CfgVehicles}}, {{hl|CfgRespawnInventory}}, or a custom inventory saved via [[BIS_fnc_saveInventory]]) to a specified unit. | ||
|s1= param call [[BIS_fnc_loadInventory]] | |s1= param call [[BIS_fnc_loadInventory]] | ||
|p1= [[Object]] - | |p1= [[Object]] - unit to receive the loadout | ||
|p2= [[Config]] - Config entry of loadout found in either CfgVehicles or CfgRespawnInventory | |p2= [[Config]] or [[Array]] - can be one of: | ||
* [[Array]] in format [ < [[Namespace]], [[Group]] or [[Object]] | * [[Config]]: config entry of loadout found in either {{hl|CfgVehicles}} or {{hl|CfgRespawnInventory}} | ||
* [[Array]] in format [<nowiki/>[[Namespace]], [[Group]] or [[Object]], [[String]]] or [[BIS_fnc_saveInventory]]'s output | |||
|p3= [[Array]] - | |p3= [[Array]] - (Optional, default []) array of [[String]]s that define what part of the loadout to ignore, e.g ["weapons", "uniform"] | ||
|r1= [[Boolean]] | |r1= [[Boolean]] | ||
|x1= <code>loadout = [player, | |x1= <code>loadout = [<nowiki/>[[player]], [[configFile]] >> "CfgVehicles" >> "B_Soldier_SL_F"] [[call]] [[BIS_fnc_loadInventory]]; {{cc|gives BLUFOR Squad Leader's loadout to player unit}}</code> | ||
|seealso= [[BIS_fnc_saveInventory]][[BIS_fnc_exportInventory]][[BIS_fnc_deleteInventory]][[setUnitLoadout]] | |x2= to save and load the inventory: | ||
<code>[<nowiki/>[[player]], [<nowiki/>[[missionNamespace]], "TAG_SavedInventory"]] [[call]] [[BIS_fnc_saveInventory]]; {{cc|save it}} | |||
[<nowiki/>[[player]], [<nowiki/>[[missionNamespace]], "TAG_SavedInventory"]] [[call]] [[BIS_fnc_loadInventory]]; {{cc|load it}}</code> | |||
|seealso= [[BIS_fnc_saveInventory]] [[BIS_fnc_exportInventory]] [[BIS_fnc_deleteInventory]] [[setUnitLoadout]] | |||
}} | }} | ||
{{Note | |||
|user= Ilias38rus | |||
|datetime= 20200802152100 | |||
|text= Doesn't work for backpacks in backpack, unlike [[setUnitLoadout]]. | |||
}} | |||
Doesn't work for backpacks in backpack, unlike [[setUnitLoadout]]. | |||
Revision as of 03:27, 18 December 2021
Description
- Description:
- Adds a predefined loadout (either via CfgVehicles, CfgRespawnInventory, or a custom inventory saved via BIS_fnc_saveInventory) to a specified unit.
- Execution:
- call
- Groups:
- Inventory
Syntax
- Syntax:
- param call BIS_fnc_loadInventory
- Parameters:
- Object - unit to receive the loadout
- Config or Array - can be one of:
- Array - (Optional, default []) array of Strings that define what part of the loadout to ignore, e.g ["weapons", "uniform"]
- Return Value:
- Boolean
Examples
- Example 1:
loadout = [player, configFile >> "CfgVehicles" >> "B_Soldier_SL_F"] call BIS_fnc_loadInventory; // gives BLUFOR Squad Leader's loadout to player unit
- Example 2:
- to save and load the inventory:
[player, [missionNamespace, "TAG_SavedInventory"]] call BIS_fnc_saveInventory; // save it [player, [missionNamespace, "TAG_SavedInventory"]] call BIS_fnc_loadInventory; // load it
Additional Information
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
- Date unknown
- Doesn't work for backpacks in backpack, unlike setUnitLoadout.