MythicMobs NPC
概述
MythicMobs NPC 将 MythicMobs 怪物变成 TypeWriter NPC。你仍然在 MythicMobs 中设计怪物、它的模型和技能,然后在网页面板中把它作为 NPC definition(NPC 是什么)和 NPC instance(它站在哪里、谁能看到它)放置到世界中。
NPC 可以在头顶显示名称、显示任务标记、在玩家右键点击时开始对话、被动作隐藏或显示、播放动画,并出现在过场动画中。支持来自 BetterModel 或 ModelEngine 的模型。
该扩展运行于 Paper。默认情况下,每位玩家都会获得自己的 NPC 副本(ticking 关闭),因此某位玩家的过场动画或隐藏动作永远不会影响其他人。开启 ticking 可获得一个可以四处走动的、真正存在于服务器端的怪物。
功能
- NPC definition 和 instance — 只需定义一次 MythicMob NPC,就能随意多次放置,并可使用共享、按玩家或按组的 audience。
- 名称标签和任务标记 — 悬浮的名称,以及当 NPC 对该玩家有目标或对话时显示的
❗、❓或💬标记。 - 交互事件 — 在右键点击时开始对话,可按是否潜行过滤,另有一个用于双向击打的事件。
- 任务目标 — 与 NPC 交互、从 MythicMobs 怪物处拾取物品,或统计与某个怪物的交互次数。
- Fact 和变量 — 存在、距离、可见性、生命值、仇恨表、动画、等级、强度、阵营、姿态,以及任意 MythicMobs 变量。
- 显示、隐藏和动画 — 用于显示或隐藏 NPC,以及播放或停止 ModelEngine 或 BetterModel 动画的动作。
- 过场动画 — NPC 聚焦镜头、挂载在模型骨骼上的镜头、由录制磁带驱动的 NPC,以及在某个位置施放的 MythicMobs 技能。
- 镜头和注视绑定 — 在交互期间强制玩家注视某个 NPC 或最近的某类怪物。
- 姿态(stance) — 通过 ModelEngine 或 BetterModel 实现的白天和夜晚的待机与行走姿态,以及交互、攻击等其他姿态。
安装
- 在服务器上安装 MythicMobs 和 PacketEvents。
- 在 TypeWriter 中,确保已安装官方的 Entity、Basic、Quest 和 Road Network 扩展。该构建将 Quest 和 Road Network 声明为依赖,并在运行时使用 Entity 和 Basic 扩展。
- 可选:安装 BetterModel 或 ModelEngine 以使用 3D 模型。会优先检查 BetterModel,在没有 BetterModel 时使用 ModelEngine。如果基岩版玩家必须能看到骨骼镜头,请安装 Geyser。
- 从商店获取该扩展(见上方摘要面板中的按钮),并将 JAR 放入
plugins/Typewriter/extensions/。 - 重启服务器。控制台会输出
MythicmobsNPCExtension has been successfully initialized。 - 在 MythicMobs 中创建你的怪物(并在那里为其附加模型)。该扩展负责生成和显示它们,但不会创建或更改模型。
快速上手
放置一个在玩家右键点击时开始对话的铁匠:
- 在 MythicMobs 中,创建一个内部名称为
Blacksmith的怪物(如果使用模型,则带上它的模型),并重新加载 MythicMobs。 - 在 TypeWriter 网页面板中,打开一个 static 页面,添加一个 MythicMob NPC Definition。将
displayName设为头顶显示的名称,将mobType设为Blacksmith。 - 添加一个 MythicMob NPC Instance。将
definition链接到该 definition,并将spawnLocation(带旋转角度)设为 NPC 站立的位置。 - 添加一个 MythicMob NPC Interact Event。将
definition链接到同一个 definition,并保持shiftType为ANY。 - 在它的
triggers中,链接来自某个 sequence 页面的对话条目(例如一个语音对话)。 - 发布,然后右键点击该 NPC。对于可以与它交谈的玩家,NPC 上方会显示
💬标记。
若要让它成为任务目标,请添加一个 Interact MythicMob NPC Objective,并将 entity 设为该 definition:标记会变成 ❓(任务被追踪时为 ❗),并且会有一条路径指引流向该 NPC。
对于静态 NPC,请保持 ticking 关闭:每位玩家看到自己的副本,这正是过场动画和按玩家可见性所需要的。只有当怪物必须在服务器上移动或战斗时才开启它,并将 clientSideRadius 设为大于 0,以便保持其 AI 启用。
工作原理
Definition 保存 NPC 是什么:怪物类型、名称、名称标签选项、ticking 模式,以及适用于每个 instance 的实体数据。Instance 保存它站在哪里、它自己的实体数据、一个可选的 activity(例如道路网络路径)和一个 group。
Fact、变量、显示和隐藏动作以及镜头条目全部指向某个 instance。它们会查找 definition 的怪物类型的、位于该 instance 出生点搜索半径内的真实怪物(默认 5 格,由目标上的 radius 设置)。
配置
不是条目字段的文本和偏移量是 TypeWriter 的片段(snippet)。请在 plugins/Typewriter/snippets 中编辑它们。
| 片段 | 默认值 | 用途 |
|---|---|---|
objective.entity.indicator.tracked | <gold><b>❗ | 当 NPC 是被追踪任务的目标时显示的标记。 |
objective.entity.indicator.normal | <blue><b>❓ | 当 NPC 是某个激活目标的目标时显示的标记。 |
objective.entity.indicator.dialogue | <white><b>💬 | 当 NPC 有可用的交互时显示的标记。 |
entity.nameplate | <other> 然后是 <reset><display_name> | 名称标签的布局。<other> 是来自实体数据的行。 |
entity.name.color | #40000000 | 名称标签和标记的背景颜色。 |
quest.objective.interact_mythicmob_npc | Interact with <entity> | 交互目标的默认文本。 |
advancedQuest.display | <display> (<current>/<required>),灰色调 | 计数目标(战利品、技能)进行中时的那一行。占位符:<display>(目标的 display 文本)、<current>、<required>。该键与其他 BTC 目标类扩展共用,因此一次编辑即可改变它们全部的样式。 |
advancedQuest.completed | ✔,随后是带删除线的 <display> 和 (<current>/<required>) | 达到 amount 后的同一行。占位符相同。 |
mythicmob_npc_look_at_interaction_bound.look_back_delay | 500 | 在注视绑定把玩家转回来之前,玩家可以移开视线的毫秒数。 |
mythicmob_type_look_at_interaction_bound.look_back_delay | 500 | 同上,用于按怪物类型的注视绑定。 |
条目
38 个条目,由扩展源码生成。
动作4
- Mythicmob NPC HideHide a MythicMob NPC
- Mythicmob NPC Play AnimationPlays a ModelEngine animation on a MythicMob NPC
- Mythicmob NPC ShowShow a MythicMob NPC
- Mythicmob NPC Stop AnimationStops a ModelEngine animation on a MythicMob NPC
事件3
- Mythicmob NPC HitWhen a MythicMob NPC is hit or hits a player
- Mythicmob NPC InteractWhen the player clicks on a MythicMob NPC
- On Mythic Mob LootWhen a player loots an item from a MythicMob
目标3
- Interact Mythicmob NPC ObjectiveInteract with a MythicMob NPC
- Mythicmob Loot ObjectiveAn objective to loot specific items from MythicMobs mobs
- Mythicmob Skill ObjectiveMythicMob Skill Objective
事实6
- Mythicmob NPC Animation Playing FactReturns 1 when the specified ModelEngine animation is playing
- Mythicmob NPC Distance FactReturns the distance between the player and the MythicMobs NPC
- Mythicmob NPC Health Percentage FactReturns the NPC's current health percentage
- Mythicmob NPC Presence FactReturns 1 when the MythicMobs NPC is currently spawned
- Mythicmob NPC Threat Table Size FactReturns the size of the MythicMobs threat table
- Mythicmob NPC Visibility FactReturns 1 if the player can currently see the MythicMobs NPC
过场动画4
- Mythicmob NPC Bone Camera CinematicAttach the cinematic camera to a bone of a MythicMob NPC's model
- Mythicmob NPC Camera CinematicFocus on a MythicMob NPC during a cinematic
- Mythicmob NPC Entity CinematicUse an animated MythicMob NPC in a cinematic
- Mythicmob NPC Skill CinematicTrigger a MythicSkill at a specific position during a cinematic
实体2
- Mythicmob NPC DefinitionA MythicMob that can be used as an NPC
- Mythicmob NPC InstanceAn instance of a MythicMob NPC
实体数据4
- Modelengine Stance DataModelEngine stance configuration for day/night animations
- Mythicmob NPC AttachmentReplace a bone of a MythicMob NPC model with one from another model
- Mythicmob NPC Bone VisibilityControl MythicMob NPC bone visibility with criteria
- Mythicmob Speed DataChange the walking speed of a MythicMob
交互边界3
- Mythicmob Look at Interaction BoundAn interaction which forces the player to look at the nearest MythicMob of a specific type
- Mythicmob NPC Camera BoundA camera bound that focuses on a MythicMob NPC with custom focus offset
- Mythicmob NPC Look at Interaction BoundAn interaction which forces the player to look at a MythicMob NPC
变量9
- Mythicmob NPC Active Animations VariableReturns the active ModelEngine animations for the MythicMobs NPC
- Mythicmob NPC Faction VariableReturns the MythicMobs NPC faction
- Mythicmob NPC Health Percentage VariableReturns the current health percentage of the MythicMobs NPC
- Mythicmob NPC Health VariableReturns the current health of the MythicMobs NPC
- Mythicmob NPC Level VariableReturns the MythicMobs NPC level
- Mythicmob NPC Max Health VariableReturns the maximum health of the MythicMobs NPC
- Mythicmob NPC Power VariableReturns the MythicMobs NPC power
- Mythicmob NPC Stance VariableReturns the current stance applied to the MythicMobs NPC
- Mythicmob NPC VariableReads a MythicMobs variable from the active NPC
故障排查
NPC 始终没有出现。 当 mobType 不是 MythicMobs 怪物的名称,或生成失败时,控制台会输出 Could not spawn MythicMob NPC '<type>' at <location>。mobType 是怪物的内部名称,大小写与 MythicMobs 中一致。请检查 MythicMobs 是否已加载该怪物,以及 spawnLocation 所在的区块是否能够加载。
扩展警告缺少 MythicMobs。 启动时日志会显示 MythicMobs plugin not found! This extension requires MythicMobs to function properly. 请安装 MythicMobs 并重启。
Fact 和变量始终返回默认值。 它们会解析 instance 出生点附近的真实怪物。如果 NPC 移动得比 radius(默认 5 格)更远,或怪物类型不同,则没有任何匹配,fact 返回 0。请在 target 中增大 radius。
点击时对话没有开始。 交互事件只会响应由 MythicMob NPC Instance 放置的 NPC,并且 definition 必须是该 instance 的 definition。interactionType 选择点击方式:RIGHT_CLICK、LEFT_CLICK 或 ALL。在 4.9.1 版本之前只处理右键点击,而在 Paper 26.x 上连右键也不行:请更新扩展。
玩家不共享 NPC。 在 ticking 关闭且 instance 上没有 group 时,每位玩家都会获得自己的副本,因此某位玩家的隐藏动作或过场动画不会影响其他人。请在 instance 上设置 group,以便在队伍或公会内共享该 NPC。
骨骼没有被隐藏或附加。 Bone Visibility Data 和 Attachment Data 会在模型存在后立即应用,并在每次重生后再次应用,无论 ticking 开启还是关闭。模型不认识的骨骼或模型名称会被跳过,并由控制台记录:请对照模型检查名称。
骨骼镜头什么也不显示,或玩家保持正常视角。 boneName 必须存在于模型上,并且怪物必须为该玩家生成。使用 Entity Cinematic 时,请使用 entityCinematic,让镜头精确地跟随那只怪物。镜头从玩家的眼睛开始,并在找到模型后立即吸附到该骨骼上。
玩家或镜头靠近 NPC 时模型闪烁。 这是 ModelEngine 的剔除(culling)造成的:ModelEngine 以模型脚部为基准,判断模型是否在玩家身后(backcull)或被方块遮挡(blockedcull),近距离时会误将模型隐藏,随后又重新显示。从 4.9.1 版本起,扩展会在检测到 ModelEngine 模型后立即为每个 NPC 关闭这两种剔除,无需任何配置。如果仍然闪烁,请在控制台查找警告 ModelEngine exposes no back/blocked cull setter:这表示你的 ModelEngine 版本不允许扩展修改这些设置。此时请在 MythicMobs 怪物的技能中、model 机制之后添加 cullconfig{backcull=false;blockedcull=false} @self ~onSpawn,然后重新生成 NPC。BetterModel 模型不受影响。
相关扩展
- MythicMobs — 针对普通 MythicMobs 怪物的生成、技能和击杀条目。
- BetterModel — 将 BetterModel 模型用作 NPC,采用相同的过场动画方式。