BIS fnc hasItem: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " \| *(s1=)? *((\[[^ ]+\]) (call|spawn) '''(BI(N|S)_fnc_[a-zA-Z0-9_]+)''');? \| *p1 *=" to " |s1= $3 $4 $5 |p1=")
m (Text replacement - "= <code>([^<{]+)<\/code>" to "= <sqf>$1</sqf>")
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{RV|type=function
{{RV|type=function


| arma3
|game1= arma3
 
|version1= 1.94
|1.94


|gr1= Inventory
|gr1= Inventory


| Returns [[true]] if object contains given item in inventory / cargo storage.{{Feature | important | This function performs a deep search of inventory / cargo storage, thus is not suitable for per-frame execution}}
|descr= Returns [[true]] if object contains given item in inventory / cargo storage.
{{Feature | important | This function performs a deep search of inventory / cargo storage, thus is not suitable for per-frame execution.}}


|s1= [object, item, searchCrew] call [[BIS_fnc_hasItem]]
|s1= [object, item, searchCrew] call [[BIS_fnc_hasItem]]


|p1=[object, item, searchCrew]: [[Array]]
|p1= object: [[Object]] or [[Group]] - unit, vehicle, container or group of units (since v1.95)
|p2= object: [[Object]] or [[Group]] - unit, vehicle, container or group of units (since v1.95)
 
|p3= item: [[String]] - item to find
|p2= item: [[String]] - item to find
|p4= searchCrew (Optional): [[Boolean]] - [[true]] to search vehicle crew as well if object is a vehicle. Default - [[false]]
 
|p3= searchCrew: [[Boolean]] - (Optional, default [[false]]) [[true]] to search vehicle crew as well if object is a vehicle
 
|r1= [[Boolean]] - [[true]] if has item


|r1=[[Boolean]] - [[true]] if has item
|x1= <sqf>[player, "ItemMap"] call BIS_fnc_hasItem;</sqf>


|x1= <code><nowiki>[</nowiki>[[player]], "ItemMap"] [[call]] [[BIS_fnc_hasItem]];</code>
|x2= <sqf>[tank, "FirstAidKit", true] call BIS_fnc_hasItem;</sqf>


|x2= <code>[tank, "FirstAidKit", [[true]]] [[call]] [[BIS_fnc_hasItem]];</code>
|seealso=
}}
}}

Latest revision as of 17:00, 13 July 2022

Hover & click on the images for description

Description

Description:
Returns true if object contains given item in inventory / cargo storage.
This function performs a deep search of inventory / cargo storage, thus is not suitable for per-frame execution.
Execution:
call
Groups:
Inventory

Syntax

Syntax:
[object, item, searchCrew] call BIS_fnc_hasItem
Parameters:
object: Object or Group - unit, vehicle, container or group of units (since v1.95)
item: String - item to find
searchCrew: Boolean - (Optional, default false) true to search vehicle crew as well if object is a vehicle
Return Value:
Boolean - true if has item

Examples

Example 1:
[player, "ItemMap"] call BIS_fnc_hasItem;
Example 2:
[tank, "FirstAidKit", true] call BIS_fnc_hasItem;

Additional Information

See also:
See also needed

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