• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Detecting terrain height underwater

Status
Not open for further replies.
Level 2
Joined
Mar 22, 2007
Messages
10
Hmh no no no...

I need a way to DETECT, to KNOW, the height of a point underwater


But seems like there is nobody experienced enough here on hive to know a solution for this problem...

It might be possible,
can you create a dummy at this point on the ground?
 
You can get the z-Value of a unit using custom script.
Unfortunately I didn't use the WE for ages,
I am quite sure it is possible though.

Is there anyone that knows this custom script?
(I hope it's not the "GetLocationZ" because it doesn't work underwater)

But if anyone knows that custom script or knows another way to detect the terrain height underwater, go ahead and post!
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
there is a way to determinate weather a point is in the water or not.

This one doesn't exist as a native, but I found it in vexorians caster system.
JASS:
function IsPointWater takes real x, real y returns boolean
    return IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) and not(IsTerrainPathable(x,y,PATHING_TYPE_AMPHIBIOUSPATHING))


endfunction

I think you could use the GetLocationZ afterwards by setting the final z-height real to GetLocationZ-128 if IsPointWater is true.
I mean like...
  • set realZ = GetLocationZ(loc) - 128
And well I looked on the natives and couldn't find any other way than using GetLocationZ.
I can look again though

Edit: you could also modify the normal one as well like this, and then call it via a custom script (if its gui you use, I didnt follow if you want gui or jass)

Hence, I did a small function which can be accessable immediatly. But it takes a point by its x and y values.
JASS:
function GetHeightZWater takes real x, real y returns real
    local location loc = Location(x,y)
    local real r = GetLocationZ(loc)
    if (IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) and not(IsTerrainPathable(x,y,PATHING_TYPE_AMPHIBIOUSPATHING)) then
        set r = r - 128.0
    endif
    call RemoveLocation(loc)
    set loc = null
    return r
endfunction
 
there is a way to determinate weather a point is in the water or not.

This one doesn't exist as a native, but I found it in vexorians caster system.
JASS:
function IsPointWater takes real x, real y returns boolean
    return IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) and not(IsTerrainPathable(x,y,PATHING_TYPE_AMPHIBIOUSPATHING))


endfunction

I think you could use the GetLocationZ afterwards by setting the final z-height real to GetLocationZ-128 if IsPointWater is true.
I mean like...
  • set realZ = GetLocationZ(loc) - 128
And well I looked on the natives and couldn't find any other way than using GetLocationZ.
I can look again though

Edit: you could also modify the normal one as well like this, and then call it via a custom script (if its gui you use, I didnt follow if you want gui or jass)

Hence, I did a small function which can be accessable immediatly. But it takes a point by its x and y values.
JASS:
function GetHeightZWater takes real x, real y returns real
    local location loc = Location(x,y)
    local real r = GetLocationZ(loc)
    if (IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) and not(IsTerrainPathable(x,y,PATHING_TYPE_AMPHIBIOUSPATHING)) then
        set r = r - 128.0
    endif
    call RemoveLocation(loc)
    set loc = null
    return r
endfunction

Uhh.. If I would do it your way, it would always give me "height of water level - 128"
I need to know the exact terrain height at the point below water...

But thanks anyway for your effort!
 
Status
Not open for further replies.
Top