|
楼主 |
发表于 2009-9-25 17:59:35
|
显示全部楼层
引用第1楼zhuzeitou于2009-09-24 15:43发表的 :
你可以先用触发来实现,然后转成jass后再作修改和优化,恩
自己写了个函数
但是发现没有用
哪个环节出错了??
[jass]
function GetUnitEquipF takes nothing returns nothing
set bj_itemRandomCurrentPick=GetFilterItem()
endfunction
function GetUnitEquipC takes nothing returns boolean
if(GetItemPlayer(GetEnumItem())!=Player(bj_forLoopAIndex) ) then
return false
endif
if(GetItemType(GetFilterItem())==ConvertItemType(bj_forLoopBIndex)) then
return false
endif
return true
endfunction
function GetUnitEquip takes unit u,integer i returns item
local rect r=Rect(-512,-512,512,512)
local boolexpr b=Condition(function GetUnitEquipC)
set bj_forLoopAIndex = GetPlayerId(GetOwningPlayer(u))
set bj_forLoopBIndex = i
set bj_itemRandomCurrentPick=null
call EnumItemsInRect(r,b, function GetUnitEquipF)
call DestroyBoolExpr(b)
call RemoveRect(r)
set b=null
set r=null
return bj_itemRandomCurrentPick
endfunction
[/jass] |
|