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

check if terrain at a point is water

Status
Not open for further replies.
Level 23
Joined
Apr 16, 2012
Messages
4,041
check if the point is walkable, shallow water is walkable, deep is not(unless you put some blockers in shallow water)

You could also check the Z coordinate of the point, if it is > -80 or w/e(I dont know how deep deep water is considered to be) then you are in shallow water, if it is lower, you are in deep water

I didnt try any of those, but the first should work, I dont know if you can get negative Z coordinate tho
 
Level 6
Joined
Jan 8, 2009
Messages
140
i'm planning on using it with an ability, is there a way to stop anything not walkable being targeted? would the z axis one also pick up if the terrain was lowered but not water?
 
Level 5
Joined
Nov 30, 2012
Messages
200
I don't think you can differentiate between deep and shallow water (I may be wrong), but you can tell if a point is water or now by using this condition:

(Terrain pathing at Point of type Floatability is off) Equal to False

or

Set Point = Wherever
Custom script: set udg_Real = GetLocationZ( udg_Point )

Water has a height of precisely 166.400
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
I don't think you can differentiate between deep and shallow water (I may be wrong)

  • Untitled Trigger 001
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Set p = (Position of u)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at p of type Floatability is off) Equal to False
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain pathing at p of type Walkability is off) Equal to True
            • Then - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: deep water
            • Else - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: shallow water
        • Else - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: not water
  • Custom script: call RemoveLocation(udg_p)
 
Level 5
Joined
Nov 30, 2012
Messages
200
You're right. If you just create a map without changing the base height that's what the value is.

And, Maker, thanks for proving me wrong. It's good to know!
 
Level 6
Joined
Jan 8, 2009
Messages
140
I used your suggestion Derdan then ran into this problem however i just grabbed the water heights in game, which all end in .400. then i tested other areas of the map and didn't come close to one of those values so hopefully it doesn't cause any issues.

  • Untitled Trigger 001
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Set p = (Position of u)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at p of type Floatability is off) Equal to False
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain pathing at p of type Walkability is off) Equal to True
            • Then - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: deep water
            • Else - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: shallow water
        • Else - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: not water
  • Custom script: call RemoveLocation(udg_p)

Also I can't seem to find these conditions?
 
Level 6
Joined
Jan 8, 2009
Messages
140
Well the best solution to detect if the water is deep or not ... You should use an invisible dummy using a trigger to detect it's height . Well the deep water has a lesser height then the shallow water :p
Condition : Integer Condition - Height of 'dummy' less or equal to 'height'

getting the z location from above gave me the same height for shallow and deep?
 
Level 5
Joined
Nov 30, 2012
Messages
200
Using Z location will indeed give you the same value for shallow and deep. If you look at Maker's trigger, the conditions can be found under Boolean > Environment.
 
Status
Not open for further replies.
Top