library GetZ /* v1.0.0.0
*******************************************************************
*
* This script will provide an interface to retrieve Z-values
* of points and units without requiring you to deal with
* locations.
*
*******************************************************************
*
* function GetPointZ takes real x, real y returns real
*
* - Returns the Z-value of a particular point on the terrain.
*
* function GetUnitZ takes unit u returns real
*
* - Returns the Z-value of a unit.
* - This will take both terrain height and fly height into
* account.
*
*******************************************************************/
globals
private location loc = Location(0, 0)
endglobals
function GetPointZ takes real x, real y returns real
call MoveLocation(loc, x, y)
return GetLocationZ(loc)
endfunction
function GetUnitZ takes unit u returns real
call MoveLocation(loc, GetUnitX(u), GetUnitY(u))
return GetLocationZ(loc) + GetUnitFlyHeight(u)
endfunction
endlibrary