[Solved] Store height in custom script

Status
Not open for further replies.
Level 3
Joined
Sep 26, 2012
Messages
39
How would I store (ground's height at a position of a unit + Flying height of unit) in a real variable?

I'm trying to attach a lightning effect to a flying unit but since my map terrain has been raised by alot, it seems like using GetUnitFlyHeight will set the lightning's height to the height between the ground and the flying unit but starting from the very bottom of the map. Idk if that makes any sense, if not I'll try to explain better
 
JASS:
    //in case the unit is local:
    local unit theunit = someunit //that is no real function or expression
    local location l = Location(GetUnitX(theunit), GetUnitY(theunit))
    local real r = GetLocationZ(l) + GetUnitFlyHeight(theunit)
    //perform shit here or just replace the local real r with some global
    call RemoveLocation(l)
    /*
        calling RemoveLocation is necessery no matter if the location is local or not
        to prevent leaks
    */
    set l = null
    set u = null
    /*
        nulling is only required if the variable is local
    */
 
Status
Not open for further replies.
Back
Top