[li]globals
[/li][li]hashtable HT = null
[/li][li]endglobals
[/li][li]
[/li][li]function Init takes nothing returns nothing
[/li][li]call FlushParentHashtable( HT )
[/li][li]set HT = InitHashtable()
[/li][li]endfunction
[/li][li]
[/li][li]function TimeDamage_Act takes nothing returns nothing
[/li][li]local integer parentKey = GetHandleId( GetExpiredTimer() )
[/li][li]local unit source = LoadUnitHandle( HT, parentKey, 1 )
[/li][li]local unit target = LoadUnitHandle( HT, parentKey, 2 )
[/li][li]local real damage = LoadReal( HT, parentKey, 3 )
[/li][li]call UnitDamageTargetBJ( source, target, damage, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE )
[/li][li]call FlushChildHashtable( HT, parentKey )
[/li][li]call DestroyTimer( GetExpiredTimer() )
[/li][li]set source = null
[/li][li]set target = null
[/li][li]endfunction
[/li][li]
[/li][li]function TimeDamage takes unit source, unit target, real time, real damage returns nothing
[/li][li]local timer t = CreateTimer()
[/li][li]local integer parentKey = GetHandleId( t )
[/li][li]call SaveUnitHandle( HT, parentKey, 1, source )
[/li][li]call SaveUnitHandle( HT, parentKey, 2, target )
[/li][li]call SaveReal( HT, parentKey, 3, damage )
[/li][li]call TimerStart( t, time, false, function TimeDamage_Act )
[/li][li]set t = null
[/li][li]endfunction [/li][li]其实这里计时器应该用全局变量,否则GetExpiredTimer()报废,但是我们要讨论的是,这里居然没有使用触发,这些函数能够执行么??[/li] |