|
发表于 2008-3-18 17:24:05
|
显示全部楼层
Blizzard.j里的掉宝函数~~
[jass]
function UnitDropItem takes unit inUnit, integer inItemID returns item
local real x
local real y
local real radius = 32
local real unitX
local real unitY
local item droppedItem
if (inItemID == -1) then
return null
endif
set unitX = GetUnitX(inUnit)
set unitY = GetUnitY(inUnit)
set x = GetRandomReal(unitX - radius, unitX + radius)
set y = GetRandomReal(unitY - radius, unitY + radius)
set droppedItem = CreateItem(inItemID, x, y)
//我说的就是下面这个函数~~
call SetItemDropID(droppedItem, GetUnitTypeId(inUnit))
call UpdateStockAvailability(droppedItem)
return droppedItem
endfunction
[/jass] |
|