How can i set a correct sequence picking x number of objects?

hey guys, i have a problem making a sequence picking up objects, i want to set a specific order for each one, ex: grab first cube blue, and next cube orange, then, go to the x point and see the order of the sequence that i made picking the objects, if the sequence is correct, a widget should be appear in the x point, if is not, another with a text that says incorrect order or something, i really hope u can help me!, greetings

Have you started on anything yet or are you asking for a tutorial on this? There are a lot of unanswered questions here I feel regarding the implementation and the rules of the “puzzle”.

I guess I can start off by saying that the way I would have done it is creating a Blueprint, call it BP_Puzzle (just guessing you are doing this in blueprint) that contains the boxes and a widget as components. If the player moves up close enough, you get a reference to the BP_Puzzle in your character BP, this way you have a connection between player and puzzle. The cubes are made so that you can interact with them (preferably through collision shape of some sort). The widget has two states, one if the sequence was correct, then it should show the widget, or if it was not correct set a text showing instead.

Interacting with the cubes should maybe be done through a raytrace (however not sure how you intend to interact with them). Store the cubes you clicked on in an array (probably in the BP_Puzzle). When arrays length is equal to number of cubes, compare the set sequence with the array order, if they match set the Widget to showing true sequence, if its false set to show text instead.

Thats a rough sketch, please add more information regarding your needs and I’ll make sure to help you!
Cheers

thanks for the comment! yes, the idea is interact with the cubes through an input, F in this case, at the start of the level the player sees the x number of cubes in order, and he has to pick up with the input in the correct order, (yellow, blue, orange, etc) and then go to the x point when a widget appears with the stadistics, the order of the taken cubes and a message saying if the order is correct or not.

At the moment i ve configured the input, the cubes with the respective collider and the widget in the x point…the rest i dont know how to do it, I would be very grateful if you could make a guide or upload photos of a possible process, thank you!!

It is too much to cover for me to write an explanation. Download the project and have a look for yourself1 I created a rudamentary solution, that is not at all very flexible or expandable. But it should give you a rough estimate oN how to do things. Still not entirely sure I understand your description, if you have further questions please let me know :smiley:

The blueprints you need to go through are the firstpersoncharacter (when pressing F an event is triggered), the BP_Puzzle (where basically everything is taken care of) and the PuzzleWidget!

man this is aweome! im very thankful for this, im studying the way that you use to make the interaction with the cubes, im trying to do in my case the same exercise, with the difference that i have to take the cubes in the collider pressing the input, so your work it was very useful for that, thanks again man you re awesome :’) , sorry for my bad english haha

Yes it is important to understand how the communication between the FirstPersonCharacter and the BP_Puzzle works.

In the FirstPersonCharacter blueprint I have a Variable that is of class BP_Puzzle, this will act as a reference to the puzzle so we can communicate with it. The important thing here is that I’ve set it to be Editable (notice the eye to the right in the picture).

226601-fpp1.png

When we have both the FirstPerosnCharacter and the BP_Puzzle dragged out in the level we can then set that variable reference. See picture below.

This will allow us to communicate between the two blueprints, i.e when we Click F, we will do a raytrace inside the FirstPersonCharacter, if we hit the puzzle we will call the event User Clicked on Cube inside the BP_Puzzle

Hopefully this cleared some of the things up :slight_smile: