Lua接口/服务端/MonsterAI GetIntParamByIndex:修订间差异
来自雪舞天龙知识库
跳到导航跳到搜索
维护服务端 Lua 接口:核对参数、返回值、边界条件与调用示例 |
维护服务端 Lua 接口:核对参数、返回值、边界条件与调用示例 |
||
| 第8行: | 第8行: | ||
<pre>MonsterAI_GetIntParamByIndex(sceneId, selfId, nIndex)</pre> | <pre>MonsterAI_GetIntParamByIndex(sceneId, selfId, nIndex)</pre> | ||
服务端脚本中共出现 | 服务端脚本中共出现 100 处调用,实参个数出现过:3 个(99 处)、4 个(1 处)。 | ||
实现位于 <code>LuaFnTbl_MonsterAI.h</code>。 | 实现位于 <code>LuaFnTbl_MonsterAI.h</code>。 | ||
| 第20行: | 第20行: | ||
| 1 | | 1 | ||
| <code>sceneId</code><br /><span class="lua-muted"><code>number</code></span> | | <code>sceneId</code><br /><span class="lua-muted"><code>number</code></span> | ||
| 当前调用所在的场景 ID。<br /><span class="lua-muted">脚本中的实参:<code>sceneId</code> | | 当前调用所在的场景 ID。<br /><span class="lua-muted">脚本中的实参:<code>sceneId</code>(100 处)</span> | ||
|- | |- | ||
| 2 | | 2 | ||
| <code>selfId</code><br /><span class="lua-muted"><code>number</code></span> | | <code>selfId</code><br /><span class="lua-muted"><code>number</code></span> | ||
| 当前场景内的对象 ID。玩家接口需传入有效玩家对象;不是角色 GUID。<br /><span class="lua-muted">脚本中的实参:<code>selfId</code> | | 当前场景内的对象 ID。玩家接口需传入有效玩家对象;不是角色 GUID。<br /><span class="lua-muted">脚本中的实参:<code>selfId</code>(100 处)</span> | ||
|- | |- | ||
| 3 | | 3 | ||
2026年10月26日 (一) 22:31的版本
// 读取怪物 Lua AI 的整数参数。
Lua 调用
MonsterAI_GetIntParamByIndex(sceneId, selfId, nIndex)
服务端脚本中共出现 100 处调用,实参个数出现过:3 个(99 处)、4 个(1 处)。
实现位于 LuaFnTbl_MonsterAI.h。
参数
| 序号 | 参数 / 类型 | 说明 |
|---|---|---|
| 1 | sceneIdnumber
|
当前调用所在的场景 ID。 脚本中的实参: sceneId(100 处)
|
| 2 | selfIdnumber
|
当前场景内的对象 ID。玩家接口需传入有效玩家对象;不是角色 GUID。 脚本中的实参: selfId(100 处)
|
| 3 | nIndexnumber
|
条目索引。 脚本中的实参: x402269_IDX_SkillB_Step(5 处)、x402282_IDX_SkillB_Step(5 处)、x005117_TBL.IDX_TimerInterval
|
返回值
根据执行分支,返回数量可能为 0、1 个(0 个表示无返回值)。返回类型包括 number。
脚本中的调用
以下是服务端脚本里的真实调用点,按实参形态去重后列出 8 条。这些调用取自随包发布的脚本,可用于确认参数顺序与实际传入的值;它们不代表该写法在当前版本仍然有效。
-- event/bossgroup/bg_BossAI_CreateMonster.lua MonsterAI_GetIntParamByIndex(sceneId, selfId, x810100_IDX_UpdateMonsterTime) -- event/bossgroup/bg_BossAI_CreateMonster.lua MonsterAI_GetIntParamByIndex(sceneId, selfId, x810100_IDX_NeedCreateMonsterNum, 0) -- event/jinghu/ejinghu_Boss_1.lua MonsterAI_GetIntParamByIndex(sceneId, selfId, x005117_TBL.IDX_TimerPrepare) -- event/jinghu/ejinghu_Boss_1.lua MonsterAI_GetIntParamByIndex(sceneId, selfId, x005117_TBL.IDX_TimerInterval) -- event/jinghu/ejinghu_Boss_2.lua MonsterAI_GetIntParamByIndex(sceneId, selfId, x005118_TBL.IDX_TimerPrepare) -- event/jinghu/ejinghu_Boss_2.lua MonsterAI_GetIntParamByIndex(sceneId, selfId, x005118_TBL.IDX_TimerInterval) -- event/jinghu/ejinghu_Boss_3.lua MonsterAI_GetIntParamByIndex(sceneId, selfId, x005119_TBL.IDX_TimerPrepare) -- event/jinghu/ejinghu_Boss_3.lua MonsterAI_GetIntParamByIndex(sceneId, selfId, x005119_TBL.IDX_TimerInterval)
注意事项
- 脚本中有传入 4 个实参的调用,多于实现体读取的 3 个位置;多出的实参不会生效,如果需要其作用应改用别的接口。