i need some help please

Hello … i have a problem that i cant solve until now. for example i have a locked door and i want to be able to play the open animation of that door only when i collect 3 keys.
i know i must make some variables but i am lost :slight_smile: can someone help me of how to do it?

Did you started pick up your keys ?
Is your door work fine ?
You can’t do something whithout trying to do something.

Explore Event Dispatchers.

The task is the following if the keys are unique.

Key Blueprint:

  1. Create an Event Dispatcher on the Key called OnPickedUp and add an Input of type Key object reference to it
  2. Create a Custom Event and call it PickedUp and have it call the Event Dispatcher and give it the reference to Self.

Door Blueprint

  1. Create an instance editable Array of Key object reference and call it “KeyLocks”
  2. On BeginPlay make a ForLoop on the “KeyLocks” array and Assign to the Event Dispatcher OnPickedUp. The Auto generated Custom Event should be named something like “OnPickedUp_Event”.
  3. At the OnPickedUp_Event use the reference to Key and Remove it from the “KeyLocks” Array. Check if the Array Length equals 0 and if it does then call an OpenDoor Event.

Level Editor

  1. Find the individual Doors and assign the Keys to the Door “KeyLocks” array. Make sure there is no empty reference entries in the array.

Or more simple :

  • Make an actor key with a trigger on overlap. when overlap it put player Nbkey var set +1 and destroy the key.
  • On the door a trigger overlap count the Nbkey on the player overlaping : branch condition 3 : Open.