|
发表于 2007-11-27 11:19:37
|
显示全部楼层
以下是标准的触发创建和删除~
[codes=jass]
function DestroyTriggerAllById takes integer t returns nothing
call TriggerRemoveCondition(i2tg(t),i2tc(GetStoredInteger(udg_GC,I2S(t),"TriggerCondition")))
call DestroyTrigger(i2tg(t))
call FlushStoredMission(udg_GC,I2S(t))
endfunction
function DestroyTriggerAll takes trigger trg returns nothing
call TriggerRemoveCondition(trg,i2tc(GetStoredInteger(udg_GC,I2S(h2i(trg)),"TriggerCondition")))
call DestroyTrigger(trg)
call FlushStoredMission(udg_GC,I2S(h2i(trg)))
endfunction
//========================================================
function RegisterUnitAmortCond takes nothing returns nothing
call SetUnitInvulnerable(GetTriggerUnit(), true)
call DestroyTriggerAll(GetTriggeringTrigger())
endfunction
function RegisterUnitAmortEvent takes unit witchUnit returns nothing
local trigger trg = CreateTrigger()
call TriggerRegisterUnitStateEvent(trg, witchUnit, UNIT_STATE_LIFE, LESS_THAN_OR_EQUAL, 50)
call StoreInteger(udg_GC,I2S(h2i(trg)),"TriggerCondition",TriggerAddCondition(trg,Condition(function RegisterUnitAmortCond)))
set trg = null
endfunction
[/codes] |
|