|
function cishablood takes nothing returns nothing
local trigger trg=GetTriggeringTrigger()
local triggeraction act=LAtg(2,trg,"act")
local effect fx=AddSpecialEffectTargetUnitBJ( "chest", GetTriggerUnit(), "Objects\\Spawnmodels\\Human\\HumanBlood\\HeroBloodElfBlood.mdl" )
call TriggerRemoveAction(trg,act) /////还有这句,这句和下面那句set act=null不能共存,两句只要删掉一句就不会有错误act只是一个局域变量代表了Triggeraction而已,而Triggeraction销毁后是否就不需要清空局域变量?为什么我有另外的触发这两个语句却可以并存。。。
call DisplayTimedTextToPlayer(Player(0),0,0,1,I2S(GetHandleId(act)))
call DestroyEffect(fx)
call DestroyTrigger(trg)
set act=null ///////////////////////////////////////////5555就是这句,如果没有这句就不会出现致命错误,但是如果没有这句,那么临时的局域变量就没法清空,求教
set trg=null
endfunction
function Trig_cisha_Actions takes nothing returns nothing
local trigger trg=CreateTrigger()
local event ev=TriggerRegisterUnitEvent(trg,GetTriggerUnit(),EVENT_UNIT_DAMAGED)
local triggeraction act=TriggerAddAction(trg,function cishablood)
call SAtg(2,trg,"act",act)
set trg=null
set ev=null
set act=null
endfunction
//===========================================================================
function InitTrig_cisha takes nothing returns nothing
set gg_trg_cisha = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_cisha, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_cisha, Condition( function Trig_cisha_Conditions ) )
call TriggerAddAction( gg_trg_cisha, function Trig_cisha_Actions )
endfunction
|
|