|
发表于 2009-5-24 13:50:47
|
显示全部楼层
幻影跟随
[jass]
//***************************************************************************
//* Shadows Follow Unit *
//* Edit by feelerly,Provide by 暗月之舞 *
//* 2008.01.28 *
//***************************************************************************
// 开启之个功能,当单位移动时,可以创建幻影跟随单位,这个功能需要支撑函数.
function StopTimerShadowForUnit takes timer t returns nothing
call Debug( "StopShadowRun" )
call FlushHandleValue( t )
call DestroyTimer( t )
endfunction
function TimerShadowForUnitActions takes nothing returns nothing
local integer a = 0
local unit u = GetHandleUnit( GetExpiredTimer(), "Unit")
local unit n = null
if IsUnitMoved(u)==true then
set n = CreateUnit( GetOwningPlayer(u),GetHandleInteger( GetExpiredTimer(), "Unit" ),GetHandleReal( u, "UnitX" ),GetHandleReal( u, "UnitY" ),GetUnitFacing(u))
call ShodowTransparency( n, 160 )
call SetUnitPathing( n, false )
call PauseUnit( n, true )
call SetUnitAnimationByIndex( n, GetHandleInteger( GetExpiredTimer(), "Index" ) )
call SetUnitTimeScale( n, 0.618 )
call UnitApplyTimedLife( n, 'BHwe', 5.00 )
call SetUnitX( n, GetHandleReal( u, "UnitX" ) )
call SetUnitY( n, GetHandleReal( u, "UnitY" ) )
if GetUnitFlyHeight(u) != 0.00 then
call UnitAddAbility(n, 'Arav' )
call UnitRemoveAbility( n, 'Arav' )
call SetUnitFlyHeight( n, GetUnitFlyHeight(u), 0.00 )
endif
call RecoredUnitPosition( u )
set n = null
endif
if GetUnitState(u,UNIT_STATE_LIFE) == 0.00 or GetHandleReal( GetExpiredTimer(), "Limit" ) >= GetHandleReal( GetExpiredTimer(), "Real" ) then
call StopTimerShadowForUnit( GetExpiredTimer() )
else
call SetHandleReal( GetExpiredTimer(), "Limit", GetHandleReal( GetExpiredTimer(), "Limit" )+TimerGetTimeout(GetExpiredTimer()) )
endif
set u = null
set n = null
endfunction
function TimerShadowForUnit takes integer c,integer id, integer an, unit u, real ti, real lt returns nothing
local timer t = null
if GetUnitState(u,UNIT_STATE_LIFE) > 0.00 and id != 0 and ti > 0.01 and lt >= ti then
call RecoredUnitPosition( u )
set t = CreateTimer()
call SetHandleInteger( t, "Unit", id )
call SetHandleHandle( t, "Unit", u )
call SetHandleInteger( t, "Index", an )
call SetHandleReal( t, "Real", lt )
call SetHandleHandle( u, "ShadowTimer", t )
call TimerStart( t, ti, true, function TimerShadowForUnitActions )
set bj_lastStartedTimer = t
else
call Debug("Hero is fialed!")
call StopTimerShadowForUnit( t )
endif
set t = null
endfunction[/jass]
这段代码需要用ReturnBUG+GCSystem的支持 |
|