exge
New Member
- Reaction score
- 15
im sure im doing this wrongly... especially the loop and the speed .. pls help thx
PHP:
function Trig_dash_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A001'
endfunction
function Dash_Move takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit caster = GetHandleUnit(t, "caster")
local location casterloc = GetHandleLocation(t, "casterloc")
local location targetloc = GetHandleLocation(t, "targetloc")
local location tryloc = GetHandleLocation(t, "tryloc")
local real speed = 70
set casterloc = GetUnitLoc(caster)
set tryloc = casterloc
set tryloc = PolarProjectionBJ(tryloc, speed, AngleBetweenPoints(tryloc, targetloc))
call SetUnitPositionLoc(caster, tryloc)
endfunction
function Trig_dash_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit caster = GetSpellAbilityUnit()
local location casterloc = GetUnitLoc(caster)
local location targetloc = GetSpellTargetLoc()
local location tryloc = casterloc
call SetHandleHandle(t, "caster" , caster)
call SetHandleHandle(t, "casterloc", casterloc)
call SetHandleHandle(t, "targetloc", targetloc)
call SetHandleHandle(t, "tryloc", tryloc)
call SetUnitInvulnerable(caster, true)
call SetUnitPathing(caster, false )
call SetUnitAnimationByIndex(caster, 3 )
call SetUnitVertexColorBJ(caster, 0.00, 0.00, 0.00, 0 )
call TimerStart(t, 0.03, true, function Dash_Move)
loop
call PolledWait(0.001)
set casterloc = GetUnitLoc(caster)
exitwhen DistanceBetweenPoints(casterloc, targetloc) <= 200
endloop
call SetUnitInvulnerable( caster, false )
call SetUnitPathing( caster, true )
call ResetUnitAnimation( caster )
call SetUnitVertexColorBJ(caster, 100.00, 100.00, 100.00, 0 )
call DestroyTimer(t)
call FlushHandleLocals(t)
call RemoveLocation(casterloc)
call RemoveLocation(targetloc)
call RemoveLocation(tryloc)
set caster = null
endfunction
//===========================================================================
function InitTrig_dash takes nothing returns nothing
set gg_trg_dash = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_dash, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_dash, Condition( function Trig_dash_Conditions ) )
call TriggerAddAction( gg_trg_dash, function Trig_dash_Actions )
endfunction