I've got a spell where myb unit blinks to the target and hit it 10 times with 50 dmg and blinks back. But I can't let him appear behind the target and not in the target, this is my trigger now, I know it leaks, I di'n't remove the leaks yet
JASS:
function Trig_Test_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A002' ) ) then
return false
endif
return true
endfunction
function actions takes nothing returns nothing
local unit trig = GetTriggerUnit()
local location trigplace = GetUnitLoc(trig)
local unit targ = GetSpellTargetUnit()
local real count = 0
local location x = GetUnitLoc(targ)
local real face = GetUnitFacing(targ)-180
call SetUnitTimeScalePercent( trig, 300 )
loop
exitwhen count == 10
set count = count+1
call UnitDamageTarget(trig, targ, 10, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null)
call SetUnitPositionLoc(trig, x)
call SetUnitAnimation( trig, "attack" )
call TriggerSleepAction(0.10)
endloop
call SetUnitPositionLoc(trig, trigplace)
endfunction
//===========================================================================
function InitTrig_Test takes nothing returns nothing
set gg_trg_Test = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Test, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Test, Condition( function Trig_Test_Conditions ) )
call TriggerAddAction( gg_trg_Test, function actions )
endfunction