tommerbob
Minecraft. :D
- Reaction score
- 110
Your entire Actions should be inside the Condition function, because Conditions are quicker.
Like this?
JASS:
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), 039;Hpal039;, 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
You can just override destroy nowadays.
Done.
You don't have to null instance variables (variables in structs)
Done. What do you mean by "instance" variables? Like the variables that are used throughout the spell? Like d.caster, d.timer, d.blahblah?
Oh, my bad, I thought this was supposed to add invisibility.
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?
The "Learn" tooltip displays Level 26.
What? I must be blind. I don't see a level 26 anywhere...