汤团先生 发表于 2023-12-4 15:59:55

Hook NPC条件判断执行命令 hook不到

function HookNpcConditionProcess(ScriptParam: PScriptCmdParam): Boolean; stdcall;
命令hook不到


const
//检测
sCHECK_CHECKLEVEL = 'MyCheckLevel';
nCHECK_CHECKLEVEL = 1000;
sCHECK_CHECKMINE = 'CheckMineEx';
nCHECK_CHECKMINE = 1001;
//执行
sACT_TAKEBAGITEMS = 'TAKEBAGITEMSEX';
nACT_TAKEBAGITEMS = 1000;
sACT_TAKEMINE = 'TakeMineEx';
nACT_TAKEMINE = 1001;


//Hook NPC条件判断载入命令,如自定义命令:CheckTest,将返回值置为 1
function HookNpcLoadConditionCmd(pCmd: PAnsiChar): Integer; stdcall;
begin
Result := 0;
if lstrcmpiA(pCmd, 'MyCheckLevel') = 0 then   // 不区分大小写比较
    Result := nCHECK_CHECKLEVEL
else if lstrcmpiA(pCmd, sCHECK_CHECKMINE) = 0 then
    Result := nCHECK_CHECKMINE;

end;



//Hook NPC条件判断执行命令,ScriptParam.nCMDCode = 1 即为 CheckTest命令
function HookNpcConditionProcess(ScriptParam: PScriptCmdParam): Boolean; stdcall;
//var
//Abil: TAbility;
begin
Result := False;
if ScriptParam.nCMDCode = nCHECK_CHECKMINE then
begin
    g_AppFunc.BaseObject.SysMsg(ScriptParam.PlayObject, '检查测试?', 0, 250, MSGTYEPE_HINT);------------》无法执行
//    if g_AppFunc.BaseObject.GetWAbility(ScriptParam.PlayObject, @Abil) then
//    begin
//      Result := Abil.Level >= ScriptParam.nParam01;
//    end;
end;

end;

aaa9300 发表于 2023-12-7 10:07:06

大佬的弄好了吗? 我用引擎包里的"自定义Npc命令"例子编译的, 也没效果
页: [1]
查看完整版本: Hook NPC条件判断执行命令 hook不到