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!
How can I call a local location variable by HandleVars system...? I'm making a timer used spell which I'll refer to that location at the seperate timer used function but don't know how to.
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)
Cannot convert handle to location... What can I do know? I need the location because I'm going to pull nearby units to that location. Would reals help better ?
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.)
I'll use reals as you suggested. But I got a question. Am I able to convert the location to it's reals? Like I'll use GetSpellTargetLoc() and then make it's coordinates X and Y.
I don't understand your question.
GetLocationX() -> Gets the X from a location
GetLocationY() -> Gets the Y from a location
Location(X, Y) -> converts two reals to location
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.