|
发表于 2007-10-12 20:39:00
|
显示全部楼层
[codes=jass]
globals
string array udg_ObjId_Str
endglobals
function Init_ObjId_Str takes nothing returns nothing
local string s = "0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz"
local integer i = '0'
loop
set udg_ObjId_Str = SubString(s,i-48,i-47)
exitwhen i >= 'z'
set i=i+1
endloop
endfunction
function GetUnitIdString takes unit u returns string
local integer i = GetUnitTypeId(u)
local integer j
local string s=""
loop
set s = udg_ObjId_Str[i-i/256*256]+s
set i = i/256
exitwhen i==0
endloop
return s
endfunction[/codes]
Init_ObjId_Str是初始化函数,在地图开始或初始化时运行
然后用GetUnitIdString就可以了,物品技能之类的一样的道理 |
|