constant function Abil_id takes nothing returns integer
return 'A000' //change this to your Ability id
endfunction
function BlinkStrike_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Abil_id()
endfunction
function BlinkStrike_Action takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local real x
local real y
local real cx = GetUnitX(c)
local real cy = GetUnitY(c)
local real angle = GetRandomReal(1,360)
local real facing = GetUnitFacing(c)
local real dmg
local integer lvl = GetUnitAbilityLevel(c,Abil_id())
set dmg = 30*I2R(lvl)
set x = (GetUnitX(t) - 75 * Cos(angle * bj_DEGTORAD))
set y = (GetUnitY(t) - 75 * Sin(angle * bj_DEGTORAD))
call PauseUnit(c,true)
call SetUnitInvulnerable(c, true)
call SetUnitVertexColor(c, 50,50,50,50)
call SetUnitX(c,x)
call SetUnitY(c,y)
call SetUnitFacingTimed(c, angle, 0.)
call SetUnitTimeScalePercent(c,250.)
call SetUnitAnimation(c, "attack slam")
call UnitDamageTarget(c,t,dmg,true,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl",x,y))
call PolledWait(.3)
call SetUnitX(c,cx)
call SetUnitY(c,cy)
call SetUnitTimeScalePercent(c,0.)
call SetUnitFacingTimed(c, facing, 100.)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl",cx,cy))
call SetUnitAnimation(c, "stand")
call SetUnitVertexColor(c, 255,255,255,255)
call SetUnitInvulnerable(c,false)
call PauseUnit(c,false)
set c = null
set t = null
endfunction
function InitTrig_BlinkStrike takes nothing returns nothing
local trigger trig = CreateTrigger()
local integer index = 0
loop
call TriggerRegisterPlayerUnitEvent(trig, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set index = index + 1
exitwhen index == 16
endloop
set index = 0
call TriggerAddAction( trig, function BlinkStrike_Action)
call TriggerAddCondition( trig, Filter(function BlinkStrike_Conditions) )
endfunction