*NL.RegItemUseEvent
NL.RegItemUseEvent(Dofile, FuncName)
函数功能
创建一个所有玩家使用道具(包括战斗中)就会触发的Lua函数。
参数说明
返回值
无返回值
ItemUseCallBack(CharIndex, TargetCharIndex, ItemSlot)
参数说明
- CharIndex: 数值型 道具所有者的对象index,该值由Lua引擎传递给本函数。
- TargetCharIndex: 数值型 道具使用目标的对象index,对自身使用则与CharIndex值相同,该值由Lua引擎传递给本函数。
- ItemSlot: 数值型 响应事件的道具所在的栏位,范围8-27,该值由Lua引擎传递给本函数。
返回值
返回值小于0则取消道具使用,返回大于等于0则正常使用。
参考实例
NL.RegItemUseEvent(nil,”MyItemUseCallBack”);
function MyItemUseCallBack(CharIndex, TargetCharIndex, ItemIndex)
print(Char.GetData(CharIndex,%对象_原名%).."成功对"..Char.GetData(TargetCharIndex,%对象_原名%).."使用了。"..Item.GetData(ItemIndex, %道具_鉴前名%));
return 0;
end