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

[JASS] How to do this...

Status
Not open for further replies.
Level 11
Joined
Apr 6, 2008
Messages
760
JASS:
local location loc = //your Location
local timer Timer

call SetHandleHandle(Timer,"loc",loc)

in a diffrent function

JASS:
local timer Timer = GetExperiedTimer()
local location loc = GetHandleHandle(Timer,"loc")

but best would be be use reals like

JASS:
local location loc = GetSpellTargetLoc() //for e.g
local real x = GetLocationX(loc)
local real y = GetLocationY(loc)

call SetHandleReal(Timer,"x",x)
call SetHandleReal(Timer,"y",y)
 
Last edited:
Level 11
Joined
Feb 18, 2004
Messages
394
You should not use locations, especially for passing around using handle vars. (You shouldn't be using handle vars in the first place, but I'm way too lazy to explain the alternative(s)) There are only two functions that do not have equivilent functions for x and y coordinates: GetSpellTargetLoc() and GetLocationZ(). (In the first case, just use GetLocationX/Y(), in the latter case, use a single global location and MoveLocation().)

In any case, if you feel the urge to ignore my good advice and do things the stupid way, you need to add the following function to your HandleVars library:
JASS:
function GetHandleLocation takes handle subject, string name returns location
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
You can still use SetHandleHandle(), as locations are handles. (However, not all handles are locations, thus why you need a specifically-typed getter function.)
 
Status
Not open for further replies.
Top