Lua接口/服务端/SetCharacterName:修订间差异
来自天龙知识库
跳到导航跳到搜索
整理当前服务端 Lua 接口:注册名称、参数、返回值与调用说明 |
维护服务端 Lua 接口:核对参数、返回值、边界条件与调用示例 |
||
| (未显示2个用户的4个中间版本) | |||
| 第1行: | 第1行: | ||
__NOTOC__ | __NOTOC__ | ||
<div class="lua-reference | <div class="lua-reference"> | ||
[[首页|首页]] · [[Lua接口/服务端函数索引|服务端接口]] · [[Lua接口/服务端函数索引/怪物与掉落|怪物与掉落]] · [[Lua接口/服务端调用约定|调用约定]] | [[首页|首页]] · [[Lua接口/服务端函数索引|服务端接口]] · [[Lua接口/服务端函数索引/怪物与掉落|怪物与掉落]] · [[Lua接口/服务端调用约定|调用约定]] | ||
<div | <div class="lua-lead lua-rule">设置角色名称,固定返回 -1。</div> | ||
== Lua 调用 == | == Lua 调用 == | ||
<pre | <pre>SetCharacterName(sceneId, selfId, name)</pre> | ||
服务端脚本中共出现 83 处调用,实参个数出现过:3 个(83 处)。 | |||
实现位于 <code>LuaFnTbl_Monster.h</code>。 | |||
== 参数 == | == 参数 == | ||
{| class="wikitable | {| class="wikitable" | ||
! scope="col" | ! scope="col" class="lua-w11" | 序号 | ||
! scope="col" | ! scope="col" class="lua-w36" | 参数 / 类型 | ||
! scope="col | ! scope="col" | 说明 | ||
|- | |- | ||
| 1 | |||
| <code>sceneId</code><br /><span class="lua-muted"><code>number</code></span> | |||
| | | 当前调用所在的场景 ID。<br /><span class="lua-muted">脚本中的实参:<code>sceneId</code>(83 处)</span> | ||
|- | |- | ||
| 2 | |||
| <code>selfId</code><br /><span class="lua-muted"><code>number</code></span> | |||
| | | 当前场景内的对象 ID。玩家接口需传入有效玩家对象;不是角色 GUID。<br /><span class="lua-muted">脚本中的实参:<code>nNpcId</code>(20 处)、<code>nNpc1</code>(18 处)、<code>monsterID</code>(13 处)</span> | ||
|- | |- | ||
| 3 | |||
| <code>name</code><br /><span class="lua-muted"><code>string</code></span> | |||
| | | 名称字符串。<br /><span class="lua-muted">脚本中的实参:<code>"江湖侠士"</code>(11 处)、<code>strName</code>(4 处)、<code>"萧峰"</code>(3 处)</span> | ||
|} | |} | ||
== 返回值 == | == 返回值 == | ||
返回 1 个值。返回类型包括 <code | 返回 1 个值。返回类型包括 <code>number</code>。明确的固定返回组合包括 <code>-1</code>。 | ||
== 脚本中的调用 == | |||
以下是服务端脚本里的真实调用点,按实参形态去重后列出 8 条。这些调用取自随包发布的脚本,可用于确认参数顺序与实际传入的值;它们不代表该写法在当前版本仍然有效。 | |||
<pre>-- event/caoyun/ecaoyun.lua | |||
SetCharacterName(sceneId, MonsterId, str) | |||
-- event/city/ecity_0202convoypet.lua | |||
SetCharacterName(sceneId, monsterId, x600009_g_StrList[girlFamilyNameIndex] .. x60000) | |||
-- event/city/ecity_0602military.lua | |||
SetCharacterName(sceneId, nMonsterId, x600032_g_StrList[nXing] .. x600032_g_StrList[nM) | |||
-- event/city/ecity_0604military.lua | |||
SetCharacterName(sceneId, nMonsterId, x600034_g_StrList[nXing] .. x600034_g_StrList[nM) | |||
-- event/city/ecity_0703killruffian.lua | |||
SetCharacterName(sceneId, monsterId, x600039_g_StrList[BossIndex]) | |||
-- event/city/ecity_0802findcompound.lua | |||
SetCharacterName(sceneId, monsterId, BossName) | |||
-- event/fuben/efuben_cuju.lua | |||
SetCharacterName(sceneId, nMiddleMonster, "满天星") | |||
-- event/fuben/efuben_cuju.lua | |||
SetCharacterName(sceneId, nNpc1, szName)</pre> | |||
</div> | </div> | ||
2026年9月20日 (日) 00:16的最新版本
设置角色名称,固定返回 -1。
Lua 调用
SetCharacterName(sceneId, selfId, name)
服务端脚本中共出现 83 处调用,实参个数出现过:3 个(83 处)。
实现位于 LuaFnTbl_Monster.h。
参数
| 序号 | 参数 / 类型 | 说明 |
|---|---|---|
| 1 | sceneIdnumber
|
当前调用所在的场景 ID。 脚本中的实参: sceneId(83 处)
|
| 2 | selfIdnumber
|
当前场景内的对象 ID。玩家接口需传入有效玩家对象;不是角色 GUID。 脚本中的实参: nNpcId(20 处)、nNpc1(18 处)、monsterID(13 处)
|
| 3 | namestring
|
名称字符串。 脚本中的实参: "江湖侠士"(11 处)、strName(4 处)、"萧峰"(3 处)
|
返回值
返回 1 个值。返回类型包括 number。明确的固定返回组合包括 -1。
脚本中的调用
以下是服务端脚本里的真实调用点,按实参形态去重后列出 8 条。这些调用取自随包发布的脚本,可用于确认参数顺序与实际传入的值;它们不代表该写法在当前版本仍然有效。
-- event/caoyun/ecaoyun.lua SetCharacterName(sceneId, MonsterId, str) -- event/city/ecity_0202convoypet.lua SetCharacterName(sceneId, monsterId, x600009_g_StrList[girlFamilyNameIndex] .. x60000) -- event/city/ecity_0602military.lua SetCharacterName(sceneId, nMonsterId, x600032_g_StrList[nXing] .. x600032_g_StrList[nM) -- event/city/ecity_0604military.lua SetCharacterName(sceneId, nMonsterId, x600034_g_StrList[nXing] .. x600034_g_StrList[nM) -- event/city/ecity_0703killruffian.lua SetCharacterName(sceneId, monsterId, x600039_g_StrList[BossIndex]) -- event/city/ecity_0802findcompound.lua SetCharacterName(sceneId, monsterId, BossName) -- event/fuben/efuben_cuju.lua SetCharacterName(sceneId, nMiddleMonster, "满天星") -- event/fuben/efuben_cuju.lua SetCharacterName(sceneId, nNpc1, szName)