Random Spawner, but not in specific areas

I want enemies to spawn around the map, however I don’t want them to spawn inside the yellow borders of the buildings.

My first Idea was to put filters on the randomizers that will check if the randomizer has rolled inside the buildings, but that was a bit too difficult and would take a lot of time. Still new to this so any help is appreciated.

I know two ways to do this.
1, you can make a system that generates random coordinates within your chosen area, then you spawn a helper object there. If the helper object detects that it’s in a wall, it will message back and the system will generate a different pair of coordinates, until if finds a pair that work. This will work if you put some blocks down inside the areas. You should also parent all those blocks to one object.

I will tell you the other way after school.

Thanks I appreciate it. I like the sound of this idea. If I understand it should just be these steps.

  1. Fill in buildings
  2. Use Randomizer and Spawn helper block
  3. Helper block detects if its in a wall with collisions
  4. If yes then re roll randomizer.

Thanks again for the help and let me know about the other way too​:grin::+1:

2 Likes

Yes, and you can even fill the building with object that are invisible, as long as it has collisions on. Helper block should be invisible too. I would also recommend using proximity instead of collision, and parent all wall objects (or objects you don’t want it to spawn on) to one object, and then use proximity to scan for that object.

I can help you make this if you need help.

I decided that the other method would be a bit too complicated. (as the only benefit of using this more complicated method would be the spare the hassle of putting out the objects to fill the walls up.)