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

Water Check {how to check if the unit is in the water?}

Status
Not open for further replies.
Level 5
Joined
Dec 18, 2007
Messages
205
Hi guys.

Is there a way to check whether a unit is in water?
And is it possible to differ between "deep" water and "dead water"/"shallow" water

Basically I want to detect whether a unit moves into/out of the water, so I can do some actions.
An alternative solution would be making regions and detect a 'Unit - Enters/Leaves Region', but with a naturally looking ocean this would be really time-consuming to create so many regions.

Thanks for any ideas or scripts. I searched, but was not successful.

Greetings,
bReathl3sS
 
Level 5
Joined
Dec 18, 2007
Messages
205
unit enters location would suck because i would have to make more than 500 regions for this.
i try the method from rui.
and why should this trigger go und world editor help zone?

i searched for a jass script or suggestions for triggers that could make this ;)
well not my decision.
thanks i'll try it

EDIT: ok it works, this way it is possible to detect whether the unit is in the "deep water" (cliff height 0).
thank you.

greetings
 
Last edited:
Level 9
Joined
Jul 3, 2008
Messages
495
Else you can use a tile under the water. Lets say you use a stone tile under the water, then you use the triggers to detect which tile there is below the unit.

But you that also means you cant use the tile any other place in the map.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
No.

You can check the terrain pathing to see if it is floatable - this actually means the water has to be a little deeper than the minimum (Though with cliffs it doesn't matter).

Alternatively, you can use the above method to create a region which encompases all water on the map. The upside of this is that it's blazing fast to detect units entering/leaving water. The downside is that it takes a while to initialize (freezes the game for ~5 seconds on a 320x320 map).
 
Status
Not open for further replies.
Top