|
- globals
- hashtable tf_hash = InitHashtable()
- endglobals
- library txxx initializer initsb
- function timerzhouqi takes nothing returns nothing //计时器循环
- local integer i = GetHandleId(GetExpiredTimer()) //获取到期计时器的整数地址
- local unit a = LoadUnit(tf_hash, i, 1) //从1号位置读取单位a
- local unit b = LoadUnit(tf_hash, i, 2) //从2号位置读取单位b
- local real j = LoadReal(tf_hash, i, 3) // 读取3号位置的j, 一开始是0
- local location loc_c = GetUnitLoc(a)
- local location loc_b = GetUnitLoc(b)
- local location loc_a = PolarProjectionBJ(loc_c, 30, AngleBetweenPoints(b, a))
- call SaveReal(tf_hash, i, 3, j+0.05)
- if j <= 1 then
- call SetUnitPositionLoc( a,loc_a )
- else
- call DestroyTimer(GetExpiredTimer())
- call FlushChildHashtable(tf_hash, i)
- endif
- call RemoveLocation(loc_a)
- call RemoveLocation(loc_c)
- call RemoveLocation(loc_b)
- set a = null
- set b = null
- endfunction
- function tf takes unit a,unit b returns nothing //动作函数
- local timer t = CreateTimer()
- local integer i = GetHandleId(t) //获取t的整数地址
- call SaveUnitHandle(tf_hash, i, 1, a) //把a储存在1号位置
- call SaveUnitHandle(tf_hash, i, 2, b) //把b储存在2号位置
- call TimerStart( t ,0.05,true,function timerzhouqi)
- set a = null
- set b = null
- endfunction
- function tx takes nothing returns nothing //动作函数
- local unit a = GetTriggerUnit()
- local location b = GetUnitLoc(a)
- call DestroyEffect( AddSpecialEffectLoc("Objects\\Spawnmodels\\Undead\\UndeadLargeDeathExplode\\UndeadLargeDeathExplode.mdl", b) )
- call RemoveLocation(b)
- call tf(GetTriggerUnit(),GetKillingUnit())
- set a = null
- endfunction
- function tx2 takes nothing returns boolean
- if ( not ( IsUnitAlly(GetTriggerUnit(), Player(11)) == true ) ) then
- return false
- endif
- return true
- endfunction
- function initsb takes nothing returns nothing
- local trigger t = CreateTrigger()
- call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_DEATH)
- call TriggerAddCondition( t, Condition( function tx2 ) )
- call TriggerAddAction( t, function tx )
- endfunction
- endlibrary
复制代码 |
|