Problem with setting the condition

There are many ways to do it; an efficient one that does not require looping through all the pieces is an event driven approach using [Event Dispatchers][1]:

  • create a dispatcher that sends the puzzle piece’s state


Below:

  • count the pieces
  • register the event
  • add 1 when correct / subtract 1 when it’s not
  • compare the result to total pieces

Image from Gyazo

Hi,
I have a blueprint, when I press the cube it turns green and the cubes next to it, but I don’t know how to make the condition when all the cubes light up green, I found a function that, after fulfilling the conditions, takes you to the next level, but I don’t know how to set all blocks to pass in green

To clarify, you want to detect how many blocks are in the correct state and then execute something else depending on that state?

I don’t use the spawn block, each
block is a separate actor for me

Same here.

Create an Event Dispatcher in the Puzzle Block actor blueprint first and then in the Grid:

Image from Gyazo

https://gyazo.com/cc54181426c35588e703ab1f2fb1084c

something still doesn’t work unfortunately

From the other thread; your grid spawns the blocks:

Bind the dispatchers as you spawn them if you’re still using the above method.

I don’t use the spawn block, each block is a separate actor for me, so I can arrange the blocks as much as I want on your blueprint to connect to the spawn block. As for the first question, it wants me to move to the next map after all the cubes light up green

In your animation, it seems the actors are not connected to anything:

320304-screenshot-2020-10-27-164110.jpg

You need to apply it to the blocks that you spawn or, if you’ve spawned the blocks already, loop through them and bind the dispatchers. Without execution wires, nothing is connected…

I just don’t use this method, that’s why I have a problem because wherever I connect it doesn’t work, my blocks are scattered randomly and nothing creates them, I drag the actor onto the board and that’s it

https://gyazo.com/65da17535003778159289ef58910aac5

If you do not keep a track of them in an array already, then Get All Actors of Class and register them.

You can do it in the blueprint that will do the counting. And the count is the length of that array or they can be counted during that loop.

There is progress only depending on which block I press, it changes the map, unfortunately`

https://gyazo.com/e62243d4f2b57e8aa6053c3103ab1380

`

https://gyazo.com/e62243d4f2b57e8aa6053c3103ab1380

Did you set the count as suggested above? If every click is a WIN, it seems that you forgot to set how many blocks to count against.

That’s right, but how to make each map have a separate counter, should I set it at the blueprint map level? Now, if I set 6, for example, just click 2 blocks on each map and the next board appears

Put it in an actor and add that actor to each level - this way you do not need to duplicate the script for each level!

just click 2 blocks on each map and
the next board appears

How are you setting the count?

I skipped one more thing and now everything is fine, I’m just learning the EU and that’s why it all looks so poor

Everything is working now, thank you very much for your help
https://gyazo.com/5a1aab2cb2ce585bf3bda06b400646cb

Awesome! Good luck with the rest.

Yes, and it works as it should
https://gyazo.com/a99bdfe9f06457f30a50248d5318d353