魔力宝贝

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz

[NL库] RegBattleGetProfitEvent

[复制链接]
发表于 前天 19:53 | 显示全部楼层 |阅读模式
RegBattleGetProfitEvent
NL.RegBattleGetProfitEvent(Dofile, FuncName)
函数功能
创建一个战斗奖励事件触发的Lua函数。

参数说明
Dofile: 字符串 要加载的脚本文件名,如果为当前文件,则定义nil即可
FuncName: 字符串 触发的Lua函数的名称,该函数的申明格式请参考[BattleExitCallBack]
返回值
无返回值

BattleGetProfitCallBack(BattleIndex, Side, Pos, CharIndex, ProfitType, Profit)
参数说明
BattleIndex: 数值型 响应事件的战斗index,该值由Lua引擎传递给本函数。
Side: 数值型 响应事件的战斗阵营,该值由Lua引擎传递给本函数。
BattleIndex: 数值型 响应事件的战斗阵营,该值由Lua引擎传递给本函数。
Pos: 数值型 响应事件的角色位置。该值由Lua引擎传递给本函数。
CharIndex: 数值型 响应事件的角色Index。该值由Lua引擎传递给本函数。
ProfitType: 数值型 响应事件的奖励类型,-1为经验(不会触发),-2为DP,0~2为道具。该值由Lua引擎传递给本函数。
Profit: 数值型 对应奖励类型的值,类型为经验和DP时为对应的数值,类型为道具时为ItemIndex,如果没有道具奖励则为-1。该值由Lua引擎传递给本函数。
返回值
新的值,如果类型为经验或DP,则返回新的数值。 如果类型为道具,则返回新的道具index。道具index可以通过Item.MakeItemAndRegist注册。

参考实例
NL.RegBattleGetProfitEvent(nil,”MyBattleGetProfitCallBack”);

function MyBattleGetProfitCallBack(BattleIndex, Side, Pos, CharIndex, ProfitType, Profit)
  if(ProfitType==0)then
    print(CharIndex.."在战斗中获取到了道具"..Profit);
    newItemIndex=Item.MakeItemAndRegist(1000,1);
    return newItemIndex; -- 将获取的道具战利品替换为item id为1000的道具
  end
end
回复

使用道具 举报

Archiver|魔力研究社

GMT+8, 2025-5-12 21:48 , Processed in 0.125661 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表