Unit (tree) dont spawn on structure

How i make an unit called (Tree) dont spawn on structures

2 Likes

Just use the position is in wall boolean to check:

  1. Set a position variable to random position in region
  2. Make an infinite loop
  3. Inside the loop, add a conditional that checks if the position you created before is in wall: if true, reassign the variable to another random position you generate; if false break iteration
  4. Spawn tree entity at the position stored in your variable
  5. To make more trees, nest all in a repeat x times loop
2 Likes

An alternate way is to let them spawn in the wall, but enable collision so they instantly get pushed out. This method is simpler but isn’t perfect though, as they would remain stuck in thicker walls, or between a wall and the map border

2 Likes

Sorry but I don’t understand, could you make me a script for all this?

2 Likes