HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Quick function clarrification

03-26-2007, 12:33 AM#1
Ammorth
IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY)
It seems to always return false on pathable terrain. Is this a glitch?

Whats the radius it covers? a 32x32, 64x64 or 128x128?
03-26-2007, 12:39 AM#2
TaintedReality
I think after messing around with it some I found that it returned opposite of what it seems that it should. Check if it returns true on unpathable terrain, and if so that's your answer.
03-26-2007, 12:52 AM#3
Rising_Dusk
Quote:
I think after messing around with it some I found that it returned opposite of what it seems that it should. Check if it returns true on unpathable terrain, and if so that's your answer.
Correct.

It checks only the X/Y you supply.
Nothing else.
03-26-2007, 12:52 AM#4
Ammorth
hmm, yes, it does return the opposite, which is easy to fix up, but it doesn't check in 128x128 tiles... :(

So I would assume it checks in 32x32 since nothing is really ever 64x64... damn.

Oh well, thanks and + rep for the help

Edit:
Quote:
Originally Posted by Rising_Dusk
It checks only the X/Y you supply.
Nothing else.
well then 32x32 is the smallest increment of pathing in the pathing map? so It basically checks a 32x32 sqaure.
03-26-2007, 12:58 AM#5
Rising_Dusk
It doesn't check a pathing map at all.
It checks a single point as designated by the X/Y you supply.

However, pathing in itself is supplied in 32x32 squares.
So if you called the function on any point within a single 32x32 block it returns the same thing.
The function itself only checks the supplied X/Y though.
03-26-2007, 01:08 AM#6
Ammorth
damn, so the only way I could check the whole 128x128 (terrain tile) would be to check every 32x32 grid with that function (16 checks * 256*256 = way too many). sigh...

Okay, new question. Is there any other way to check if there is a cliff wall at a 128x128 square? I know I can check all 8 squares around it for a difference in terrain height, but that seems stupid aswell. Ideas?
03-26-2007, 01:26 AM#7
Rising_Dusk
Okay, so I just ran some tests on this stuff in different cases.
The truth be told, the function only seems to return reliably on cliff tiles and on doodads with pathing maps.
It doesn't seem to work at all on destructables or units.

It also seems to work on a 'tile' by 'tile' case.
If there is ANYTHING blocking a single tile (Meaning terrain tile, whatever size that is) it will tell you it's impathable.
This might be a useful behavior for you.

GetTerrainCliffLevel()
You could always check the cliff level difference between two coordinates.
That would detect if a cliff was there, though it would require 2+ calls per check.
Might not be realistic. [Apparently you thought of this too and came to the same conclusion]

I can't think of any alternatives.
You might just have to suffer with the inadequacy of IsTerrainPathable().
03-26-2007, 01:44 AM#8
Ammorth
Damn, kk. I'll see how the system goes (working on a new pathing system that takes terrain tiles instead of creating nodes) and see if I have to implement it.

The problem with Wc3 is that GetTerrainType() will return true to Rock even if no rock is being shown because of the bottem or a cliff, or of a cliff wall.
Zoom (requires log in)
I could just warn players about this, and tell them not to do it, but I would rather have the system detect it and warn them, or correct it (it would sit better in my mind to know that my people are looked after :D)
Attached Images
File type: jpgproblem.jpg (67.7 KB)
03-26-2007, 01:47 AM#9
grim001
Are you sure you don't just want to move a unit there using SetUnitLocation then check if it wound up where it's supposed to be? It seems the fastest and most accurate method of checking for pathability
03-26-2007, 01:50 AM#10
Ammorth
I guess, but then I have to worry about other units hindering the unit in question. I gotta eat, but I'll think it over and test it out. Back within an hour or so.

Edit:
Okay, new problem. The unit (a standard peon 'hpea') can be placed on cliffs that have no proper pathing...
Zoom (requires log in)
Ideas?
Attached Images
File type: jpgproblem2.jpg (21.9 KB)
03-26-2007, 05:53 PM#11
The)TideHunter(
In your case, you must be using SetUnitX and SetUnitY while you need to use SetUnitPosition takes unit whichUnit, real newX, real newY returns nothing Setting of X and Y will not look for pathing problems, while the Position one does.
03-26-2007, 07:25 PM#12
grim001
Quote:
Originally Posted by Ammorth
I guess, but then I have to worry about other units hindering the unit in question.

If you don't want units to block pathability, use an item.

If you do want units to block pathability, use a unit.
03-26-2007, 09:04 PM#13
Ammorth
Quote:
Originally Posted by The)TideHunter(
In your case, you must be using SetUnitX and SetUnitY while you need to use SetUnitPosition takes unit whichUnit, real newX, real newY returns nothing Setting of X and Y will not look for pathing problems, while the Position one does.

This is the section of code that checks for if the unit is there or not.

Collapse JASS:
...
call SetUnitPosition(udg_PAS2_DummyUnit, udg_PAS2_Xtemp, udg_PAS2_Ytemp)
set x = GetUnitX(udg_PAS2_DummyUnit)
set y = GetUnitY(udg_PAS2_DummyUnit)
if (x >= udg_PAS2_Xtemp - 1 and x <= udg_PAS2_Xtemp + 1) and (y >= udg_PAS2_Ytemp - 1 and y <= udg_PAS2_Ytemp + 1)then
...

Quote:
Originally Posted by grim001
If you don't want units to block pathability, use an item.

If you do want units to block pathability, use a unit.

True enough, or I could technically just disable all pathing for all pre-placed units, check and then enable it again...

I'm going to let this slide for a bit. I need to work on the heuristic and on how I should implement the data for processing. If you guys have any ideas, don't be afraid to post. I'll check back to this thread periodically.

Thanks to you all and + rep

Edit: grim001 and Rising_Dusk have been rep-ed to recently, let me rep others and then I'll get back to you both. (done)