{"name":"BIS_fnc_arsenal","operator":null,"title":"BIS fnc arsenal","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_arsenal","revid":364490,"updated":"2024-05-16T20:41:59Z","groups":["Inventory"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.24"}],"since":{"game":"arma3","name":"Arma 3","version":"1.24"},"arma3_since":"1.24","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Function used for the Virtual Arsenal. The function features four different modes, each mode comes with its own parameters.\n\n> [!NOTE]\n> If Arsenal is launched within the first second from the mission start, the unit loadout will be randomised.","syntaxes":[{"syntax":"[mode, params] call BIS_fnc_arsenal","since":null,"effect":null,"exec":null,"params":[{"name":"mode","type":"String","optional":false,"default":null,"description":"mode, can be one of:\n- \"Open\" - opens the Arsenal\n- \"Preload\" - preloads item configs, without preloading the configs are parsed the first time it is opened\n- \"AmmoboxInit\" - adds a virtual ammobox. Action to access the Arsenal will be added automatically to all clients\n- \"AmmoboxExit\" - remove virtual ammobox","types":["String"],"since":null,"text":"mode: String - mode, can be one of:\n- \"Open\" - opens the Arsenal\n- \"Preload\" - preloads item configs, without preloading the configs are parsed the first time it is opened\n- \"AmmoboxInit\" - adds a virtual ammobox. Action to access the Arsenal will be added automatically to all clients\n- \"AmmoboxExit\" - remove virtual ammobox"},{"name":"params","type":"Anything","optional":true,"default":"false","description":"mode parameters:\n- **\"Open\"**: [full, cargo, center]\n  - full: Boolean -  true to open full Arsenal with all items available\n  - cargo: Object to use as the cargo carrier (cargo is added with the BIS_fnc_addVirtualItemCargo functions)\n  - center: Object whose arsenal will be modified\n- **\"Preload\"**: no parameters\n- **\"AmmoboxInit\"**: [ammobox, allItems, condition]\n  - ammobox: Object - Object which should get a virtual ammobox\n  - allItems: Boolean - (Optional, default false) true to make all items available\n  - condition: Code - (Optional, default `{ true }`) condition for the Arsenal to be accessible. Available arguments are the same as in addAction's *condition* parameter:\n    - _target: Object - object to which the action is attached or, if the object is a unit inside of vehicle, the vehicle\n    - _this: Object - caller person to whom the action is shown (or not depending on *condition*)\n    - _originalTarget: Object - original object to which the action is attached, regardless if the object/unit is in a vehicle or not\n- **\"AmmoboxExit\"**: [ammobox]\n  - ammobox: Object - the object to which the Arsenal was added","types":["Anything"],"since":null,"text":"params: Anything - mode parameters:\n- **\"Open\"**: [full, cargo, center]\n  - full: Boolean - (Optional, default false) true to open full Arsenal with all items available\n  - cargo: Object to use as the cargo carrier (cargo is added with the BIS_fnc_addVirtualItemCargo functions)\n  - center: Object whose arsenal will be modified\n- **\"Preload\"**: no parameters\n- **\"AmmoboxInit\"**: [ammobox, allItems, condition]\n  - ammobox: Object - Object which should get a virtual ammobox\n  - allItems: Boolean - (Optional, default false) true to make all items available\n  - condition: Code - (Optional, default `{ true }`) condition for the Arsenal to be accessible. Available arguments are the same as in addAction's *condition* parameter:\n    - _target: Object - object to which the action is attached or, if the object is a unit inside of vehicle, the vehicle\n    - _this: Object - caller person to whom the action is shown (or not depending on *condition*)\n    - _originalTarget: Object - original object to which the action is attached, regardless if the object/unit is in a vehicle or not\n- **\"AmmoboxExit\"**: [ammobox]\n  - ammobox: Object - the object to which the Arsenal was added"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"}}],"examples":[{"text":"Opens Arsenal with all items:\n\n```sqf\n[\"Open\", [true]] call BIS_fnc_arsenal;\n```","code":["[\"Open\", [true]] call BIS_fnc_arsenal;"]},{"text":"Preloads Arsenal's config:\n\n```sqf\n[\"Preload\"] call BIS_fnc_arsenal;\n```","code":["[\"Preload\"] call BIS_fnc_arsenal;"]},{"text":"Adds full Arsenal to the player object and makes the action available when the player is closer than 10 meters from ammoBox:\n\n```sqf\n[\"AmmoboxInit\", [ammoBox, true, { _this distance _target  < 10 }]] call BIS_fnc_arsenal;\n```","code":["[\"AmmoboxInit\", [ammoBox, true, { _this distance _target  < 10 }]] call BIS_fnc_arsenal;"]},{"text":"Removes Arsenal from player object:\n\n```sqf\n[\"AmmoboxExit\", player] call BIS_fnc_arsenal;\n```","code":["[\"AmmoboxExit\", player] call BIS_fnc_arsenal;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["Arma 3: Arsenal","BIS_fnc_garage"],"notes":[],"categories":["Arma 3: Functions","Arma 3: New Functions","Function Group: Inventory","Functions","Introduced with Arma 3 version 1.24"],"docblock":null,"filled_from_docblock":[]}