• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

GetUnitLoc

Status
Not open for further replies.
You can alternatively use this:
http://wc3jass.com/4981/snippet-getz/msg38689/topicseen/#new

JASS:
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

@mckill: You have to account for the unit's flying height as well as the location z.
 
Status
Not open for further replies.
Top