|
之前的问题解决了,求大爷们帮忙排个泄。
感激不尽!
[jass]function Trig_zlns_TimerFunc takes nothing returns nothing
local real angle
local location p2
local unit target = LoadUnitHandle( GetLastCreatedHashtableBJ(), GetHandleId(GetExpiredTimer()), StringHash("target") )
local location p = LoadLocationHandle( GetLastCreatedHashtableBJ(), GetHandleId(GetExpiredTimer()), StringHash("point") )
local integer n = LoadInteger( GetLastCreatedHashtableBJ(), GetHandleId(GetExpiredTimer()), StringHash("n") )
if n < 20 then
set n = n+1
call SaveInteger( GetLastCreatedHashtableBJ(), GetHandleId(GetExpiredTimer()), StringHash("n"),n )
set p2 = GetUnitLoc(target)
if ( DistanceBetweenPoints(p2, p) > 300.00 ) then
set angle = AngleBetweenPoints(p, p2)
call SetUnitX( target,( GetLocationX(p)+( 300 * CosBJ(angle) ) ) )
call SetUnitY( target,( GetLocationY(p)+( 300 * SinBJ(angle) ) ) )
set target = null
call RemoveLocation(p2)
endif
else
set target = null
call RemoveLocation(p)
call RemoveLocation(p2)
call FlushChildHashtable( GetLastCreatedHashtableBJ(), GetHandleId(GetExpiredTimer()) )
call DestroyTimer(GetExpiredTimer())
endif
endfunction
function Trig_zlns_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A002' ) ) then
return false
endif
return true
endfunction
function Trig_zlns_Actions takes nothing returns nothing
local integer n = 0
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local location p = GetUnitLoc(target)
set bj_lastStartedTimer = CreateTimer()
//call SaveUnitHandleBJ( caster, GetHandleIdBJ(caster), GetHandleIdBJ(bj_lastStartedTimer), GetLastCreatedHashtableBJ() )
call SaveUnitHandle( GetLastCreatedHashtableBJ(), GetHandleId(bj_lastStartedTimer), StringHash("target"), target )
call SaveLocationHandle( GetLastCreatedHashtableBJ(), GetHandleId(bj_lastStartedTimer), StringHash("point"), p )
call SaveInteger( GetLastCreatedHashtableBJ(), GetHandleId(bj_lastStartedTimer), StringHash("n"),n )
call TimerStart(bj_lastStartedTimer,0.2,true, function Trig_zlns_TimerFunc)
endfunction
//===========================================================================
function InitTrig_zlns takes nothing returns nothing
set gg_trg_zlns = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_zlns, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_zlns, Condition( function Trig_zlns_Conditions ) )
call TriggerAddAction( gg_trg_zlns, function Trig_zlns_Actions )
endfunction[/jass] |
|