Yes, but it will only check the center of said region.Maybe I'm misunderstanding but you can set the Point to be the center of your region. Or the Point could be the position of your unit.
Then you check the terrain pathing at that point.
That is the conclusion I have reached;You need to iterate over the whole region, checking each pathing square for pathability. AFAIK, there's no built in way to do this.
That is where I am currently at;I think this would work. So you first determine the pathing size of your structure, a farm for example is 4x4 or 128x128 units long. You could store this information in an Array or Hashtable.
Then move your region to the position of the unit (the region will snap to the grid).
Then create an array of Points offset from the center of the Region that will be used to check pathability.
Farm (128x128) example:
set point[0] = center of region
set point[1] = point[0] offset by -128, 128
set point[2] = point[0] offset by -96, 128
set point[3] = point[0] offset by -64, 128
etc...
You could simplify this with a loop and some extra variables, something like:
Set variable IsPathable = True
Set variable x = -128, Set variable y = 128
Set variable point[0] = center of region
For loop (int A):
Set point = point[A] offset by x, y
Set x = x + 32
If Terrain is pathable at point[A] equal to False then Set IsPathable = False
Remove point[A]
If x > 128 then Set x = -128 and Set y = y - 32
If y < -128 then end the loop
Finally you can check: If IsPathable equal to True then -> You can build the structure there.
You may have to use smaller increments like 16 instead of 32.
And that is exactly why my trigger did not work; It did not account for other buildings or destructables (plus I did not know the exact size of a Pathing cell)I think issuing a unit with a point placement order to build the desired building will return false if the order fails because the building foundation could not be placed. If this is the case it could be used for a much more accurate placement test since it will factor in the placement requirements of the actual building footprint rather than some rectangle of pathing that does not even account for buildings and destructables in it.
You evaluate the return value.But how exactly do I get a 'False' from a failed order?
native IssueBuildOrderById takes unit whichPeon,integer unitId,real x,real y returns boolean
native IssuePointOrderById takes unit whichUnit,integer order,real x,real y returns boolean
I suppose the current order will still be 'null' even if the issued order was successful.After issuing the order, check the current order of the unit. If it's current order is something like (null) then you know it failed to do the order.
Thank you! Worked like a charm.You evaluate the return value.
Most of the order natives return a boolean that should represent if the order could be issued successfully.JASS:native IssueBuildOrderById takes unit whichPeon,integer unitId,real x,real y returns boolean native IssuePointOrderById takes unit whichUnit,integer order,real x,real y returns boolean