• 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.

[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
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
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.
Top