Check inventory for key to open drawer

Hey, I’ve made a blueprint work so that the player needs a key to open up a cabinet. If I go up to the cabinet it doesn’t open, so I pick up the key and then return and the cabinet opens so it seems great, however if I pick up and object such as an apple before the key and then return, the cabinet does not open. See the pic attached for extra info on my blueprints. Any help would be appreciated, thank you in advance.

You are always getting index 0, so if the key is not at index 0 (i.e it’s at any other index), it won’t find it (it would be at index 1 if you pick up an apple first). This is an array of inventory items is it? Why is HasFillingCabniet key a part of every inventory item’s definition? Shouldn’t it be a regular item, say it’s item name was “CabnietKey1”, you loop through your inventory array (with ForEach), and set the bool true if it finds a key with that name. Obviously, looping through the entire inventory wouldn’t always be efficient, but it’s just an example that makes more sense to how you seem to be doing it now, or maybe I’ve misunderstood

Thanks for the reply, no you’ve not misunderstood I’m just not the best with blueprints haha. So I should create a for each loop from the inventory array? There is no bool to set to true or maybe I’m missing something?

Loop was just an example, a better way would probably to make an item literal like this, and check if it is found in the inventory array.
For a key item, you could have it all default value except the name which is unique for a unique key, but you can make any item and find it this way too, provided all variables match.

The bool, I just mean that it would pass to the branch, the print string here is where you’d open the thing:

Thank you Mosel3y! It works great and is more convenient :slight_smile: