library FunctionLibraryZ
globals
private location Loc = Location(0., 0.)
endglobals
function GetTerrainZ takes real x, real y returns real
call MoveLocation(Loc, x, y)
return GetLocationZ(Loc)
endfunction
function GetUnitZ takes unit whichUnit returns real
return GetTerrainZ(GetUnitX(whichUnit), GetUnitY(whichUnit)) + GetUnitFlyHeight(whichUnit)
endfunction
function SetUnitZ takes unit whichUnit, real newZ returns nothing
local real x = GetUnitX(whichUnit)
local real y = GetUnitY(whichUnit)
call SetUnitFlyHeight(whichUnit, newZ - GetTerrainZ(x, y), 0.)
endfunction
endlibrary
set height = GetLocationZ(GetUnitLoc(u))
if height < start_height then
set height = (start_height - height) + Parabola(move_dist,max_dist)
elseif height > start_height then
if start_height + Parabola(move_dist,max_dist) <= height then
set height = 0.00
else
set height = Parabola(move_dist,max_dist) - (height - start_height)
endif
else
set height = Parabola(move_dist,max_dist)
endif