Detecting unit standing in water, either shallow or deep

gameshow

New Member
Reaction score
1
I'm trying to use an ability on a hero i only want activateable when in water. How can I detect that? I've never written any JASS before, but i have done plenty of c/c++/various scripting languages. I saw another forum post where they threw around the term "pathability testing". That ring a bell?
 

Azlier

Old World Ghost
Reaction score
461
EDIT: Rewritten because I read what you wrote in another thread.


That should hopefully return shallow water.


And this deep. I hope.

JASS:
function Rofl takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    //Shallow water.
    if not IsTerrainPathable(x,y,PATHING_TYPE_FLOATABILITY) and not IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) then
        //Actions
    elseif not IsTerrainPathable(x,y,PATHING_TYPE_FLOATABILITY) and IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) then
        //Actions
    endif
    set u = null
endfunction

This is a hopefully functional function with it at work.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top