|
发表于 2008-7-27 14:01:43
|
显示全部楼层
调用格式 call upgread(触发单位,低级物品,需要个数,高级物品)
[jass]
function upgread takes unit who,integer olditem,integer n,integer newitem returns nothing
local integer i =1
local integer j =0
local boolean gave = false
local item array itemofunit
loop
exitwhen i >6
if GetItemTypeId(UnitItemInSlotBJ(who, i))==olditem then
set j=j+1
set itemofunit[j]=UnitItemInSlotBJ(who, i)
endif
set i=i+1
endloop
if (j < n)==false then
set gave=true
loop
exitwhen j<1
call RemoveItem( itemofunit[j] )
set j=j-1
endloop
endif
if gave==true then
call UnitAddItemByIdSwapped(newitem , who )
endif
endfunction
[/jass] |
|