This page describes how to set up the Dialogue System with Vis2k's uMMORPG. (uMMORPG v1.121+ is required.)
uMMORPG copyright © Vis2k.
Features
The Dialogue System's uMMORPG integration adds these features:
- Conversations, barks, and alert messages using the Dialogue System.
- Quests, quest log window, and quest tracker HUD.
- Lua functions to control uMMORPG.
Setup
Import the package Third Party Support ► uMMORPG Support. This will unpack files into the folder Assets ► uMMORPG ► Addons ► Dialogue System for Unity Addon.
Note: This addon adds one syncvar to the player script. If your project contains several addons, it may exceed the maximum 32 syncvars allowed by UNET's standard HLAPI. If this happens, upgrade to vis2k's HLAPI Pro to support more syncvars.
Example Scene
The scene in the Example subfolder is configured according to the instructions below. The Alchemist NPC offers a quest to kill the bandit.
Configuration
Configure Dialogue Manager
- Add the prefab Plugins ► Pixel Crushers ► Dialogue System ► Prefabs ► Dialogue Manager to the scene.
- Add the DialogueSystem_uMMORPG script to the Dialogue Manager.
- Optimizations:
- Remove the Input Device Manager component. It isn't necessary unless you need to detect changes between using mouse and gamepad.
- In Persistent Data Settings, change Record Persistent Data On to Only Registered GameObjects. Untick Include Status and Relationship Data and Include Actor Data.
- Create a dialogue database and assign it to the Dialogue Manager.
- Customize the UI. (This step is best saved for later, after you've confirmed everything else is working properly.)
NpcDialogue Window
- Inspect Canvas → NpcDialogue.
- Add a UINpcDialogue_DialogueSystem component to the NpcDialogue GameObject.
- Add another UI button as a child of NpcDialoguePanel. (In the example scene, this is named "Talk (Dialogue System)".
- Assign the button to the UINpcDialogue_DialogueSystem component.
Quest Log Window
- Create a new button under Canvas → Shortcuts → ShortcutsPanel. Connect its OnClick() event to the Dialogue Manager's method named DialogueSystem_uMMORPG.ToggleQuestLogWindow.
Conversations
- Add a Dialogue System Trigger to the NPC, and set its Trigger to OnUse. Configure activity such as starting a conversation.
- If you want the NPC to immediately use the Dialogue System Trigger (e.g., conversation) instead of showing the uMMORPG NpcDialogue panel first, inspect the NPC and tick Dialogue System → Bypass Npc Dialogue Panel.
Configure Monsters for Quests
- Add a Dialogue System Trigger set to OnUse. Configure activity that will run when the monster is killed, such as incrementing a quest counter.
- Tick the Monster component's Dialogue System → Use On Death checkbox.
- If the player is in a party, the Dialogue System Trigger will fire for all nearby party members.
Lua Functions
In your conversations and triggers, you can use these Lua functions:
Lua Function | Description |
GetPlayerName() | Returns the player's name. |
GetPlayerClass() | Returns the player's class. |
GetPlayerLevel() | Returns the player's level. |
GetPlayerHealth() | Returns the player's health. |
GetPlayerMana() | Returns the player's mana. |
GetPlayerStr() | Returns the player's strength. |
GetPlayerInt() | Returns the player's intelligence. |
GetPlayerExp() | Returns the player's experience. |
GetPlayerSkillExp() | Returns the player's skillExperience. |
CanPlayerLearnSkill("skillname") | Returns true if the player can learn a skill; otherwise false. |
GetSkillLevel("skillname") | Returns the player's skill level, or 0 if unlearned. |
SetSkillLevel("skillname", x) | Sets the player's skill level. The player must be able to learn the skill. Does not subtract from player's skill experience. |
GetPlayerGold() | Returns the amount of gold the player has. |
GetPlayerCoins() | Returns the amount of coins the player has. |
GetPlayerItemAmount("itemname") | Returns the amount of an item that the player has. |
AddPlayerHealth(x) | Gives the player x health (or removes if negative). |
AddPlayerMana(x) | Gives the player x mana (or removes if negative). |
AddPlayerStr(x) | Gives the player x strength (or removes if negative). |
AddPlayerInt(x) | Gives the player x intelligence (or removes if negative). |
AddPlayerExp(x) | Gives the player x experience (or removes if negative). |
AddPlayerSkillExp(x) | Gives the player x skillExperience (or removes if negative). |
AddPlayerGold(x) | Gives the player x gold (or removes if negative). |
AddPlayerCoins(x) | Gives the player x coins (or removes if negative). |
AddPlayerItemAmount("itemname", x) | Adds x items (or removes if negative). |
UpdateServer() | Syncs the Dialogue System state to the server immediately. |
SyncVarToParty("varName") | Syncs the value of a Dialogue System variable to all party members. Useful for party quests. |
Notes:
Sequencer Commands
Warp()
Syntax: Warp(
destination, [subject])
Description: Warps a subject to a destination.
- destination: GameObject name. If inactive, its root parent must be an active GameObject.
- subject: GameObject to warp. Default: speaker.
Other Notes
- By default, the state is synced to the server at the end of conversations and when quest states change.
- This addon adds a table named 'dialoguesystem' containing the saved Dialogue System state for each character.
Guide: Integrating uMMORPG, Dialogue System for Unity, and Quest Machine
To integrate the Dialogue System for Unity and Quest Machine with uMMORPG, follow these steps:
Packages:
- Import the package Plugins ► Pixel Crushers ► Dialogue System ► Third Party Support ► uMMORPG Support.
- Import the package Plugins ► Pixel Crushers ► Quest Machine ► Third Party Support ► uMMORPG Support.
Prefabs:
- Add the prefab Plugins ► Pixel Crushers ► Dialogue System ► Prefabs ► Dialogue Manager to the scene.
- Add a DialogueSystem_uMMORPG component to the Dialogue Manager.
- Add a Common Library Lua component to the Dialogue Manager.
- Add a Dialogue System Quest Machine Bridge component to the Dialogue Manager.
- Remove the Input Device Manager component. It isn't necessary unless you need to detect changes between using mouse and gamepad.
- In Persistent Data Settings, change Record Persistent Data On to Only Registered GameObjects. Untick Include Status and Relationship Data and Include Actor Data.
- Add the prefab Plugins ► Pixel Crushers ► Quest Machine ► Prefabs ► Quest Machine to the scene.
- Add a QuestMachine_uMMORPG component to the Quest Machine GameObject.
- Add a Dialogue System Quest Dialogue UI component to the Quest Machine GameObject.
- Optional: Add a Dialogue System Quest Alert UI component to the Quest Machine GameObject.
NpcDialogue Panel:
- Inspect Canvas ► NpcDialogue.
- Add a UINpcDialogue_QuestMachine script to it.
- Add another UI button as a child of NpcDialoguePanel and assign it to the UINpcDialogue_QuestMachine's Quest Machine Dialogue Button field.
Quest Log Window:
- Create a new button under Canvas ► Shortcuts ► ShortcutsPanel. Connect its OnClick() event to the Quest Machine GameObject's method named QuestMachine_uMMORPG.ToggleQuestLogWindow.
Characters:
- Player: You do not need to add a Quest Journal component to the player. The Quest Machine integration will add it at runtime.
- Quest givers: Add a Quest Giver component.
- Kill targets: In the Npc component's Quest Machine section, set the Send Message On Death message. Quests can listen for this message. (Ex: 'Killed:Bandit')
Content:
- Create and assign a Quest Machine quest database to the Quest Machine GameObject.
- Create and assign a dialogue database to the Dialogue Manager.
- Create and assign quests to quest givers.
- Add Dialogue System Conversation Quest Content to your quest to show a Dialogue System conversation, as described in Quest Machine's Dialogue System integration manual.
- Write those conversations in the Dialogue System. Use uMMORPG Lua Functions such as AddPlayerExp() and/or Common library Lua functions such as SendMessageSystem().
<< Third Party Integration