Dialogue, chat, and shops give the demo a much more game like loop: NPCs can talk, reward items or XP, open shop interfaces, and share the same OSRS style lower chatbox space.
Dialogue system
DialogueConversationDefinition contains nodes, choices, speaker text, and reward entries. DialogueManager runs the conversation, DialoguePanelUI presents the active node, and DialogueRewardService can grant inventory items, XP, or both.
| Script | Purpose |
|---|---|
DialogueConversationDefinition, DialogueNode, DialogueChoice | ScriptableObject driven conversation content. |
DialogueRewardEntry, DialogueRewardService | Optional rewards for tutorial NPCs, quests, or progression moments. |
StartDialogueConversationNpcAction | NPC action that starts a configured conversation. |
Shops
Shops are data driven inventories that NPCs can open through OpenShopNpcAction. ShopDefinition stores stock entries, while ShopManager, ShopSession, and ShopTransactionService handle active buying and selling behavior.
| Shop piece | Use |
|---|---|
ShopStockEntry | Defines item, quantity, price behavior, and stock data. |
ShopRuntimeStock | Tracks stock during play. |
ShopTransactionResult | Reports whether a buy/sell operation succeeded and why. |
Chatbox
ChatboxController and ChatMessageLineUI support in game chat style message presentation. The chatbox can also serve as the area that dialogue takes over, matching the old school RPG flow.
Recommended setup flow
- Create the NPC and add
NpcInteractableplusNpcInteractionController. - Add one or more
NpcActionDefinitionassets. - Use
StartDialogueConversationNpcActionfor tutors and story NPCs. - Use
OpenShopNpcActionfor merchants. - Wire the chatbox/dialogue UI once, then reuse it across NPC content.