How can I check if there is a possible path between 2 points?

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
Not easily. This was why Blizzard added a native to StarCraft II to do such calculation.

You can try the snippet above, which I assume does some sort of path finder logic. Another approach is to order a unit down a path and check if it gets stuck along the way. The issue with such an approach is the unit is limited to maximum unit movement speed so might take some time to walk down long paths.
 
Level 24
Joined
Jun 26, 2020
Messages
1,928
I don't get it, what do these functions?
vJASS:
function IsPathBlocked takes unit obstruction returns boolean
    // Determines whether or not there is a path after a new unit is placed

function LoadPathingMap takes nothing returns nothing
    // Loads pathing for map
    // Call before using system
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
I don't get it, what do these functions?
Top function looks like it is intended for maze tower defences. It seems like it should detect if the placed building, obstruction fragments the pathing map.

Bottom function seems to be an initialisation function. It should be called once before using the system. It likely loads in the current pathing map state.
 
Level 24
Joined
Jun 26, 2020
Messages
1,928
Top function looks like it is intended for maze tower defences. It seems like it should detect if the placed building, obstruction fragments the pathing map.

Bottom function seems to be an initialisation function. It should be called once before using the system. It likely loads in the current pathing map state.
Very well, thanks, but where is the function that tells me if 2 points can have a path?
 
Status
Not open for further replies.
Top