Warcraft III resources & community, 2003–2006 · archived

IsLocPathable

not rated
Submitted by PitzerMikePhysics0 downloads
Will detect if the point is pathable or not.
The function will also detect deep water, cliffs ...

Thanks to AIAndy who actually did that function, I just rewrote it for general use.

Source

//============================================================================================================ 
//
// For more JASS scripts, visit us at http://www.wc3JASS.com
//
//============================================================================================================ 

function IsLocPathable takes location l returns boolean
  local real x = GetLocationX(l)
  local real y = GetLocationY(l)
  local real ad = ((GetCameraBoundMaxX()+GetCameraMargin(CAMERA_MARGIN_RIGHT)) - (GetCameraBoundMinX()-GetCameraMargin(CAMERA_MARGIN_LEFT))) / 720
  local unit u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),'odoc',x,y,0)
  call ShowUnit(u,false)
  call UnitAddAbility(u,'Aeye')
  if (GetUnitX(u) > x + ad) or (GetUnitX(u) < x - ad) or (GetUnitY(u) > y + ad) or (GetUnitY(u) < y - ad) then
    call RemoveUnit(u)
    return false
  elseif IssuePointOrder(u,"evileye",x,y) then
    call RemoveUnit(u)
    return true
  endif
  call RemoveUnit(u)
  return false
endfunction

Comments

0

No comments.