BIS fnc arsenal: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(page overhault)
m (Text replacement - "{{Feature | Informative | " to "{{Feature|informative|")
 
(40 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Function|= Comments
{{RV|type=function
____________________________________________________________________________________________


| arma3 |= Game name
|game1= arma3
|version1= 1.24


|1.24|= Game version
|gr1= Inventory
____________________________________________________________________________________________


| Function used for Virtual [[Arsenal]]. The function features four different modes, each mode comes with its own paramters. |= Description
|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.}}


| [mode,params] call '''BIS_fnc_arsenal''' |= Syntax
|s1= [mode, params] call [[BIS_fnc_arsenal]]


|p1= mode: [[String]] - Mode, can be "Open", "Preload", "AmmoboxInit" and "AmmoboxExit"|= Parameter 1
|p1= mode: [[String]] - mode, can be one of:
|p2= params: [[Anything]] - Parameters used by mode (See below for details)
* "Open" - opens the [[Arsenal]]
*'''"Open"''' - Opens the Arsenal
* "Preload" - preloads item configs, without preloading the configs are parsed the first time it is opened
**0: [[Boolean]] - [[true|True]] to open full [[Arsenal]] with all items available (default: [[false]])
* "AmmoboxInit" - adds a virtual ammobox. Action to access the [[Arsenal]] will be added automatically to all clients
*'''"Preload"''' - Preloads item configs, without preloading the configs are parsed the first time it's opened
* "AmmoboxExit" - remove virtual ammobox
**No parameters
|p2= params: [[Anything]] - mode parameters:
*'''"AmmoboxInit"''' - Adds a virtual ammobox. Action to access the [[Arsenal]] will be added automatically to all clients
* '''"Open"''': [full, cargo, center]
**0: [[Object]] - Object which should get a virtual ammobox
** full: [[Boolean]] - (Optional, default [[false]]) [[true]] to open full [[Arsenal]] with all items available
**1: [[Boolean]] - [[true|True]] to make all items available (optional, default: [[false]])
** cargo: Object to use as the cargo carrier (cargo is added with the [[BIS_fnc_addVirtualItemCargo]] functions)
**2: [[Code]] - Condition for the [[Arsenal]] to be accessable (optional,default: {[[false]]})
** center: Object whose arsenal will be modified
***Passed arguments are the same as in [[addAction]] condition, i.e. _target - the object, _this - the caller
* '''"Preload"''': no parameters
*'''"AmmoboxExit"''' - Remove virtual ammobox
* '''"AmmoboxInit"''': [ammobox, allItems, condition]
**0: [[Object]] - The object the [[Arsenal]] was added to |= Parameter 2
** 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


|r1= [[Nothing]]


|x1= Opens [[Arma 3: Arsenal|Arsenal]] with all items:
<sqf>["Open", [true]] call BIS_fnc_arsenal;</sqf>


| [[Nothing]] |= Return value
|x2= Preloads [[Arma 3: Arsenal|Arsenal]]'s config:
____________________________________________________________________________________________
<sqf>["Preload"] call BIS_fnc_arsenal;</sqf>


|x1= <code>[ "Open", [ [[true]] ] [[call]] '''BIS_fnc_arsenal''';</code> |= example 1
|x3= Adds full [[Arsenal]] to the [[player]] object and makes the [[addAction|action]] available when the player is closer than 10 meters from ammoBox:
|x2= <code>[ "Preload" ] [[call]] '''BIS_fnc_arsenal''';</code> |= example 2
<sqf>["AmmoboxInit", [ammoBox, true, { _this distance _target < 10 }]] call BIS_fnc_arsenal;</sqf>
|x3= <code>[ "AmmoboxInit", [ [[player]], [[true]], {(_this [[distance]] _target) < 10} ] ] [[call]] '''BIS_fnc_arsenal''';</code> |= example 3
|x4= <code>[ "AmmoboxExit", [[player]] ] [[call]] '''BIS_fnc_arsenal''';</code> |= example 4
____________________________________________________________________________________________


| [[Arsenal]], [[BIS_fnc_garage]] |= See also
|x4= Removes Arsenal from player object:
<sqf>["AmmoboxExit", player] call BIS_fnc_arsenal;</sqf>
 
|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}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on October 6, 2014 - 04:59 (UTC)</dd>
<dt class="note">[[User:Benargee|Benargee]]</dt>
<dd class="note">
To remove arsenal from an ammo box, you can use:
<code>[[removeAllActions]] ammobox</code>
</dd>
</dl>
<!-- DISCONTINUE Notes -->
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on September 2, 2017 - 22:36 (UTC)</dd>
<dt class="note">[[User:Lou Montana|Lou Montana]]</dt>
<dd class="note">
[[call|calling]] or [[spawn|spawning]] '''BIS_fnc_Arsenal''' with arguments ["AmmoboxInit", [myBox, true]] will show a "%ALL" error ([[BIS_fnc_error]]) when the player actually uses it.<br />
Use <code>[ myCrate, "%ALL", [[true]] ] [[call]] [[BIS_fnc_removeVirtualWeaponCargo]]</code> to remove this "%ALL" parameter.
</dd>
</dl>
<!-- DISCONTINUE Notes -->

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