Lua接口/服务端/GetNpcInfoByNpcId
来自天龙知识库
跳到导航跳到搜索
通过任务 NPC 编号返回完整的任务 NPC 配置。
Lua 调用
GetNpcInfoByNpcId(sceneId, nNpcId)
服务端脚本中共出现 60 处调用,实参个数出现过:2 个(60 处)。
实现位于 LuaFnTbl_Mission.h。
参数
| 序号 | 参数 / 类型 | 说明 |
|---|---|---|
| 1 | sceneIdnumber
|
当前调用所在的场景 ID。 脚本中的实参: sceneId(60 处)
|
| 2 | nNpcIdnumber
|
NPC 的场景对象 ID。 脚本中的实参: nNpcId(33 处)、nMonsterId(9 处)、npcId(7 处)
|
返回值
根据执行分支,返回数量可能为 0、10 个(0 个表示无返回值)。返回类型包括 number、string。
脚本中的调用
以下是服务端脚本里的真实调用点,按实参形态去重后列出 8 条。这些调用取自随包发布的脚本,可用于确认参数顺序与实际传入的值;它们不代表该写法在当前版本仍然有效。
-- event/city/ecity_0103deliverweapon.lua GetNpcInfoByNpcId(sceneId, nNpcId) -- event/city/ecity_0104collectfoundrymat.lua GetNpcInfoByNpcId(sceneId, missionNpc) -- event/city/ecity_0202convoypet.lua GetNpcInfoByNpcId(sceneId, PetNpcId) -- event/city/ecity_0503savefamily.lua GetNpcInfoByNpcId(sceneId, MenpaiInfo.NpcId) -- event/EventScript/event_songxin.lua GetNpcInfoByNpcId(sceneId, npcId) -- event/EventScript/event_songxin.lua GetNpcInfoByNpcId(sceneId, targetNpcId) -- event/shimen/event_shimen_dali.lua GetNpcInfoByNpcId(sceneId, nMonsterId) -- event/xunhuan/event_renwulian.lua GetNpcInfoByNpcId(sceneId, npcIndex)
注意事项
- 实现体检查
pNpc != NULL(断言消息由szTmp提供)。