I want to order a scv to build a barrak at a random point in a region. However some point are ofc but possible to build on so is theer som way to check with and IF case to "test" the point if it possible to build on?
In short. how to check with trigger if i can build a barraks at a point?
that's a really good question and the solution i came up with doesnt work 100% but close to it.
if you need 100 % , you need to check if the worker is building or moving to the target and reorder a newpoint if it doesnt.
the function takes the size (3 for 3x3) and a point and checks every cell if you can build on it. i only had uneven sizes, you would need to adjust it to work with even numbers too
also you might want to round the points to match the grid placement.
I did first check if the point was pathable and then i just created the building with trigger. The editor then place the building to the closest point when i can be to where i want it to be, adjusting the point it self. After it done that i just save the building location, remove the building and order the worker to build at that point :) So far it have not failed any time i tested.
After reading your code i see things i did not even know you could do in the game, things i can use :) thanks.
It seams like a combination of your and mine code things look very nice.
I want to order a scv to build a barrak at a random point in a region. However some point are ofc but possible to build on so is theer som way to check with and IF case to "test" the point if it possible to build on?
In short. how to check with trigger if i can build a barraks at a point?
that's a really good question and the solution i came up with doesnt work 100% but close to it.
if you need 100 % , you need to check if the worker is building or moving to the target and reorder a newpoint if it doesnt.
the function takes the size (3 for 3x3) and a point and checks every cell if you can build on it. i only had uneven sizes, you would need to adjust it to work with even numbers too
also you might want to round the points to match the grid placement.
I did come up with another solution.
I did first check if the point was pathable and then i just created the building with trigger. The editor then place the building to the closest point when i can be to where i want it to be, adjusting the point it self. After it done that i just save the building location, remove the building and order the worker to build at that point :) So far it have not failed any time i tested.
After reading your code i see things i did not even know you could do in the game, things i can use :) thanks.
It seams like a combination of your and mine code things look very nice.