|
发表于 2008-11-6 19:33:21
|
显示全部楼层
(1) .......这个,我是从来54这种小泄漏啦........WC3里的string效率很高,只要你不写成
[jass]
StoreInteger(udg_GC,I2S(H2I(t)),"caster"+I2S(H2I(trg)),H2I(GetTriggerUnit()))
[/jass]
之类的就行了..........(引用某大)
(2)比如说 function www 是一单位释放一技能, function qqq 是一 timer 映射函数,于是就写成了:
[jass]
function www takes nothing returns nothing
local unit u = GetTriggerUnit()
local timer t = CreateTimer()
call StoreInteger(GameCache(),I2S(H2I(t)),"TriggerUnit",H2I(u))
call TimerStart(t,1,false,function qqq)
set u = null
endfunction
function qqq takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = I2U(GetStoredInteger(GameCache(),I2S(H2I(t)),"TriggerUnit"))
set u = null
set t = null
endfunction
[/jass]
(3)因为你这个函数并没有属于任何一个Trigger,所以GetTriggerUnit()返回的就是null了。除非用TriggerAddAction,TriggerAddCondition等函数把该函数"加"到某一Trigger下。 |
|