Door that requires 4 keys placed into it to open it

I’m trying to make a door that requires the player to collect 4 key like items that need to be visibly place into a door to open it. As the player collects these keys they can begin placing them into the door but it wont open until all 4 are placed. any tips would be appreciated.

The whole idea is that there is a door the player need to access to continue they search for objects that act like keys say crystals. the player knows the door needs these 4 crystal’s because there is a hollow outline of the crystals in the arch of the door. each crystal can be placed by pressing E on the door one at a time or all at once into the hollow outline. The door however only opens if all 4 crystals are placed

  1. A single door can only take 4 keys but there can be more than 1 door using a id system for the keys and door
  2. the keys can all look the same and act on all doors with the same id
  3. all doors require 4 keys in total
  4. the door can be reusable
  5. the amount is set to 4
  6. no the only item allowed is the key that is placed into the door with the same id
  7. no order is required just as long as the key has the same id as the door
  8. 4 keys per door
  9. the player can place any keys they have collected into the door and only the keys that are collected can be placed into them.
  • are there only 4 keys, ever?
  • if more, can it be 4 of the same key that opens the door, or no duplicates?
  • will all door have the same combination of keys
  • is there more that 1 door; as in, is this reusable door
  • will some door require more or less keys
  • can I place something in the door slot that is not a key, regardless whether it counts as a key or not
  • is there a combination / order
  • how many keys in total will there be in the game
  • is there any indication or player feedback when placing keys; do they know they’re placing right items


So this seems to be a 3 part-er.

Door Blueprint:
You should make a variable name array which has the ID’s of the 4 keys you want it to be tied to.
Have a 4 index boolean array which represents the same index of each key.
Have an event trigger for a successful key submit.

Key Blueprint:
Keys should have a Name variable with the designated ID to be tested against on the doors

Player Blueprint:
Once the key is “picked up” you can read the ID variable and add it into a Name variable array for the player character as collected keys

How it works:
When the player ‘picks up’ a key, it gets added to the ‘collected keys’ variable array for the player. When you go up to the door, you can use a line trace for interaction on the door and pass the ‘collected keys’ variable to it. run an event on the door when it’s hit w/ the visibility trace and have it run a for each loop where it checks all the collected key id’s against the 4 that it needs. from the for each loop, if it finds a matching ID, have it set the matched index of the key ID in the door’s ID variable array on the boolean array and have it check with a for each w/ break if all 4 of the boolean indices are true. if it hits one that is not, break and end it, if they’re all true then call an event to unlock the door.

Edit: To easily implement and reuse this, create a ‘Parent’ blueprint for the door and the keys. You can then copy them and set the parent as that actor and set the variables within the blueprints of the children when spawned.

-Key: you won’t see the parent variables in the left pane by default, but you CAN call them and they ARE a part of the child blueprint so if you get a naming issue, that would be the reason.