|
发表于 2010-12-23 13:22:12
|
显示全部楼层
要用到缓存和wc3sear的转化函数,在分割线前面,后面是对你函数的修正:
function H2I takes handle h returns integer
return h
return 0
endfunction
function tfgc takes nothing returns gamecache
return InitGameCache("tfgc.w3v")
endfunction
function SetHandleHandle takes handle subject, string name, handle value returns nothing
if value==null then
call FlushStoredInteger(tfgc(),I2S(H2I(subject)),name)
else
call StoreInteger(tfgc(), I2S(H2I(subject)), name, H2I(value))
endif
endfunction
function GetHandleUnit takes handle subject, string name returns unit
return GetStoredInteger(tfgc(), I2S(H2I(subject)), name)
return null
endfunction
//==========================================================================
function timerzhouqi takes nothing returns nothing
local timer t = CreateTimer()
local unit a = GetHandleUnit(t, "a")
local unit b = GetHandleUnit(t, "b")
local location loc_c = GetUnitLoc(a)
local location loc_b = GetUnitLoc(b)
local location loc_a = PolarProjectionBJ(loc_c, 15.00, AngleBetweenPoints(loc_b, loc_c))
call SetUnitPositionLoc(a,loc_a)
call RemoveLocation(loc_a)
call RemoveLocation(loc_c)
call RemoveLocation(loc_b)
set t = null
set a = null
set b = null
endfunction
function tf takes unit a,unit b returns nothing
local timer t = CreateTimer()
call SetHandleHandle(t, "a", a)
call SetHandleHandle(t, "b", b)
call TimerStart( t ,0.3,true,function timerzhouqi)
endfunction |
|