ConstructionScript ForLoop skip array of indexes.

In my construction script I use a ForLoop to place a x number of Instanced StaticMeshes in a row. I have an exposed integer array variable. I want to be able to add as many integers to the array and have the loop skip those indexes. I tried using a ForEachLoop with Break but it only takes the first integer. (I read about this before and I don’t think it’s ever going to work this way) I have simplified what I’m trying to do to make it easy to understand. There may be a better way to achieve this that I’m missing. This is a floor for a procedural building and I need a way to cut holes in the floor for stairs, elevators. So I need a way to remove certain floor squares. If I could have it the way I really wanted it, it would be that the user of this procedural building blueprint could add as many collision boxes to an array of collision boxes that he wanted and freely size and move them around and where they collided with the floor squares, they were removed but this is way above my skill level. I’m just trying to find a way, even if not so elegant or easy to use, to make it work.

You only need to add the instanced mesh once, then you add instances of it.

Also, looking up the indexes you want to skip in an array will do the trick

You are awesome, Thank you so much

1 Like

Thanks so much for the solution but I have another question. If I want to do it with an array of structs, so I can specify an x row and a y row of integers, sets of integers.


How would I do this?

@ClockworkOcean

What? It’s working? or… :slight_smile:

You’re giving yourself a hard time. It’s just the same thing again…

1 Like

@ClockworkOcean Why can’t I see this, thank you so much, artist not a programmer but should be able to understand this. Can’t thank you enough.

1 Like

@ClockworkOcean I have another question and maybe to much to ask. But the solution you helped me with worked, but now that I try to use it, it becomes extremally difficult to use. I have 5 floors and 100 floor squares per floor and the first floor has 30 squares to remove, anyway trying to find the squares you want to remove or finding them again in the array to put them back in becomes really difficult. Is there away to use a sperate Blueprint, like for example a stairs with a collision box and where it collides with the floor squares in the Floor Blueprint it removes them? Is this possible? Then you could just move the stairs where you wanted them in editor and it would remove the floor squares? Here are pics to illustrate what I mean.

You can call ‘run in editor’ events, and the floor and stairs could talk to each other.

So, this is my BPA, and in the construction of BPB, I can say

Do I need to cast to the floor Blueprint? I created the custom event in the stairs Blueprint tick the Call in Editor, But how do you get the other end of the event in Floor Blueprint? I see the button in the editor to run the event. Sorry for the confusion.