BIS fnc addVirtualItemCargo: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Some wiki formatting)
 
(45 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{RV|type=function


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


| arma3 |= Game name
|gr1= Inventory


|1.00|= Game version
|descr= Add virtual items to an object (e.g., ammo box). Virtual items can be selected in the [[Arsenal]].
____________________________________________________________________________________________
If parameters 4 and 5 are used this function can replace [[BIS_fnc_addVirtualWeaponCargo]], [[BIS_fnc_addVirtualMagazineCargo]] and [[BIS_fnc_addVirtualBackpackCargo]].


| <pre>/*
|s1= [object, itemClasses, addItemsGlobal, arsenal, mode, itemType] call [[BIS_fnc_addVirtualItemCargo]]


Description:
|p1= object: [[Object]] - object to which items will be added
Add virtual items to an object (e.g., ammo box).
Virtual items can be selected in the Arsenal.


Parameter(s):
|p2= itemClasses: [[Boolean]], [[String]] or [[Array]] of [[String]]s - item classes
0: OBJECT - objct to which items will be added
1: STRING or ARRAY of STRINGs - item class(es) to be added
2 (Optional): BOOL - true to add items globally (default: false)
3 (Optional): BOOL - true to add Arsenal action (default: true)


Returns:
|p3= addItemsGlobal: [[Boolean]] - (Optional, default [[false]]) [[true]] to add items globally
ARRAY of ARRAYs - all virtual items within the object's space in format [<items>,<weapons>,<magazines>,<backpacks>]
*/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|p4= arsenal: [[Boolean]] - (Optional, default [[true]]) [[true]] to add [[Arsenal]] action
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_addVirtualItemCargo]]; --> |= Syntax
|p5= mode: [[Number]] - (Optional, default 1) defines what the function will do, can be:
* -1 - remove given items
* &nbsp;0 - return current content
* &nbsp;1 - add given items


|p1= |= Parameter 1
|p6= itemType: [[Number]] - (Optional, default 0) define the item type, can be:
* 0 - items
* 1 - weapons
* 2 - magazines
* 3 - backpacks


| |= Return value
|r1= [[Array]] of [[String]]s - all virtual items
____________________________________________________________________________________________


|x1= <code> [ _myBox, [ "U_B_CombatUniform_mcam","U_B_CombatUniform_mcam_tshirt","Rangefinder","MineDetector" ], [[true]]] [[call]] [[BIS_fnc_addVirtualItemCargo]]; </code> |= EXAMPLE1
|x1= <sqf>[BIS_ammoBox, ["class_1", "class_2"], false, true] call BIS_fnc_addVirtualItemCargo;</sqf>
____________________________________________________________________________________________


| [[BIS_fnc_addVirtualBackpackCargo]] [[BIS_fnc_addVirtualMagazineCargo]] [[BIS_fnc_addVirtualWeaponCargo]] |= See also
|seealso= [[Arsenal]] [[BIS_fnc_addVirtualBackpackCargo]] [[BIS_fnc_addVirtualMagazineCargo]] [[BIS_fnc_addVirtualWeaponCargo]] [[BIS_fnc_arsenal]] [[BIS_fnc_getVirtualBackpackCargo]] [[BIS_fnc_getVirtualItemCargo]] [[BIS_fnc_getVirtualMagazineCargo]] [[BIS_fnc_getVirtualWeaponCargo]] [[BIS_fnc_removeVirtualBackpackCargo]] [[BIS_fnc_removeVirtualItemCargo]] [[BIS_fnc_removeVirtualMagazineCargo]] [[BIS_fnc_removeVirtualWeaponCargo]]
}}


{{Note
|user= Kamaradski
|timestamp= 20141016235500
|text= In AmmoboxInit mode, for the ammobox to ONLY contain your white-listed items in the ammobox, you should first issue the [[BIS_fnc_removeVirtualItemCargo]] command. Otherwise the box will contain non whitelisted clutter.
<br><br>
'''Example:'''
<sqf>
["AmmoboxInit", [_myBox, true]] call BIS_fnc_arsenal;
[_myBox, [true], true] call BIS_fnc_removeVirtualItemCargo;
[_myBox, ["U_B_CombatUniform_mcam", "U_B_CombatUniform_mcam_tshirt"], true] call BIS_fnc_addVirtualItemCargo;
</sqf>
}}
}}
<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:addVirtualItemCargo}}]]
[[Category:Functions|{{uc:addVirtualItemCargo}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:addVirtualItemCargo}}]]

Latest revision as of 00:41, 11 July 2022

Hover & click on the images for description

Description

Description:
Add virtual items to an object (e.g., ammo box). Virtual items can be selected in the Arsenal. If parameters 4 and 5 are used this function can replace BIS_fnc_addVirtualWeaponCargo, BIS_fnc_addVirtualMagazineCargo and BIS_fnc_addVirtualBackpackCargo.
Execution:
call
Groups:
Inventory

Syntax

Syntax:
[object, itemClasses, addItemsGlobal, arsenal, mode, itemType] call BIS_fnc_addVirtualItemCargo
Parameters:
object: Object - object to which items will be added
itemClasses: Boolean, String or Array of Strings - item classes
addItemsGlobal: Boolean - (Optional, default false) true to add items globally
arsenal: Boolean - (Optional, default true) true to add Arsenal action
mode: Number - (Optional, default 1) defines what the function will do, can be:
  • -1 - remove given items
  •  0 - return current content
  •  1 - add given items
itemType: Number - (Optional, default 0) define the item type, can be:
  • 0 - items
  • 1 - weapons
  • 2 - magazines
  • 3 - backpacks
Return Value:
Array of Strings - all virtual items

Examples

Example 1:
[BIS_ammoBox, ["class_1", "class_2"], false, true] call BIS_fnc_addVirtualItemCargo;

Additional Information

See also:
Arsenal BIS_fnc_addVirtualBackpackCargo BIS_fnc_addVirtualMagazineCargo BIS_fnc_addVirtualWeaponCargo BIS_fnc_arsenal BIS_fnc_getVirtualBackpackCargo BIS_fnc_getVirtualItemCargo BIS_fnc_getVirtualMagazineCargo BIS_fnc_getVirtualWeaponCargo BIS_fnc_removeVirtualBackpackCargo BIS_fnc_removeVirtualItemCargo BIS_fnc_removeVirtualMagazineCargo BIS_fnc_removeVirtualWeaponCargo

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
Kamaradski - c
Posted on Oct 16, 2014 - 23:55 (UTC)
In AmmoboxInit mode, for the ammobox to ONLY contain your white-listed items in the ammobox, you should first issue the BIS_fnc_removeVirtualItemCargo command. Otherwise the box will contain non whitelisted clutter.

Example:
["AmmoboxInit", [_myBox, true]] call BIS_fnc_arsenal; [_myBox, [true], true] call BIS_fnc_removeVirtualItemCargo; [_myBox, ["U_B_CombatUniform_mcam", "U_B_CombatUniform_mcam_tshirt"], true] call BIS_fnc_addVirtualItemCargo;