GetLocationZ

Parameters
whichLocation location
comment

Returns the current surface elevation at the (x,y) location.

This includes the terrain (hills or water) and walkable destructables.

note

Destructables spawn in the dead state/animation by default.

If the "dead" animation has a different height than its "alive" animation, then the following code will return the Z position as if the destructable was dead:

x, y = 0, -1024
platform = CreateDestructable(FourCC("DTrx"), x, y, 180, 1, 0)
loc = Location(x, y)
print("IsDead, HP: ", IsDestructableDeadBJ(platform), GetDestructableLife(platform))

print(GetLocationX(loc), GetLocationY(loc), GetLocationZ(loc)) -- "dead" state height

--KillDestructable(platform)
--RemoveDestructable(platform); RemoveLocation(loc)

And if you rerun the last print line in the next tick like after TriggerSleepAction then you will see its expected lower height because it's now in the "alive" animation.

SetDestructableAnimation(platform, "stand") does not work as a workaround.

HD Model: "Stand 1", "Death 1" & SD Model: "Stand", "Death".

note

Reasons for returning different values between players might be terrain-deformations caused by spells/abilities and different graphic settings. Other reasons could be the rendering state of destructables and visibility differences.

note

Returns 0 if whichLocation is null.

async
This function is asynchronous. The values it returns are not guaranteed to be the same for each player. If you attempt to use it in an synchronous manner it may cause a desync.
patch

1.18a

Source
common.j
return type
real
Source code
native GetLocationZ             takes location whichLocation returns real