• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Way to detect can a unit reach its destination?

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,239
Last edited:
Level 13
Joined
Jan 2, 2016
Messages
978
Well, I found a native "IsTerrainPathable", but it doesn't quite work the way I want it to.
When I put "pathingtype" = PATHING_TYPE_WALKABLE and do "if true - call BJDebugMsg("true")" else call BJDebugMsg("false")" - I'm always getting "false", besides on water.
When I use PATHING_TYPE_FLOATABILITY - I always get "true", besides on water.

When I googled it - I found something, that could help a bit, but not really:
Split my map into regions, and check in which region is the unit, and check which region its tying to reach. Then check a fixed boolean if it can go from its region to the picked region.

However, I have trees blocking the path on my map, so if some trees are destroyed - the path will become walkable, and I don't know how to check when it becomes walkable.

So I guess I'll just change the way my spell works xP

EDIT: since "IssuePointOrder" returns a boolean, I tried to see if it's true or false after I order the unit to move somewhere, but it was always true :(

EDIT 2: I have a really ridiculous idea ( which I'm not gonna apply, but gonna share it anyways ): I can link the trees together in a hashtable:
tree 1 is next to tree 2, 3 and 4 (has 3 neighbour trees); tree 2 is next to tree 1, 3, 5, 6 (4 neighbour trees); tree 3 is next to tree 1, 2, 4, 6, 7 (5 neighbour trees), etc...
And when a tree dies - I could check if a path has opened up, by trqcking the chain :D
But for obvious reasons that's insane :D
 
Last edited:
Level 12
Joined
May 22, 2015
Messages
1,051
The warcraft path search engine uses the grid A* search technique, meaning every grid is linked as you said, those pink boxes that shows unpathable are cut and the remaining paths are stored in array or hash-tables I suspect but that is about the basics I ever know.

It would be nice if we could access that data (2D array is a likely way to store it).

For IssuePointOrder, it will be false any time it would give you an error message when you are trying to issue the order yourself. EX: "Not enough mana" or "Can't target allies", etc. You can see where the order might fail by trying out the orders yourself in-game (perhaps with a dummy spell). I am not sure if move command ever gets stopped, so it might always be true.

As for the main question, I don't know how to do this.
 
Status
Not open for further replies.
Top