• 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.

Best way to detect if a point is walkable or not

Status
Not open for further replies.
Level 12
Joined
May 22, 2015
Messages
1,051
There are some spots that I don't want units to spawn because they are large unpathable areas. I couldn't find a way to check, so I have another trigger that later removes all units it finds in those areas (loops over a bunch of regions).

Is there a quick way I can check if those units are allowed to spawn there or not? It would be better if I could find a new spot for them to spawn or just skip spawning them.

Is there a similar method to check if there are any units at a point? I could use a units in range thing and check if FirstOfGroup is not null, but I am wondering if there is a quicker / easier way.
 
Level 12
Joined
May 22, 2015
Messages
1,051

LOL!!! Is items actually the fastest method? hahaha

Can someone go over the part where you need two items? Is that basically saying that if there is no nearby pathable ground to snap to, the item just gets stuck where you try to set it? Then doing the same with the other gets it inside the unpathable ground, but doesn't adjust since it is not pathable around the first item, so their x and y values are equal?

I just want to make sure I get that part. Sounds like it is necessary for my use cases since there are large unpathable chunks of terrain.

Is using a group the best method for detecting units that are in the way? This is less of a problem, but still something I am curious about.
 
IsTerrainPathable only checks static pathing, i.e. cliffs, water, etc.

Doodads, units, etc. won't be factored in. Using items is a very reliable method and it is generally the one that is used the most. You can also use units (use a dummy unit, use SetUnitPosition, and check where it ends up)--but that can fire a 'unit enters region' event--which can be problematic in some poorly coded maps.

This method is more recent and works quite nicely (either this or Blink):
http://www.hiveworkshop.com/forums/spells-569/pathinglib-v1-5-a-263230/
But I don't remember the downsides. It might behave a little differently than the normal pathing checks, I don't remember tbh.
 
This method is more recent and works quite nicely (either this or Blink):
http://www.hiveworkshop.com/forums/spells-569/pathinglib-v1-5-a-263230/
But I don't remember the downsides. It might behave a little differently than the normal pathing checks, I don't remember tbh.
The downside (debateable... it's more a feature than a downside imho) is that it also considers units blocking the spot as "unpathable" (whereas IsTerrainWalkable does not).

So it's more meant to be used in combination with IsTerrainWalkable than as a replacement.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Oh so it tries to build a tiny building at the spot, I guess? That might be what I want. Is it costly to do that check?
 
Level 12
Joined
May 22, 2015
Messages
1,051
Hey so I already implemented something for this without buildings (I used breath of frost since you don't seem to be able to cast that on non-walkable terrain). It is not as good as blocking against units as well (for my purposes), however, I realise I kind of want both (for different cases).

Is it okay to be using breath of frost for checking just walkability (same test as the item moving test but with an issued order instead). I made a dummy with 1 move speed and the spell has 1 range, so it just slowly walks around trying to cast its spell wherever I tell it to (it doesn't have any AOE so it doesn't do anything if it actually gets cast). I figure it is more efficient than having a dummy with no movement but with global range (since it would then cast the spell every time I check).

Is this a good idea or could it cause problems?

And for the building, can I do it with "build tiny ..." spells? Just curious since I think I would have to base the unit off a peasant to make it build or something. I haven't done much with normal construction in my map lol. Anyway, my plan is to basically copy and paste the code for the "breath of frost" test but with the "build tiny ..." ability I plan on making instead.
 
Status
Not open for further replies.
Top