[UE 5] Blueprint - I need a better way to control the loop

There is my blueprint in the screenshot and I want to know how can I immediately run the loop as soon as I “know” that the value(UP, LEFT, RIGHT - it has random value) is true

1 Like

It’s just an OR.

4 Likes

Will it work if I have 2 true and 1 false?

1 Like

It will work if one or more is true…

2 Likes

Oh…sorry for the dumb question, but I still need to know what was true from them, for what? To specify different rotation values. What i can do in this case?

1 Like

( you can do something like this in the loop )

2 Likes

It looks like what I need, but I’m not sure, I’ll tell you tomorrow the result of my “experiments”.

1 Like

Cool. If you tell me what you’re trying to do, I can show you a method…

2 Likes

I am trying to do level generation. I have a method that randomly selects a platform type from an array and uses boolean variables to set what direction it has. For example, I got a platform that has 2 or 3 directions (Forward, Left, Right) (It all depends on the rotation of the platform itself, it can be Forward and Left or Forward and Right. See Screenshot). After that, I need to generate “corridors” of random length from these directions, after which I call the method for determining the platform and repeat the cycle until I have a platform without directions.


If needed, I can show these methods to make it easier for you to help me.

1 Like

Got it. I’ll come back soon…

1 Like

Ok. Looking forward to your reply

1 Like

What are these shapes? Are they static meshes or blueprints or?..

2 Likes

Well, basically, you want to kind of keep the possible angles together with the shape.

If they are static meshes, you might make a structure, which holds a mesh and an array of angles.

But I think an easier way, is to make them blueprints. You make one main parent BP, and the shapes are children of that. Like this:

I make a new actor BP, and all I do is put an empty array of floats in it

That’s it. Then we make a child BP of that for our first shape:

image

and call it MazeL, or something like that. Now we can put the meshes in

and click the eye here, so we can see that empty array of floats ( from the parent ):

image

Then we can put the possible angles for the L shape here:

Then, same process, we make our T child, and put the shapes and angles in:

Like that.

So now, wherever you’re doing the spawning, you can have an array of the different kinds of shapes

image

I put my shapes in

image

and then the code for spawning is only

( notice I didn’t set the location, I assume you know what you’re doing there… )

Does it make any sense?..

mazeparts

In fact, in the end, the spawn code needed to cope with the spawner being rotated. It looks like this:

2 Likes

Sorry if it’s a bit complicated. What I’m really saying is, put the angles with the parts, and you always have everything you need to hand.

For instance, once you get this bit figured out, the next thing you’ll realize, is you want to know where to spawn the next part, depending on what shape you just spawned. That can also go in the blueprint, you see.

If it’s a bit much, just say so, and I’ll help you just figure out the next step… :slight_smile:

2 Likes

Hello. I really appreciate your help and I’m very sorry, but I did this stage in my own way, sorry for not putting the emphasis on the problem well. It is difficult for me to explain what I need in English, and I decided to draw what I need


The red “dots” are from where I need to generate the corridor (path to the next branch)

This is my selection function for this “brunch”. Where do I store boolean variables in order to later know in which direction I need to generate a corridor (path)

This is my method for generating the corridor itself (still in progress). And I’m stuck, I don’t know how to use a boolean variable, since all “branches” have several paths at once

I need smth like this in current version

In final i need add some rooms

Yes, I see what you mean. Trouble is, if you try and do it from the level BP ( which it seems like you are ), your head will explode before you get there.

Blueprints is the way. Let me explain. Let’s say you start with this ( in a BP ):

image

It knows where the spawn points are, and IT can spawn the other BPs, you don’t have to do it.

The pieces will continue spawning until they have all spawned a dead end.

Does it make sense?

Yes, it seems to make sense. But I’m not sure because I’m too green

In this code

are you about to spawn a new piece, but you don’t know what rotation?

In theory, I know what rotation, rotation for UP - 0, for LEFT 90, for RIGHT -90. I don’t need rotation for the “branch” types … I think so, since I get all the information from boolean variables

So you can spawn it? What’s stopping you? :slight_smile: