BIS fnc arsenal: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (NEEDS EXAMPLES!!! GVI 1.00 --> 1.24 bootcamp update, added temp descrip, added examples)
m (Text replacement - "{{Feature | Informative | " to "{{Feature|informative|")
 
(52 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma3
____________________________________________________________________________________________
|version1= 1.24


| arma3 |= Game name
|gr1= Inventory


|1.24|= Game version
|descr= Function used for the [[Arma 3: Arsenal|Virtual Arsenal]]. The function features four different modes, each mode comes with its own parameters.
____________________________________________________________________________________________
{{Feature|informative|If Arsenal is launched within the first second from the mission start, the unit loadout will be randomised.}}


|<code> /*
|s1= [mode, params] call [[BIS_fnc_arsenal]]
Author: Karel Moricky


Description:
|p1= mode: [[String]] - mode, can be one of:
Splendid arsenal viewer
* "Open" - opens the [[Arsenal]]
* "Preload" - preloads item configs, without preloading the configs are parsed the first time it is opened
* "AmmoboxInit" - adds a virtual ammobox. Action to access the [[Arsenal]] will be added automatically to all clients
* "AmmoboxExit" - remove virtual ammobox
|p2= params: [[Anything]] - mode parameters:
* '''"Open"''': [full, cargo, center]
** full: [[Boolean]] - (Optional, default [[false]]) [[true]] to open full [[Arsenal]] with all items available
** cargo: Object to use as the cargo carrier (cargo is added with the [[BIS_fnc_addVirtualItemCargo]] functions)
** center: Object whose arsenal will be modified
* '''"Preload"''': no parameters
* '''"AmmoboxInit"''': [ammobox, allItems, condition]
** ammobox: [[Object]] - Object which should get a virtual ammobox
** allItems: [[Boolean]] - (Optional, default [[false]]) [[true]] to make all items available
** condition: [[Code]] - (Optional, default <sqf inline>{ true }</sqf>) condition for the [[Arsenal]] to be accessible. Available arguments are the same as in [[addAction]]'s ''condition'' parameter:
*** _target: [[Object]] - object to which the action is attached or, if the object is a unit inside of vehicle, the vehicle
*** _this: [[Object]] - caller person to whom the action is shown (or not depending on ''condition'')
*** _originalTarget: [[Object]] - original object to which the action is attached, regardless if the object/unit is in a vehicle or not
* '''"AmmoboxExit"''': [ammobox]
** ammobox: [[Object]] - the object to which the [[Arma 3: Arsenal|Arsenal]] was added


Parameter(s):
|r1= [[Nothing]]


0: STRING - mode
|x1= Opens [[Arma 3: Arsenal|Arsenal]] with all items:
1: ANY - params (see below)
<sqf>["Open", [true]] call BIS_fnc_arsenal;</sqf>


Modes:
|x2= Preloads [[Arma 3: Arsenal|Arsenal]]'s config:
"Open" - Open the Arsenal
<sqf>["Preload"] call BIS_fnc_arsenal;</sqf>
0 (Optional): BOOL - true to open full Arsenal, with all categories and items available (default: false)


"Preload" - Preload item configs for Arsenal (without preloading, configs are parsed the first time Arsenal is opened)
|x3= Adds full [[Arsenal]] to the [[player]] object and makes the [[addAction|action]] available when the player is closer than 10 meters from ammoBox:
No params
<sqf>["AmmoboxInit", [ammoBox, true, { _this distance _target  < 10 }]] call BIS_fnc_arsenal;</sqf>


"AmmoboxInit" - Add virtual ammobox. Action to access the Arsenal will be added automatically on all clients.
|x4= Removes Arsenal from player object:
0: OBJECT - ammobox
<sqf>["AmmoboxExit", player] call BIS_fnc_arsenal;</sqf>
1 (Optional): BOOL - true to make all weapons and items in the game available in the box (default: false)
2 (Optional): Condition for showing the Arsenal action (default: {true})
      Passed arguments are the same as in addAction condition, i.e., _target - the box, _this - caller
 
"AmmoboxExit" - Remove virtual ammobox
0: OBJECT - ammobox
 
 
Returns:
NOTHING
*/
</code> |= Description
____________________________________________________________________________________________
 
| [mode,params] call [[BIS_fnc_arsenal]] |= Syntax
 
|p1= |= Parameter 1
 
| |= Return value
____________________________________________________________________________________________
 
|x1= <code>"Open" Unkown without crashing</code> |=
|x2= <code>["Preload"] call BIS_fnc_arsenal; </code> |=
|x3= <code>["AmmoboxInit",[ammobox,true,{true}]] call BIS_fnc_arsenal;//applies arsenal to object "ammobox" and includes all items.</code> |=
|x4= <code>["AmmoboxExit",[ammobox]] call BIS_fnc_arsenal//Doesnt work</code> |=
____________________________________________________________________________________________
 
| |= See also


|seealso= [[Arma 3: Arsenal]] [[BIS_fnc_garage]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Inventory|{{uc:arsenal}}]]
[[Category:Functions|{{uc:arsenal}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:arsenal}}]]

Latest revision as of 21:41, 16 May 2024

Hover & click on the images for description

Description

Description:
Function used for the Virtual Arsenal. The function features four different modes, each mode comes with its own parameters.
If Arsenal is launched within the first second from the mission start, the unit loadout will be randomised.
Execution:
call
Groups:
Inventory

Syntax

Syntax:
[mode, params] call BIS_fnc_arsenal
Parameters:
mode: String - mode, can be one of:
  • "Open" - opens the Arsenal
  • "Preload" - preloads item configs, without preloading the configs are parsed the first time it is opened
  • "AmmoboxInit" - adds a virtual ammobox. Action to access the Arsenal will be added automatically to all clients
  • "AmmoboxExit" - remove virtual ammobox
params: Anything - mode parameters:
  • "Open": [full, cargo, center]
  • "Preload": no parameters
  • "AmmoboxInit": [ammobox, allItems, condition]
    • ammobox: Object - Object which should get a virtual ammobox
    • allItems: Boolean - (Optional, default false) true to make all items available
    • condition: Code - (Optional, default { true }) condition for the Arsenal to be accessible. Available arguments are the same as in addAction's condition parameter:
      • _target: Object - object to which the action is attached or, if the object is a unit inside of vehicle, the vehicle
      • _this: Object - caller person to whom the action is shown (or not depending on condition)
      • _originalTarget: Object - original object to which the action is attached, regardless if the object/unit is in a vehicle or not
  • "AmmoboxExit": [ammobox]
Return Value:
Nothing

Examples

Example 1:
Opens Arsenal with all items:
["Open", [true]] call BIS_fnc_arsenal;
Example 2:
Preloads Arsenal's config:
["Preload"] call BIS_fnc_arsenal;
Example 3:
Adds full Arsenal to the player object and makes the action available when the player is closer than 10 meters from ammoBox:
["AmmoboxInit", [ammoBox, true, { _this distance _target < 10 }]] call BIS_fnc_arsenal;
Example 4:
Removes Arsenal from player object:
["AmmoboxExit", player] call BIS_fnc_arsenal;

Additional Information

See also:
Arma 3: Arsenal BIS_fnc_garage

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