BIS fnc loadInventory: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Fix note)
m (Text replacement - "\{\{ *cc*\| *([^}]+) *\}\}" to "// $1")
Line 19: Line 19:
|r1= [[Boolean]]
|r1= [[Boolean]]


|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>
|x1= <code>loadout = [<nowiki/>[[player]], [[configFile]] >> "CfgVehicles" >> "B_Soldier_SL_F"] [[call]] [[BIS_fnc_loadInventory]]; // gives BLUFOR Squad Leader's loadout to player unit</code>


|x2= to save and load the inventory:
|x2= to save and load the inventory:
<code>[<nowiki/>[[player]], [<nowiki/>[[missionNamespace]], "TAG_SavedInventory"]] [[call]] [[BIS_fnc_saveInventory]]; {{cc|save it}}
<code>[<nowiki/>[[player]], [<nowiki/>[[missionNamespace]], "TAG_SavedInventory"]] [[call]] [[BIS_fnc_saveInventory]]; // save it
[<nowiki/>[[player]], [<nowiki/>[[missionNamespace]], "TAG_SavedInventory"]] [[call]] [[BIS_fnc_loadInventory]]; {{cc|load it}}</code>
[<nowiki/>[[player]], [<nowiki/>[[missionNamespace]], "TAG_SavedInventory"]] [[call]] [[BIS_fnc_loadInventory]]; // load it</code>


|seealso= [[BIS_fnc_saveInventory]] [[BIS_fnc_exportInventory]] [[BIS_fnc_deleteInventory]] [[setUnitLoadout]]
|seealso= [[BIS_fnc_saveInventory]] [[BIS_fnc_exportInventory]] [[BIS_fnc_deleteInventory]] [[setUnitLoadout]]

Revision as of 12:02, 13 July 2022

Hover & click on the images for description

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

See also:
BIS_fnc_saveInventory BIS_fnc_exportInventory BIS_fnc_deleteInventory 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
Ilias38rus - c
Posted on Aug 02, 2020 - 15:21 (UTC)
Doesn't work for backpacks in backpack, unlike setUnitLoadout.