一段关于魔兽jass语言的函数,请高手指点。

来源:百度知道 编辑:UC知道 时间:2024/06/20 17:45:06
function Unit000090_DropItems takes nothing returns nothing
local widget trigWidget = null
local unit trigUnit = null
local integer itemID = 0
local boolean canDrop = true

set trigWidget = bj_lastDyingWidget
if (trigWidget == null) then
set trigUnit = GetTriggerUnit()
endif

if (trigUnit != null) then
set canDrop = not IsUnitHidden(trigUnit)
if (canDrop and GetChangingUnit() != null) then
set canDrop = (GetChangingUnitPrevOwner() == Player(PLAYER_NEUTRAL_AGGRESSIVE))
endif
endif

if (canDrop) then
// Item set 0
call RandomDistReset( )
call RandomDistAddItem( ChooseRandomItemEx( ITEM_TYPE_PERMANENT, 1 ), 100 )
set itemID = RandomDistChoose( )
if (trigUnit != null) then
call UnitDropItem( trigUnit, itemID )

关于这个嘚:
function Unit000090_DropItems takes nothing returns nothing
local widget trigWidget = null
local unit trigUnit = null
local integer itemID = 0
local boolean canDrop = true

set trigWidget = bj_lastDyingWidget
if (trigWidget == null) then
set trigUnit = GetTriggerUnit()
endif

if (trigUnit != null) then
set canDrop = not IsUnitHidden(trigUnit)
if (canDrop and GetChangingUnit() != null) then
set canDrop = (GetChangingUnitPrevOwner() == Player(PLAYER_NEUTRAL_AGGRESSIVE))
endif
endif

if (canDrop) then
// Item set 0
call RandomDistReset( )
call RandomDistAddItem( ChooseRandomItemEx( ITEM_TYPE_PERMANENT, 1 ), 100 )
set itemID = RandomDistChoose( )
if (trigUnit != null) then
call UnitDropItem( trigUnit, itemID )
else
call WidgetDropItem( trigWidget, itemID )
endif

endif

set bj_lastDyingWidget = nu