|
本帖最后由 Simonade 于 2013-7-21 00:54 编辑
我是启动周期为0.05s的循环计时器,经过夹逼测试,最后确定是单位选取单位这个动作中断并返回了计时器调用的函数。。。测试了半天,蛋总都扛不住啊。。。
function grow takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer T=LoadInteger(h,GetHandleId(t),10)
local unit target
local real ang
set T=T+1
call SaveInteger(h,GetHandleId(t),10,T)
call BJDebugMsg(I2S(T)) //Debug"T"T的计数还是不断增长的,没加范围选取单位的时候T增长到300就中断,结果加了之后永不停止了。。。
call GroupEnumUnitsInRange(g,GetUnitX(dummy),GetUnitY(dummy),500.0+n*100.0,null) //就是被这个函数的调用,跳出了grow函数,天坑啊~~~~~~~~~~~
//call BJDebugMsg(GetUnitName(FirstOfGroup(g)))
call BJDebugMsg("我擦")
if T==300 then
call BJDebugMsg("次奥终结")
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(h,GetHandleId(t))
endif
set t=null
endfunction
function Start takes nothing returns nothing
local location point
local group g
local timer t
if GetSpellAbilityId()!='AUdd' then
return
endif
set point=GetSpellTargetLoc()
set dummy=CreateUnit(GetOwningPlayer(GetTriggerUnit()),'e000',GetLocationX(point),GetLocationY(point),0.0)
set g=CreateGroup()
set t=CreateTimer()
call TimerStart(t,0.05,true,function grow)
call RemoveLocation(point)
set point=null
set t=null
endfunction
//===========================================================================
function InitTrig_blackhole takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddAction(t,function Start)
set t=null
endfunction//==================================================================================== 已 献 个 单 能 谢
//============================================================================================解 上 很 的 以 意
//============================================================================================决 一 简 技 表!
globals
hashtable h=InitHashtable()
endglobals
//========================================================================
function Scale takes integer n returns nothing
local unit dummy=LoadUnitHandle(h,0,0)
call SetUnitScale(dummy,3.0+n*0.0125,3.0+n*0.0125,3.0+n*0.0125)
set dummy=null
endfunction
//=========================================================================
function IsDrop takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(LoadUnitHandle(h,0,0)))==true
endfunction
//=========================================================================
function Grow takes nothing returns nothing
local timer t=GetExpiredTimer()
local location point=LoadLocationHandle(h,GetHandleId(t),0)
local integer T=LoadInteger(h,GetHandleId(t),10)
local integer n=LoadInteger(h,GetHandleId(t),11)
local group g=CreateGroup()
local unit u
local location loc
local real ang
set T=T+1
call SaveInteger(h,GetHandleId(t),10,T) call Scale(n)
call GroupEnumUnitsInRange(g,GetLocationX(point),GetLocationY(point),500.0+(n/50.0)*100.0,Condition(function IsDrop))//Condition(function IsDrop)
loop
set u=FirstOfGroup(g)
exitwhen u==null
set loc=GetUnitLoc(u)
set ang=Atan2(GetLocationY(point)-GetLocationY(loc),GetLocationX(point)-GetLocationX(loc))
call SetUnitX(u,GetLocationX(loc)+10.0*Cos(ang))
call SetUnitY(u,GetLocationY(loc)+10.0*Sin(ang))
call RemoveLocation(loc)
call GroupRemoveUnit(g,u)
set u=null
set loc=null
set n=n+1
endloop
call SaveInteger(h,GetHandleId(t),11,n)
if T==520 then
call PauseTimer(t)
call DestroyTimer(t)
call RemoveLocation(point)
call FlushChildHashtable(h,GetHandleId(t))
call RemoveUnit(LoadUnitHandle(h,0,0))
endif
set t=null
set point=null
set g=null
endfunction
//=======================================================
function Start takes nothing returns nothing
local timer t
local location point
local unit dummy
if GetSpellAbilityId()!='AUdd' then
return
endif
set point=GetSpellTargetLoc()
set dummy=CreateUnit(GetOwningPlayer(GetTriggerUnit()),'e000',GetLocationX(point),GetLocationY(point),0.0)
call SaveUnitHandle(h,0,0,dummy)
set t=CreateTimer()
call SaveLocationHandle(h,GetHandleId(t),0,point)
call TimerStart(t,0.05,true,function Grow)
set t=null
set point=null
set dummy=null
endfunction
//===========================================================================
function InitTrig_blackhole takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddAction(t,function Start)
set t=null
endfunction
|
-
-
太初黑洞无伤害版.w3x
50.21 KB, 下载次数: 7
还没写伤害,只有吸引效果,吸的单位越多作用范围越大。。。可以吸全屏咯!!!
|