Total waste, you could do this:
local real x2 = GetLocationX(GetSpellTargetLoc())
local real y2 = GetLocationY(GetSpellTargetLoc())
With this you don't have to declare another variable and handle the location.
I'm not sure it'll work I think you need to check if the ability level is 0.
If you check if the ability level is 1, then it means the hero learns it the second time, not the first time.
Change your condition function to:
private function Conditions takes nothing returns boolean
return (GetLearnedSkill() == 'A036' and GetUnitAbilityLevel(GetTriggerUnit(), 'A036') == 0)
endfunction
Meh sorry I'm just with NewGen closed.
Well PUI will be the answer of course.
I'm not sure but I think there is a none-vJass version of PUI.
Anyway, PUI is a system that assigns a unit with a unique id.
So you make a unit array and assigns unit to the array member of the unit you want to attach to.