JASS:
function Buster_Dive_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A01E039;
endfunction
function GB_Destroy_Trees takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endfunction
function Buster_Knockback takes nothing returns nothing
local timer t2 = GetExpiredTimer()
local unit v = GetHandleUnit(t2, "targ")
local location l = GetHandleLocation(t2,"l")
local real dist = GetHandleReal(t2,"dist")
local real angle = GetHandleReal(t2,"angle")
local location m = Location(GetUnitX(v)+dist*CosBJ(angle),GetUnitY(v)+dist*SinBJ(angle))
if DistanceBetweenPoints(m,l) < 400 and dist > 0.5 then
call SetUnitPositionLoc( v, m )
call SetHandleReal(t2,"dist", dist*.98)
call DestroyEffect(AddSpellEffectByIdLoc(039;A01E039;, EFFECT_TYPE_SPECIAL, m))
call EnumDestructablesInCircleBJ(150.,m,function GB_Destroy_Trees)
else
call FlushHandleLocals(t2)
call PauseTimer(t2)
call DestroyTimer(t2)
endif
set t2 = null
call RemoveLocation(m)
set m = null
endfunction
function Buster_Move takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer t2 = CreateTimer()
local unit c = GetHandleUnit(t,"c")
local unit u = GetHandleUnit(t,"u")
local unit v = GetHandleUnit(t,"v")
local location l = GetHandleLocation(t,"l")
local real r = GetHandleReal(t,"r")
local real s = AngleBetweenPoints(GetUnitLoc(c) ,l)
local location n = PolarProjectionBJ(GetUnitLoc(c) ,r/40,s)
if DistanceBetweenPoints(n,l) > 100 then
call SetUnitPositionLoc(c,n)
call EnumDestructablesInCircleBJ(150. ,n , function GB_Destroy_Trees)
else
call SetUnitPositionLoc(u, GetUnitLoc(c))
call KillUnit(c)
call SetHandleHandle(t2, "targ", v)
call SetHandleHandle(t2,"l", GetUnitLoc(u))
call SetHandleReal(t2,"dist", 8)
call SetHandleReal(t2,"angle",s)
call TimerStart(t2, .01, true, function Buster_Knockback)
call ShowUnitShow(u)
call UnitDamageTargetBJ( u, v, (GetUnitAbilityLevel(u, 039;A01E039;)+ 1)* 100, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL )
call IssueImmediateOrder(v, "stop")
call ClearSelectionForPlayer(GetOwningPlayer(u))
call SelectUnitAddForPlayer(u, GetOwningPlayer(u))
call PauseTimer(t)
call TriggerSleepAction(.01)
call DestroyTimer(t)
endif
call RemoveLocation(n)
set n = null
set c = null
set t = null
endfunction
function Buster_Dive_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit v = GetSpellTargetUnit()
local location l = GetUnitLoc(v)
local real r = DistanceBetweenPoints(l, GetUnitLoc(u))
local real cost = (GetUnitAbilityLevel(u, 039;A01E039;)+ 1)*50
local timer t = CreateTimer()
local unit n
if r > 250 then
set n = CreateUnit( GetOwningPlayer(u), 039;u006039;, GetLocationX(GetUnitLoc(u)), GetLocationY(GetUnitLoc(u)), AngleBetweenPoints(GetUnitLoc(u),l) )
call ShowUnitHide(u)
call SetHandleHandle(t,"c",n)
call SetHandleHandle(t,"u",u)
call SetHandleHandle(t,"v",v)
call SetHandleHandle(t,"l",l)
call SetHandleReal(t,"r",r)
call TimerStart(t, .005, true, function Buster_Move)
call TriggerSleepAction(2)
else
call IssueImmediateOrder(u, "stop")
call QuestMessageBJ( GetForceOfPlayer(GetOwningPlayer(u)), bj_QUESTMESSAGE_ALWAYSHINT, "TRIGSTR_355" )
call TriggerSleepAction(.1)
call SetUnitState(u, UNIT_STATE_MANA, GetUnitState(u, UNIT_STATE_MANA) + cost)
endif
call RemoveLocation(l)
set l = null
set u = null
set t = null
endfunction
//===========================================================================
function InitTrig_Buster_Dive takes nothing returns nothing
set gg_trg_Buster_Dive = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Buster_Dive, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Buster_Dive, Condition( function Buster_Dive_Conditions ) )
call TriggerAddAction( gg_trg_Buster_Dive, function Buster_Dive_Actions )
endfunction
Can someone help me convert my spell to vJass?
JASS:
function Firebolts_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A005039;
endfunction
function Firebolts_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local unit t = GetSpellTargetUnit()
local unit n
local integer i = 1
local player p = GetOwningPlayer(c)
local location l = GetUnitLoc(c)
call SetUnitAnimationWithRarity( c, "attack", RARITY_RARE )
loop
exitwhen i > 4
set n = CreateUnit( p, 039;n000039;, GetLocationX(l), GetLocationY(l), bj_UNIT_FACING )
call UnitAddAbility( n, 039;A006039; )
call SetUnitAbilityLevelSwapped( 039;A006039;, n, GetUnitAbilityLevelSwapped(039;A005039;, c) )
call IssueTargetOrder( n, "thunderbolt", t )
call UnitApplyTimedLife( n, 039;BTLF039;, 1.00 )
set i = i + 1
call TriggerSleepAction( 0.25 )
endloop
call ResetUnitAnimation(c)
call RemoveLocation(l)
set l = null
set p = null
set n = null
set t = null
endfunction
//===========================================================================
function InitTrig_Firebolts takes nothing returns nothing
set gg_trg_Firebolts = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Firebolts, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Firebolts, Condition( function Firebolts_Conditions ) )
call TriggerAddAction( gg_trg_Firebolts, function Firebolts_Actions )
endfunction
And this too, i try to use timer but dunno why it leaks =.=