I’m very new and to unreal and I’m still learning and I’m creating a a light puzzle that is based on this video UE4 tutorial: How to make a simple puzzle game but I do not know to check if all the lights are lit up and this is the closest I got but it does not work.
On the second screenshots how is your array populated? From what I can understand of your blueprint it seems to only contains the adjacent tiles, and not all tiles. You should look at GetAllActorOfClass to check all tiles in the level. Also, I would test the validity of the last ForEachloop element to know if a light is lit or not, you should instead set a separate boolean to true if there is a light lit, and then after breaking the loop you should check is this boolean is true or false.
in the tile game when you step on a tile the other tiles light up so that is how it gets populated.
for the getallactors I’m supposed to use it in the TileCheck event right?
and did I check for the validity properly?
On the second screenshots how is your array populated? From what I can understand of your blueprint it seems to only contains the adjacent tiles, and not all tiles. You should look at GetAllActorOfClass to check all tiles in the level. Also, I would test the validity of the last ForEachloop element to know if a light is lit or not, you should instead set a separate boolean to true if there is a light lit, and then after breaking the loop you should check is this boolean is true or false.
There is a more “correct” way to create the mini game:
Create the tile like in the video; the collision box + static mesh. Set the static mesh collision to no collision and the box collision as the root component. The component hierarchy should look like this:
Create a new actor class and place it in the level. Give it a static mesh component just so we can see it and debug.
Create an array variable same type as the tile class and set it to instance editable. Add the tiles we it want to observe same way as it was done with the neighbor tiles:
Now in the new actor, in Begin Play we bind to the dispatcher:
In time I’m sure you’ll eventually find ways to make the program do some of these steps for you. There are also more advance ways to create this that are less tedious.