Generating modular buildings using Blueprint

Hello,

I’m working on a pretty large environment (a lot of buildings), so naturally I’ve created a bunch of modular pieces which I’d use to build different variations of houses. To speed that up I decided to create a blueprint construction script which takes in an array of those modular pieces, loops through them and generates a random house, and then allows me to do any manual tweaks to it if necessary. It works really well, however it re-runs the script and therefore re-randomizes all of the buildings every time I modify something or go into the PIE mode, which is obviously not what I’m after.

Is there any way to cheat the construction script so it wouldn’t keep randomizing the buildings every time? Or are there any better approaches to do what I am trying to do?

Thanks

Well I had a similar problem with my target points in a Tower Defense game I’m working on.

Every time I moved it, the number would go one above the currently highest.

My cheat around it was a Boolean variable which I would set false once the construction script run through and before I set the number (or in your case before you spawn in the random modules) a branch which checks for that variable.

Thanks, it worked well :slight_smile:

In my case I had to create a mesh array and during the process of random house generation, store the modular pieces that were used into that array. Then I set the Boolean to false at the end as you mentioned, and at the start of the script I have a branch to check that boolean, and in case it is false (random house is already generated), it simply rebuilds the house out of the pieces that were stored in the array, which basically keeps the house same as it was.

It also lets me make manual changes to the house by just tweaking the pieces in the mesh array through the blueprint details tab, so it all worked out nicely :slight_smile: