Detecting Water?

wingdnosring

New Member
Reaction score
16
Simple question: Is there a [trigger] condition that allows me to check whether a unit is standing on/in water or not? I plan on putting this in a library for others to use, so I can't use pre-created regions.
 
Got an alternative... Maybe.

Are there any spots on your map with cliff heights (not terrain heights) equal to the height at the point the water is placed at?

If not, you can use the integer comparison "cliff height at point == 0" (0 is most-likely your lowest height and thus the cliff height at the water area. This will also filter the non-visible water because it's "underground").

Atm, I don't have a different solution (Besides regions but meh. You could eventually cover a region over the entire water area for a 2nd check, in case you have low cliffs without water. That's what I do in my map actually).
 
Cover any water with regions.. Name them all Water 1-xx for easy reference. Then, when you're trying to check if a unit's in water, just check if it's in any of those regions.
 
Cover any water with regions.. Name them all Water 1-xx for easy reference. Then, when you're trying to check if a unit's in water, just check if it's in any of those regions.

Problem:
Regions are circular or rectangular. Now, if you have a snake-ish river, you'll need 100 regions for a rather small area to make it accurate.
 
Problem:
Regions are circular or rectangular. Now, if you have a snake-ish river, you'll need 100 regions for a rather small area to make it accurate.

Sounds like a job for limits! Though I don't think this would be vary praticle to put in a triggerXD
 
Well as I said, this is going in a Library, so it has to be triggered. It can't involve regions of cliff heights because somebody else using my library may have their water in a different place.

There's gotta be a way to do this without regions...could the water blocks be considered doodads or something?
 
If you use your GUI search, you'll see that it isn't possible to detect whether there is water.

However, if you try explaining what exactly you need it for (besides a library), we might be able to work out a "work-around".
 
Is there a way to detect terrain tiles?

As I don't think it'd be called water, due to the lava and lack of boats.
 
Is there a way to detect terrain tiles?

As I don't think it'd be called water, due to the lava and lack of boats.

Only possible in WCIII through JASS. Dunno if it can be done without regions. The new DOTA has an ability which detects if the unit is in/near water, but I'm pretty sure they used either "distance from point" and placed points along the center of the river, or regions.
 
And Trouble has just found your alternative ._.
Create a doodad/unit (It'll be used as your water 'marker', we'll say that it's code is 'wter')

Then, on map initialization, make a trigger 'grab' all units of type 'wter' and create a trigger that fires when a unit enters within range.

That trigger that's fired will:
1. Check if the unit is already in a group, (We'll call it 'soaked')
2. If not, add the unit to group, soaked

Then have a function like isUnitSubmerged(whichUnit)
The function will check if the unit is in the group soaked and return a boolean.

Then, every.. 1 second? have a function that loops through each unit in the group 'soaked'.
For each unit, get all units around that unit and see if any of the units are of type 'wter' if there aren't any, remove the selected unit from 'soaked'

Or something like that..
I don't use SC2, I just happened to be passing by =x
 
In that dota they might scan around your unit whether the cliff height equals 0 at your location or near your location. Afaik, dota doesn't have any other cliffs at that height besides water?

Points would take so much time to make it be accurate.
 
And Trouble has just found your alternative ._.
Create a doodad/unit (It'll be used as your water 'marker', we'll say that it's code is 'wter')

Then, on map initialization, make a trigger 'grab' all units of type 'wter' and create a trigger that fires when a unit enters within range.

That trigger that's fired will:
1. Check if the unit is already in a group, (We'll call it 'soaked')
2. If not, add the unit to group, soaked

Then have a function like isUnitSubmerged(whichUnit)
The function will check if the unit is in the group soaked and return a boolean.

Then, every.. 1 second? have a function that loops through each unit in the group 'soaked'.
For each unit, get all units around that unit and see if any of the units are of type 'wter' if there aren't any, remove the selected unit from 'soaked'

Or something like that..
I don't use SC2, I just happened to be passing by =x

Instead of the loop, it would be more efficient to use the "leaves range of.." function. It's the same GUI option as "enters range of..", just a different selection. And you don't need to use units/doodads - there's a function for points, and a very easy point placer.

Frozenwind - Nah, not so much. All you need to do is figure out the width of your river, divide it by two, and set the trigger to fire when unit comes within range x of point x, then place points at intervals along the river.
 
Instead of the loop, it would be more efficient to use the "leaves range of.." function. It's the same GUI option as "enters range of..", just a different selection. And you don't need to use units/doodads - there's a function for points, and a very easy point placer.

Frozenwind - Nah, not so much. All you need to do is figure out the width of your river, divide it by two, and set the trigger to fire when unit comes within range x of point x, then place points at intervals along the river.
Yes, but that's a lot of preplace work (and furthermore a lot of preset work in the enter/leave event), which I always try to prevent.
 
Yeah that is a bit of a pain, but it would definitely work. I've created a third person shooter library for people to use (it's quite impressive actually, if I do say so myself) and I have different actors that display depending on where bullets land. It came to my attention that hitting water still stirred up dust or sparks, when it should really produce ripples or splashes.

The only problem I forsee with this preplaced object theory is that you won't be able to tell whether the bullets landed 'in' the water or on the raised land around it, which hides some of the water boxes from view.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top