Difference between revisions of "VN ms fnc hasItems"

From Savage Game Design Wiki
Jump to navigation Jump to search
m (Text replacement - "]]; |p1n=" to "]] |p1n=")
m (typo)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:TODO]]
 
 
{{Function
 
{{Function
  
Line 6: Line 5:
 
|author= Wyqer, veteran29
 
|author= Wyqer, veteran29
  
|a=
+
|a= global
  
 
|e=
 
|e=
Line 12: Line 11:
 
|g1= general
 
|g1= general
  
|d= <pre>/*
+
|d= Checks if given units have at least one of one or each given item in their inventory.
    File: fn_hasItems.sqf
 
    Author: Wyqer, veteran29
 
    Date: 2020-10-08
 
    Last Update: 2020-11-10
 
    Public: Yes
 
  
    Description:
+
|s= [unitsOrGroups, itemClasses, allItems] call [[VN_ms_fnc_hasItems]]
        Checks if given units have at least one of each given item in their inventory.
 
  
    Parameter(s):
+
|p1n= unitsOrGroups
        _units  - Array of units and/or groups to check for the item                                                    [ARRAY, defaults to []]
+
|p1t= array
        _items  - Array of item classnames to check for in their inventories                                            [ARRAY, defaults to []]
+
|p1d= groups and/or units to be scanned
        _all    - Selector if all items should be in the inventory at least once or just one of the items are needed    [BOOL, defaults to true]
 
 
 
    Returns:
 
        At least one of each item is in the inventory of provided groups [BOOL]
 
 
 
    Example(s):
 
        // Both listed items are need to be at least once in the inventory
 
        [[player], ["vn_mine_m18_mag", "vn_mine_m18_x3_mag"]] call vn_ms_fnc_hasItems
 
 
 
        // One of the listed items needs to be at least once in the inventory
 
        [[player], ["vn_mine_m18_mag", "vn_mine_m18_x3_mag"], false] call vn_ms_fnc_hasItems
 
*/
 
 
 
</pre><small>''(Placeholder description extracted from the function header by '''LM_exportFunctionsToWiki.sqf''')''</small>
 
 
 
|s= [] call [[vn_ms_fnc_hasItems]]
 
 
 
|p1n=
 
|p1t=
 
|p1d=
 
 
|p1v=
 
|p1v=
  
|p2n=
+
|p2n= itemClasses
|p2t=
+
|p2t= array
|p2d=
+
|p2d= '''case-sensitive''' classname(s) of item(s) to be found
 
|p2v=
 
|p2v=
  
|r1t=
+
|p3n= allItems
 +
|p3t= boolean
 +
|p3d= if set to false, only one of the listed items needs to be found
 +
|p3v= true
 +
 
 +
|r1t= boolean
 
|r1d=
 
|r1d=
  
|x1= <code>-</code>
+
|x1= <code>{{cc|All listed items need to be at least once in the inventory}}
 +
[<nowiki/>[player], ["vn_mine_m18_mag", "vn_mine_m18_x3_mag"]] call [[VN_ms_fnc_hasItems]];</code>
 +
 
 +
|x2= <code>{{cc|One of the listed items needs to be at least once in the inventory}}
 +
[<nowiki/>[player], ["vn_mine_m18_mag", "vn_mine_m18_x3_mag"], false] call [[VN_ms_fnc_hasItems]];</code>
 
}}
 
}}

Latest revision as of 21:48, 23 February 2021

← back to Functions Introduced in S.O.G. Prairie Fire v1.00
by Wyqer, veteran29
Argument(s): global
Effect(s): unknown

Description

Checks if given units have at least one of one or each given item in their inventory.

Syntax

Syntax
[unitsOrGroups, itemClasses, allItems] call VN_ms_fnc_hasItems
Parameters
unitsOrGroups: Array - groups and/or units to be scanned
itemClasses: Array - case-sensitive classname(s) of item(s) to be found
allItems: Boolean - (Optional, default true) if set to false, only one of the listed items needs to be found
Return value
Boolean

Examples

Example 1
// All listed items need to be at least once in the inventory [[player], ["vn_mine_m18_mag", "vn_mine_m18_x3_mag"]] call VN_ms_fnc_hasItems;
Example 2
// One of the listed items needs to be at least once in the inventory [[player], ["vn_mine_m18_mag", "vn_mine_m18_x3_mag"], false] call VN_ms_fnc_hasItems;