RegProductItem (DoFile, InitFuncName);


函数功能:

创建一个所有玩家角色生产、采集会触发的Lua函数。


请求方式:

参数名 是否必须 类型 说明
DoFile string 脚本文件路径(如是本文件则填写nil)
InitFuncName string 响应事件处理函数的名称,声明格式参考如下

参数说明:

参数名 是否必须 类型 说明
CharIndex int 响应事件的对象索引
SkillID int 技能SkillID
LV int 技能等级
ItemID int 是否成功(-1失败,其他为物品ID)
ItemIndexList Table 制作使用的所有物品索引列表(包括宝石),采集为nil

返回值:

类型 是否必须 失败 成功
int -1 物品ID

操作实例:

function ProductItem_Event(CharIndex, SkillID, LV, ItemID,ItemIndexList)
    if(ItemIndexList == nil)then--采集
        local String = string.format("采集物品使用技能ID:%d,技能等级:%d,得到的道具ID:%d",SkillID,LV,ItemID);
        NLG.SystemMessage( CharIndex, String);
        return ItemID;
    end

    for Loopi = 1,#ItemIndexList do

        NLG.SystemMessage(CharIndex,string.format("采集物品使用技能ID:%d,技能等级:%d,得到的道具ID:%d 得所需的道具ID:%d",SkillID,LV,ItemID,ItemIndexList[Loopi]));

    end
    return ItemID;
end

强制修改实例:

function ProductItem_Event(CharIndex, SkillID, LV, ItemID,ItemIndexList)
    --无论制作或者采集统一得到道具ID为10000
    return 10000;
end

备注:

  • 返回错误代码请使用 GetErrorStr 获取具体错误信息。
文档更新时间: 2023-04-21 15:45   作者:105493660