|
[jass]function h2i takes handle h returns integer
return h
return 0
endfunction
function onditions takes nothing returns boolean
return true
endfunction
function OnUnitAmort takes nothing returns nothing
endfunction
function RegisterUnitAmortEvent takes unit witchUnit returns nothing
local trigger trg = CreateTrigger()
local triggeraction act = TriggerAddAction( trg, function OnUnitAmort )
local triggercondition con = TriggerAddCondition( trg, Condition( function onditions ) )
call TriggerRegisterUnitLifeEvent( trg , witchUnit, LESS_THAN_OR_EQUAL, 50 )
call DisplayTextToPlayer(Player(0),0,0,I2S(h2i(trg)))
call DisplayTextToPlayer(Player(0),0,0,I2S(h2i(act)))
call DisplayTextToPlayer(Player(0),0,0,I2S(h2i(con)))
call DestroyTrigger(trg)
set trg=null
call TriggerRemoveAction(trg,act)
set act = null
call TriggerRemoveCondition(trg,con)
set con = null
call DisplayTextToPlayer(Player(0),0,0,I2S(h2i(trg)))
call DisplayTextToPlayer(Player(0),0,0,I2S(h2i(act)))
call DisplayTextToPlayer(Player(0),0,0,I2S(h2i(con)))
endfunction[/jass]
对于这么一段函数,
call TriggerRemoveAction(trg,act)
set act = null
无论这一段是否运行,其显示的act都是以2来增长的
而con如果不set null的话,就要多占一个内存位置
我在置疑,触发动作是否真的需要清空?
[ 本帖最后由 zyl910 于 2006-4-24 00:58 编辑 ] |
|