kibaBG   49 Posted November 4, 2022 Hi, I simply don't know how to check if player has specific item in inventory. 🤔 I searched biki and found only this -> https://community.bistudio.com/wiki/BIS_fnc_hasItem I try to use it in a loop to check regularly for an item but it gives an error  if ([player, "acex_intelitems_notepad"] call BIS_fnc_hasItem) do { hint "You have found important intel!"; }; Any leads? Share this post Link to post Share on other sites
gc8   977 Posted November 4, 2022 replace the do with then  that should do it 🙂 1 Share this post Link to post Share on other sites
kibaBG   49 Posted November 4, 2022 OMG, thank you, no errors but still not working 😪 ... Share this post Link to post Share on other sites
gc8   977 Posted November 4, 2022 21 minutes ago, kibaBG said: OMG, thank you, no errors but still not working 😪 ...  are you sure "acex_intelitems_notepad" is correct item name? Ace loaded up?  1 Share this post Link to post Share on other sites
kibaBG   49 Posted November 4, 2022 Yes, it's the correct classsname. At least what it gives in eden, ACE is loaded. The code taken from this theme https://forums.bohemia.net/forums/topic/152168-trigger-activated-when-item-added-to-players-inventory-from-dead-body/ is working in debug console. Gives "true" if intel item is in player Uniform. "acex_intelitems_notepad" in UniformItems player; uniformItems, vestItems and backpackItems commands should be used, because intel item can go to vest if uniform is full ... This is simply not working, don't know why? execVM from initPlayerLocal.sqf  if ("acex_intelitems_notepad" in uniformItems player) then { hint "You have found important intel!"; }; Edit I tested with other items like "Intel_File1_F" but still no avail 😥  Share this post Link to post Share on other sites
Harzach   2516 Posted November 4, 2022 Because it executes once at mission start/player join.  Also, the object in question is actually a magazine. if ("acex_intelitems_notepad" in magazines player) then { hint "You have found important intel!"; };  2 Share this post Link to post Share on other sites
kibaBG   49 Posted November 4, 2022 Still shows nothing ... 😕😔 Share this post Link to post Share on other sites
gc8 Â Â 977 Posted November 4, 2022 Make sure the code is running, put hint there somewhere before rest of the code 1 Share this post Link to post Share on other sites
Harzach   2516 Posted November 4, 2022 Works fine for me. How are you executing it? As I mentioned in my first reply, running it from an init script will only have it execute once at mission start. The code as presented above is meant more for testing in debug or for periodic execution by other means. 1 Share this post Link to post Share on other sites
Larrow   2817 Posted November 5, 2022 player addEventHandler[ "Take", { params[ "_unit", "_container", "_item" ]; if ( _item == "acex_intelitems_notepad" ) then { hint "You have found important intel!"; }; }];  1 Share this post Link to post Share on other sites
Harzach   2516 Posted November 5, 2022 Unfortunately, it doesn't fire when picking up an object via ACE interaction. 1 Share this post Link to post Share on other sites
Larrow   2817 Posted November 5, 2022 6 minutes ago, Harzach said: Unfortunately, it doesn't fire when picking up an object via ACE interaction. Ah ok, was just going off that you said it was a magazine. Didn't realise it was action based. 1 Share this post Link to post Share on other sites
Harzach   2516 Posted November 5, 2022 It's kind of the ideal solution (the Take EH) I think, but I'm not sure if there's a way to pickup ACE interactions that way. I'll have to dive into the ACE wiki/git... 1 Share this post Link to post Share on other sites
Larrow   2817 Posted November 5, 2022 Need to see if there is some kind of SEH for ACE intel when picked up. Or be able to change the actions code. ? 1 Share this post Link to post Share on other sites
Harzach   2516 Posted November 5, 2022 Here's the relevant Git if anyone else wants to take a look:  https://github.com/acemod/ACE3/tree/master/addons/intelitems It IS possible to pick up the intel item via normal action as well, BTW. It just seems prudent to ensure compatibility with ACE interaction. 1 Share this post Link to post Share on other sites
kibaBG   49 Posted November 7, 2022 On 11/5/2022 at 4:39 PM, Larrow said: player addEventHandler[ "Take", { params[ "_unit", "_container", "_item" ]; if ( _item == "acex_intelitems_notepad" ) then { hint "You have found important intel!"; }; }];   Error missing ] ... No error if written and not pasted. 🙂 But still no hint, just nothing upon taking the intel item. I am trying with other intel, not ACE item ... Edit: Not working with CBA intel items too. 😪 Share this post Link to post Share on other sites
Harzach   2516 Posted November 7, 2022 Works fine here. Again, how/where are you executing it?  Also again, it does not work with ACE interaction.  As for CBA intel items, they are "consumed" when picked up, and so do not go into inventory. 1 Share this post Link to post Share on other sites
Vadym Mazur   5 Posted November 8, 2022 if ('acex_intelitems_notepad' in (items player)) then { hint "You have found important intel!"; };  1 Share this post Link to post Share on other sites
Harzach   2516 Posted November 8, 2022 Magazines do not appear in the array created by assignedItems. 1 Share this post Link to post Share on other sites
kibaBG   49 Posted November 10, 2022 On 11/8/2022 at 12:03 PM, Vadym Mazur said: if ('acex_intelitems_notepad' in (items player)) then { hint "You have found important intel!"; };   Not working! @Harzach I make intel.sqf, put the code inside and then I write execVM "intel.sqf"; in initPLayerLocal.sqf (my scenario is SP).   Share this post Link to post Share on other sites
Harzach   2516 Posted November 10, 2022 See the first sentence of my first reply. 1 Share this post Link to post Share on other sites
honger   114 Posted November 10, 2022 5 hours ago, kibaBG said:  Not working! @Harzach I make intel.sqf, put the code inside and then I write execVM "intel.sqf"; in initPLayerLocal.sqf (my scenario is SP).   The init part in initPlayerLocal.sqf means the initialization phase of your scenario (or when player connects to the mission in MP environment), so your script is executed right at the start of your mission and it won't wait nor execute again. If you want to have it happen during your mission, place a trigger with "acex_intelitems_notepad" in magazines player in its Condition field and hint "You have found important intel!"; in its On Activation field. This is as simple as it gets, can't be any simpler probably. 1 1 Share this post Link to post Share on other sites
Harzach   2516 Posted November 11, 2022 That will work once, which is fine if there is only one piece of intel to be picked up. Setting the trigger to repeatable might seem to be the obvious solution, but then you'll receive that message every 0.5 seconds (default) while the item is in your inventory.  As above, if ACE interaction is not necessary, then you can just use the Take EH. It is the best option. Share this post Link to post Share on other sites
kibaBG   49 Posted November 11, 2022 @honger Thank you so much, its working from a trigger. Thanks to @Harzach and @Larrow for the initial code, your support is legendary. Share this post Link to post Share on other sites