I only thought you wanted to know what the GetLocationZ
function returned, judging by the title of the thread. However, in the scenario you created it would also become a problem if unit was at the bottom of the hill and the camera source was on the hill somewhere.
I worked with cameras a little bit quite some time ago, my memory on how they work is a little faint.
Taking a quick look at the API for WarCraft III cameras it seems there is a function GetCameraEyePositionX
along with similar functions for Y and Z values. The problem is there are no functions that control the camera-eye-position. In other words, there are no SetCameraEyePosition
functions. Though I haven't given it much thought, you could probably simulate a function like this using camera fields and other camera utilities.