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

Get unit elevation

Status
Not open for further replies.

EdgeOfChaos

E

EdgeOfChaos

So I'm not sure if this is possible, but I need to do this (or a suitable workaround)

I want to detect the Z value of a unit. I don't mean the Z value of the point the unit is standing on, but the value of the unit itself. These two are not necessarily the same value for flying units with zero fly-height.

My intent is to make a falling system where the character can fall off a cliff but not climb back up. I need to detect the difference between the character's Z value and the ground's Z value to see if it needs to fall, or to see if it should be prevented from climbing. Any way to do this?
 
There is the native

native GetTerrainCliffLevel takes real x, real y returns integer

which returns the cliff level of x/y coordinates, I guess it would do it. But just in example, if a there is a cliff, and then a flat area ( lower cliff level). And in the flat area there is s strongly raised terrain height, then then actual "Z" coordinate might still be highter on the lower based cliff level terrain than on the higher cliff itself. - If you also need to encounter these scenarios, then

native GetLocationZ takes location whichLocation returns real

should still bring the correct Z value of current terrain. No unit height is involved here, but plain terrain height, taking cliff level and raised terrain into account.
 
Status
Not open for further replies.
Top