Can someone help me explain this looping logic ?

I making this loop :
image


at first time flowing pass nodes it’ll going pass 1 2 3 4 5 6 7 9
then from second time flowing it’ll going pass 1 2 3 4 then 9
why its flow ignore my logic in loop body of 2nd While Loop ?
Can someone help me explain this, please ?
Upgrade :
My blueprint can basically like this

What’s wrong in this structure ??
Thanks for reading sirs <3

1 Like

These parts do nothing

The first time around your loop, you set your valid bool to false, even though it did spawn ok. Then the loop doesn’t spawn any more.

What are you trying to do exactly?

1 Like

Thanks for helping bro <3
Because i choosed "Do not spawn " in SpawnActor node. so i wanna make sure if it’s not spawn because overlap with other actors (8), it’ll comeback looping at 4 till new location spawn valid.
This’s how i thought :
Set is valid vector = true
While ( is valid vector = true ) loop body will spawn actor with random location in array vectors.
Checking actor spawn or not by Branch node,
if actor spawned exit loop body and going to completed, add actor into array spawned actors.
if actor didn’t spawn so it’s not valid actor and looping again to spawn actor with new location random in array vectors.
Can i asking why i ticked is valid actor spawned be true and connect it with Set node, but it still be false ?

You need to set the bool directly from the isvalid

image

1 Like

Can you explain more about this ?
i tried to change some :


this way, both true and false going to add into Spawned Actors array ( idk if it was false it would add which actor into array while it’s not have any actor spawn there ?? )

these way it’ll going to Add array node after first time flowing same like old way i posted


i tried doing this, it’ll drop loop body and going to Add node immediatly

i think my blueprint can basically like this, anything in this structure was wrong ??

1 Like

Tell me what you’re trying to do? Spawn something, obviously, but then what?

I have an array vectors, then i wanna spawn random actors on all vectors in those array vectors how to they’ll not overlap together


important here’s they’ll not overlap together

You can just use this to spawn without overlapping

spawn

But do you want to spawn again if you get a miss?

hold on, let me try this
Thanks for helping bro <3 :heart_eyes:

1 Like

This will keep trying until you’ve done N

But watch out, if the space is too small, you’ll get a loop error.

1 Like

so many things i wanna ask, let me try all then come back
thanks for helping bro <3

1 Like

just one fast question before i can running testing, i need making one actor box with correct scale transform, placing in level then actor spawn will spawn in that box ?

1 Like

How you make the random list, is up to you.

This was just a quick method.

If you want to use a specific list, then use

But you need to have N things in the array :smiley:

It will get stuck in a loop though, if it can’t spawn, that’s the problem with this method… maybe better to take the ‘not valid’ loop out :rofl:

1 Like

yah, i used length of array vectors as N.
i think your solution was best, but i got problem with my vectors array, so i need to checking this array again.
Thank you so much for helped bro <3 much apriciated :pray: :pray: :pray:

1 Like

If you just want random stuff, but something needs to be in a specific place, you can just put the important items in, then do the spawning.

1 Like

can i asking another problem ? it’s not in this post
it’s about my previously function - which i made with helped of chatgpt - it’s one function help me generating random vectors with input are Number vectors generating, min and max distance from old vector to next vector - and new vector to other vectors in array vectors generating.
Output is array vectors.
With your view, can i asking how would you making that function ?
So same to post full this function here cuz it’s looking really bad :


i saw your way to making solution much easier and faster than how i thinking
Thank again bro :pray: :pray: :pray:

I can’t see that pic, it’s too small.

So you want to make random vectors, minimum distance apart?

1 Like

yah, minimum distance and maximum distance with vector right before it,
and > minimum distance with other vectors in array
example i want 3rd generating vetor will spawn in range 300 > 500 with second vector
and it’ll not in range < 300 with first vector too ( this’s mean new vector will not spawn in range < min distance )
p/s : my function is look like very complicate, so i think it’s not really nice to post all it’s up
i’m feeling hard to explain it all

1 Like

It sounds a bit impossible :slight_smile:

I can do random vectors in a box, where all have a minimum distance apart.

But you can’t have min and max distance, if you think about it… :rofl:

1 Like