|
使用useItem()函數時,例子:
if BeeUnitHealth("player","%")<50 then
useItem(5512);
return;
end
“5512”為治療石的ID。由於useItem()函數沒有返回值,當物品為空或沒有時,會卡技能。
建議代碼如下修改:
function useItem(itemID)
if GetItemCount(itemID,false,false) > 0 then
if select(2,GetItemCooldown(itemID))==0 then
RunMacroText("/use "..tostring(select(1,GetItemInfo(itemId))));
return true;
end
end
return false;
end
代碼修改后,使用例子如下:
if BeeUnitHealth("player","%")<50 then
if useItem(5512) then
return;
end
end
修改后可正常施放技能。
.gif) |
评分
-
查看全部评分
|