NL.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
HourGlass