How to open a door when the puzzle is completed?

I have a combination lock puzzle where the tiles need to be the same colour to open the door.

The issue is i don’t know how to check if the puzzle is solved then play the matinee from the class blueprint.

The blueprint below is a class blueprint (square) which when the player steps on it changes the colour of the square and it’s adjacents.

If the class blueprint can’t play the matinee then how do i reference the matinee from the class blueprint to the level blueprint?

Thanks for the help.

1 Like

First off, I might suggest setting your materials at the same time that you set whether they’re true or false. Setting materials at tick could get costly.

As for the check, you should store whether each cube is true or false in a bool array. Then after every time the player changes the cubes, you run a check to see if they’re all true. If they are, play your open door event. I made something quickly to sort of help you out. Replace the string with the call to your door event

Make a function, AllOn, like this:

Then, on the end of your ForEachLoop ( completed pin ), you can put this:

1 Like

I tried playing a matinee in the square class blueprint (where the blueprint in the question is in) but i cant lay it there. Can you play matinees in a class blueprint?

So i create variable in the class blueprint. Tick the variable with each square then use the blueprint you provided? Where should i put the set you used in my blueprint. I also don’t know how to reference the matinee actor for the door in the class blueprint to the level blueprint for me to open the door.

All of this I’m showing you goes in the level BP :slight_smile:

( that’s why it does ‘find actors of class’, because it’s not a square )

For ther last blueprint does that go in the class blueprint or the level blueprint

I’m asking because i can’t call the function in the class blueprint and i don’t have a forloop to connect to in the level blueprint because all the functionality is in the class blueprint.

GetAllActorsOfClass: you call it in the level BP and specify your tile BP as the thing you want to find. It will find all the tiles for you and then you can run the for loop on it.

Sorry. I’m a newbie if it isn’t obvious. I’ll try it out. Thanks for the help and patience.

I have added the corrections, but it hasn’t played the matinee.

I could share my project so you have a clearer idea.I feel i’m not good at explaining things.

Thank you for the help. I appreciate it.

Ah, I see, hold on.

For the first GetAllActorsOfClass i called the class blueprint.

So, still put that function I showed you in the level BP, but then also ( in the main level BP graph ), put this:

Ah, sorry, yes right in the GetAllActorsOfClass ( in the level BP ) you specify your tile BP, because you want to find them all :slight_smile:

I can add more screenshots if it gives you a better picture.

Not yet, I think I have it. Let’s check ( tell me if any of this is wrong ):

  1. You have a tile BP, when you step on the tile it turns off or on

  2. You have placed 9 of these in the level

  3. You want to know when the puzzle is done

  4. Put the function in the level BP

  5. Put the code I just pasted below in the main part of the level BP

  6. It will work :slight_smile:

Tell me how it goes…

So i have added the function and the play matinee in the level BP but nothing has happened.