HeisenS 27 Posted October 6, 2015 Hello guys, Well i'm the progress of making a repair system menu for arma 3 and i have came across something which i am unsure about. Well i want to check if the player has a ToolKit in their inventory however i do not know the line of code of which is used to check for inventory items. I'm fairly new to dialog and scripting so i am unsure about this. Any help of what i could try out would be amazing. Thanks! It's a work in progress... Hesien Share this post Link to post Share on other sites
schadler17 36 Posted October 6, 2015 _items = items player; if ("ToolKit" in _items) then { // script }; 1 Share this post Link to post Share on other sites
HeisenS 27 Posted October 6, 2015 _items = items player; if ("ToolKit" in _items) then { // script }; I'll try that out, thanks. Share this post Link to post Share on other sites
Ranwer135 308 Posted October 6, 2015 If you are finding mags, then the syntax would be: "ItemClassName" in magazines player; Share this post Link to post Share on other sites
HeisenS 27 Posted October 6, 2015 If you are finding mags, then the syntax would be: "ItemClassName" in magazines player; Yer, thanks. Share this post Link to post Share on other sites
HeisenS 27 Posted October 7, 2015 _items = items player; if ("ToolKit" in _items) then { // script }; Worked! Share this post Link to post Share on other sites
steam-76561198069261992 1 Posted June 9, 2021 Hi, I know this topic is really old, but how do I use this to check for multiple items of 1 specific item, and how do I check for multiple different items? Share this post Link to post Share on other sites
sarogahtyp 1108 Posted June 9, 2021 _items = items player; _wanted = [ "item1", "item2", "item3", "item4", "item5", "item6", "item7" ]; if ( _wanted findIf { _x in _items } > -1 ) then { // script }; script is executed if one of the items in _wanted is carried by player Share this post Link to post Share on other sites
steam-76561198069261992 1 Posted June 9, 2021 1 hour ago, sarogahtyp said: _items = items player; _wanted = [ "item1", "item2", "item3", "item4", "item5", "item6", "item7" ]; if ( _wanted findIf { _x in _items } > -1 ) then { // script }; script is executed if one of the items in _wanted is carried by player Hi, thanks for the quick response, though this is not what I am looking for. I am trying to make a crafting system and I want to make it so it uses multiple items. Lets say it uses "Scrap" twice, and uses a "Rifle_Body" once. So that would be 3 items that are all needed to execute the script. Share this post Link to post Share on other sites
sarogahtyp 1108 Posted June 9, 2021 (edited) _items = items player; _recipe = [ ["item1", 5], ["item2", 3], ["item3", 98]]; _crafting_allowed = true; { _item = _x#0; _wanted_num = _x#1; _num = {_x isEqualTo _item} count _items; if (_num < _wanted_num) then { _crafting_allowed = false }; } count recipe; if ( _crafting_allowed ) then { // script }; not tested, but shows the way at least... Edited June 9, 2021 by sarogahtyp simplified 1 Share this post Link to post Share on other sites
steam-76561198069261992 1 Posted June 9, 2021 22 minutes ago, sarogahtyp said: _items = items player; _recipe = [ ["item1", 5], ["item2", 3], ["item3", 98]]; _crafting_allowed = true; { _item = _x#0; _wanted_num = _x#1; _num = {_x isEqualTo _item} count _items; if (_num < _wanted_num) then { _crafting_allowed = false }; } count recipe; if ( _crafting_allowed ) then { // script }; not tested, but shows the way at least... It works, thankyou. Also, is there a way to make it so it not only checks items of the player, but also magazines? Example would be: _items = items player, magazines player; But this doesnt work ofcourse. Edit: nevermind, found the solution. Thanks alot! Share this post Link to post Share on other sites
sarogahtyp 1108 Posted June 9, 2021 1 minute ago, steam-76561198069261992 said: It works, thankyou. Also, is there a way to make it so it not only checks items of the player, but also magazines? Example would be: _items = items player, magazines player; But this doesnt work ofcourse. just append it to the item array: _stuff = items player; _stuff append magazines player; Share this post Link to post Share on other sites
Soapbox0331 17 Posted August 31, 2021 On 6/9/2021 at 7:52 AM, sarogahtyp said: _items = items player; _wanted = [ "item1", "item2", "item3", "item4", "item5", "item6", "item7" ]; if ( _wanted findIf { _x in _items } > -1 ) then { // script }; script is executed if one of the items in _wanted is carried by player Hello @sarogahtyp how do I achieve this in MP dedicated? Share this post Link to post Share on other sites
sarogahtyp 1108 Posted August 31, 2021 @Soapbox0331 depends on your purpose and how you are trying to achieve it ... Share this post Link to post Share on other sites
Soapbox0331 17 Posted September 3, 2021 On 8/31/2021 at 4:42 AM, sarogahtyp said: @Soapbox0331 depends on your purpose and how you are trying to achieve it ... @sarogahtyp ok, sure: MP Dedi using SOG Prairie Fire. Goal is to conduct wire tap mission. Task 1 is to ensure at least one of the players has wire tap kit ("vn_b_item_wiretap") in inventory. I was thinking a trigger condition that detects this completes the task. FYSA: There is a function, VN_ms_fnc_hasItems (https://wiki.sogpf.com/index.php/VN_ms_fnc_hasItems). Again, I do not know how to do a MP dedi of: [[player], ["vn_b_item_wiretap"]] call VN_ms_fnc_hasItems; Task 2 is to conduct the wire tap. Currently I have an object near a cable with this holdaction, which displays a wire tap kit for 10 seconds, deletes it, and task is completed via WireTapCollected in trigger condition: [ this, "CONDUCT WIRE TAP", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "_this distance _target < 3", "_caller distance _target < 3", { Recorder1 setpos [(getpos Cable select 0), (getpos Cable select 1), 0]; }, {}, { deleteMarker "WireTap"; deleteVehicle Recorder1; WireTapCollected = true; publicVariable "WireTapCollected"; }, {}, [], 10, 0, true, false ] remoteExec ["BIS_fnc_holdActionAdd", 0, this]; Ideally, this holdaction would only be available or functional for a player with "vn_b_item_wiretap" in inventory. Thanks for sharing your expertise! Share this post Link to post Share on other sites
pierremgi 4875 Posted September 3, 2021 You don't need to remote exec a code already known by all players, as any each player runs all the init fields of all the objects/units in editor (this variable works only here) Add a simple condition for your item: [ this, "CONDUCT WIRE TAP", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "_this distance _target < 3 && 'vn_b_item_wiretap' in items _this", "_caller distance _target < 3 && 'vn_b_item_wiretap' in items _caller", { Recorder1 setpos [(getpos Cable select 0), (getpos Cable select 1), 0]; }, {}, { deleteMarker "WireTap"; deleteVehicle Recorder1; WireTapCollected = true; publicVariable "WireTapCollected"; }, {}, [], 10, 0, true, false ] call BIS_fnc_holdActionAdd; 2 1 Share this post Link to post Share on other sites