RegTechAttack (DoFile, InitFuncName);


函数功能:

创建一个所有玩家使用技能或者攻击会触发的lua函数,此函数人物、怪物、宠物无需拥有任何条件都会触发


请求方式:

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

参数说明:

参数名 是否必须 类型 说明
Battleindex int 战斗索引
CharIndex int 操作对象索引
otherIndex int 被操作者对象索引
CharIndex_TechAttack 键值 使用者TechAttack键值数据
otherIndex_TechAttack 键值 被动者 TechAttack键值数据

返回值:

类型 是否必须 修改 不操作
nil or TechAttack键值数据 操作对象TechAttack键值数据 nil

注意:此函数人物无需拥有特定技能

用于参考:套装、附属技能、修改暗杀原有的算法

操作实例一

判断操作者是否触发了暗杀技能,如果触发了暗杀技能直接修改为气功蛋。如果人物使用气功蛋修改为暗杀。

function Tech_Attack_Event(BattleIndex,CharIndex, otherIndex, CharIndex_TechAttack,otherIndex_TechAttack)
    if CharIndex_TechAttack.BattleCom_Type == %Assassin% then
        print("操作者使用了暗杀技能,被改成了气功蛋");
        CharIndex_TechAttack.BattleCom_Type = %SpiracleShot%;
        CharIndex_TechAttack.BattleCom_ToTechId = 404;--404是气功蛋的tech编号
        return CharIndex_TechAttack;
    end
    if CharIndex_TechAttack.BattleCom_Type ==  %SpiracleShot% then
        print("操作者使用了气功蛋技能,被改成了暗杀");
        CharIndex_TechAttack.BattleCom_Type = %Assassin%;
        CharIndex_TechAttack.BattleCom_ToTechId = 9600;--9600是暗杀一级的编号;
        return CharIndex_TechAttack;
    end
    return nil;
end

NL.RegTechAttack(nil,"Tech_Attack_Event")

备注:

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