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

Terrain Z values.

Status
Not open for further replies.

EdgeOfChaos

E

EdgeOfChaos

Okay, I am trying to make a map where water height matters. I use GetLocationZ to check the water depth of a unit, however there's a problem.

It seems shallow water and deep water have the same Z value, which is about -76.800 Z. Is there any way to differentiate them? How can I get the water depth at a certain point?
 

EdgeOfChaos

E

EdgeOfChaos

Hm, does anyone know what the system is called? I can't find it by searching water, water level, water depth, depth, etc.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
This combination should give you shallow water.

  • Conditions
    • (Terrain pathing at POINT of type Walkability is off) Equal to False
    • (Terrain pathing at POINT of type Floatability is off) Equal to False
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
He does not want to tell if a point is shallow or deep. He wants to tell the height difference between the water mesh and ground mesh, aka how deep the water is.

As far as I am aware this is not possible in WC3 as GetLocationZ will only return one of them (and even then it is prone to non-deterministic results).

A massive data driven trigger system could be used which uses a tree structure to get the height on nearby nodes and computes it all. The data can be fed from the w3e file directly as part of the map generation process. However this is impractical for large maps as the trigger script alone will probably be several MB.
 

EdgeOfChaos

E

EdgeOfChaos

Then, if that is impossible, can anyone help me with an alternative to this idea?

I needed water depth checker for a new maze I was going to make. The idea was, it would be a maze with water as the kill tile, but instead of killing you right away it deals damage and slows. This would make the maze far more forgiving for new players as you can correct mistakes and don't instantly die for a misclick.

There would also be areas of shallow water you must pass through with patrolling enemies on them, encouraging you go to as quickly as you can to avoid taking damage.

However, I needed different levels of damage. The deeper in the water you are, the more damage you take and the slower you get. Or else, it wouldn't make sense to have the water paths deal the same damage as the areas you are not supposed to pass through which are traps.

Is there any way to do this without using water depth?

(edit)
I was also planning on having terrain that sinks down the longer you stand on top of it, revealing water eventually. This wouldn't work nicely with just using Shallow and Deep.

Plus, having inbetween values would look so much nicer.

(edit2)
If there's no other way, how do I do what you suggested Dr. Super Good? It'll be a relatively small map.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
You could use regions. When a unit enters the region you damage it based on the type of region until he leaves the region. Since regions are a collection of cells they can be any shape and size as far as I know so a single region for a certain damage gradient would suffice.

Shallow water -> low damage.
Deep water -> some damage.
Very deep water (the guy has got lost in water) -> near instant death damage.

3 regions, 3 damage types. Kind of like a contour map in some ways.

Depending on maze shape it may be best to elaborate the paths and assume all other cells are of a certain type and then generate the intermediates based on rules.
 

EdgeOfChaos

E

EdgeOfChaos

I'm new to using regions like that; how can you make a region in any shape? Aren't they only squares?

And, how would I make one region for all of one type of damage? That idea sounds really cool, I just don't really know how to implement it.

@Ceday, because using 2 levels only limits what I can do, and kind of messes up the idea. I'm assuming with Dr. Super Good's idea I could make multiple different types of water depths, and it would behave like I want it to.
 
Last edited by a moderator:

EdgeOfChaos

E

EdgeOfChaos

I really have no idea how to do that :(
Could someone please make an example?
 
There's only two levels of water, I don't get what your trying to get or go for. If I had some explanation I would try to find a way, but I need more info.

Ceday's way does exactly what you want from what I have read because there is no such thing as higher or lower water because it is only shallow and deep and after that it either goes to fatal/too low or it turns into land.

There is one more way if your interested and that is dummy units combined with regions. That enables exactly what you want.

It is painful finding regions/rects in water as well.
 

EdgeOfChaos

E

EdgeOfChaos

There are way more water levels than deep and shallow.

Go into world editor, disable Enforce Water Height Limit, and place a square of Deep Water. Then use the Increase 2 tool to get it back to normal height. Then use the Lower tool x 2 or 3 on the section you just made.

You will eventually see water if you lower it enough. It will be shallow water, but very shallow water. Then, lower it even further by 1 or 2 clicks. It will still be shallow water, but deeper than your old water. If you continue to lower it, you will eventually get deep water. However, there is a huge range of water levels in between the first Shallow section and the Shallow section before Deep Water.

I would like to be able to tell the difference between the first time you reveal shallow water and the step directly before you reveal deep water. Why? Well, it would make the game run a lot smoother with the form of ice I am planning on making.

I guess if there truly is no solution, I would do it with only 2 water levels, but I would really not want to.

GetLocationZ does not work, as it always returns -76.800 if there is any water showing.
 

EdgeOfChaos

E

EdgeOfChaos

I am using the Raise/Lower tool. I want more than 2 varieties of terrain to adjust difficulty for certain stages also.
 

EdgeOfChaos

E

EdgeOfChaos

Interesting. How'd you calculate that?

Also: Are there possibly any differences between each of those levels of water that could be found through triggering? Similar to the differences between Shallow and deep that might be used to make it?

Is there any function or ability at all that uses water height in any way (besides shallow/deep)? If so I might be able to do something with it.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Interesting. How'd you calculate that?
Each node allocates 14 bits for terrain and water height (each mesh is given 14 bits for node height in the w3e file). Obviously if you interpolate between nodes you have an infinite number of heights but as far as editing goes you can only modify the height of nodes even if it is to obtain a specific interpolated height.

Also: Are there possibly any differences between each of those levels of water that could be found through triggering?
I do not think so. As far as I know you can only read in the height of the terrain mesh at a point and even that was reported to have significant error.

Similar to the differences between Shallow and deep that might be used to make it?
This has nothing to do with water mesh height. Shallow and deep is determined by the pathing map (wpm file). You can have a mountain known as deep water or a desert plain known as shallow water as long as you set the pathing so. Again a nice feature of WC3 that World Edit hides from the user.

Is there any function or ability at all that uses water height in any way (besides shallow/deep)? If so I might be able to do something with it.
Unfortunately not. But the water mesh is used to determine selection circles so that visually you can detach selection circles from the terrain and have them do strange things like appear to go over a spike on a plain (not deterministic, not available in triggers).
 

EdgeOfChaos

E

EdgeOfChaos

Is it possible to edit the .wpm file and make different water states other than shallow/deep?

Also, is it possible to make a boat dummy unit in the water area, then check its height to obtain water height? Or will that just return 0 or -76.800 also?

I removed selection circles on all my units so it's harder to click other people's units while moving through the maze.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Is it possible to edit the .wpm file and make different water states other than shallow/deep?
Yes you can make them any sort of valid pathing such as no fly, unbuildable, boundary etc. Basically any valid WC3 pathing type.

Also, is it possible to make a boat dummy unit in the water area, then check its height to obtain water height? Or will that just return 0 or -76.800 also?
Boats are not flying, the game just places them at a height determined from the water mesh instead of terrain mesh. Since it is impossible to read in the height a unit is placed at (only the height you want the unit to fly at) a dummy will not help.
 
Status
Not open for further replies.
Top