- Reaction score
Like this?Your entire Actions should be inside the Condition function, because Conditions are quicker.
private function Actions takes nothing returns boolean local unit u = GetTriggerUnit() local real x = GetUnitX(u) local real y = GetUnitY(u) local real m = GetUnitMoveSpeed(u) local player p = GetOwningPlayer(u) local data d = data.create(u, x, y, m) if GetSpellAbilityId() != SPELL_ID then return false endif call SetPlayerAbilityAvailable(p, BOOK_ID, false) //Remove icons from hero UI call SetTimerData(d.t, d) call TimerStart(d.t, INTERVAL, true, function NearTree) set p = null set u = null return false endfunction //====================================================== private function init takes nothing returns nothing local trigger t = CreateTrigger() local unit u call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition(t, Condition(function Actions)) call TriggerAddAction(t, function Actions) set u = CreateUnit(Player(15), 'Hpal', 0., 0., 0.) //Preload ability call UnitAddAbility(u, BOOK_ID) call SetUnitAbilityLevel(u, MOVE_ID, MOVE_BASE) call SetUnitAbilityLevel(u, EVADE_ID, EVADE_BASE+1) call UnitRemoveAbility(u, MOVE_ID) call UnitRemoveAbility(u, BOOK_ID) call RemoveUnit(u) set u = null set t = null endfunction endscope
Done.You can just override destroy nowadays.
Done. What do you mean by "instance" variables? Like the variables that are used throughout the spell? Like d.caster, d.timer, d.blahblah?You don't have to null instance variables (variables in structs)
I actually thought about including invisibility as an option, the same way I included an option for the caster to remain stationary or not. But after several hours already trying to finish it up, I don't feel like doing it at the moment. Besides, it would require one more Object Editor data, and there are already 5. I might include it as a later update though. Thoughts?Oh, my bad, I thought this was supposed to add invisibility.
What? I must be blind. I don't see a level 26 anywhere...The "Learn" tooltip displays Level 26.