по сути герой кастит магический молот, и должен мувиться в сторону цели, но ничего не выходит!
в каком месте ошибка?
function Trig_spell_1_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'AHtc'
endfunction
function Move takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u1=LoadUnitHandle(udg_Hash, GetHandleId(t),0)
local unit u2=LoadUnitHandle(udg_Hash, GetHandleId(t),1)
local location ul1=LoadLocationHandle(udg_Hash, GetHandleId(t), 2)
local location ul2=LoadLocationHandle(udg_Hash, GetHandleId(t), 3)
local real a
if DistanceBetweenPoints(ul1, ul2) > 100 then
set a = AngleBetweenPoints(ul1, ul2)
call MoveLocation(ul1, GetLocationX(ul1) + 25 * CosBJ(a), GetLocationY(ul1) + 25 * SinBJ(a))
call SetUnitPositionLoc( u1, ul1 )
else
call FlushChildHashtable(udg_Hash, GetHandleId(t))
set u1 = null
set u2 = null
call RemoveLocation(ul1)
call RemoveLocation(ul2)
set ul1 = null
set ul2 = null
set a = 0
call DestroyTimer(t)
set t = null
endif
endfunction
function Trig_spell_1_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u1=GetSpellAbilityUnit()
local unit u2=GetSpellTargetUnit()
local location ul1=GetUnitLoc(u1)
local location ul2=GetUnitLoc(u2)
call SaveUnitHandle(udg_Hash, GetHandleId(t), 0, u1)
call SaveUnitHandle(udg_Hash, GetHandleId(t), 1, u2)
call SaveLocationHandle(udg_Hash, GetHandleId(t), 2, ul1)
call SaveLocationHandle(udg_Hash, GetHandleId(t), 3, ul2)
call TimerStart(t, 0.035, true, function Move)
set t = null
endfunction
//===========================================================================
function InitTrig_spell_1 takes nothing returns nothing
set gg_trg_spell_1 = CreateTrigger( )
set udg_Hash=InitHashtable()
call TriggerRegisterAnyUnitEventBJ( gg_trg_spell_1, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_spell_1, Condition( function Trig_spell_1_Conditions ) )
call TriggerAddAction( gg_trg_spell_1, function Trig_spell_1_Actions )
endfunction