This page describes how to set up the Dialogue System with Vis2k's uMMORPG (Classic). (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.
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
(uMMORPG2D Only) Preliminary Step If Using uMMORPG2D
If you're using uMMORPG (the 3D version), you can skip this step.
If you're using uMMORPG2D, select Edit > Project Settings > Player, and add this Scripting Define Symbol: USE_UMMORPG2D
Note: The example scene for uMMORPG2D (World_DS_2D) only demonstrates how to set up the scene and a conversation. It uses the same conversation as uMMORPG, which is to kill a bandit. But since there's no bandit in uMMORPG2D the quest can't be completed.
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.
- If you have configured your dialogue UI to show player portraits and you want to show the player's uMMORPG Portrait Icon, tick the Player component's Use Player Icon For Conversations. The portrait icon (or a copy) must be placed in a folder named Resources.
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.
Configure Gather Quests
If you have any gather quests:
- Write your quests and add counter variables in the Dialogue Editor.
- Add a Dialogue System Loot Quest Info component to the Dialogue Manager GameObject.
- Set elements in the Item Variables list.
- Variable: A dialogue database variable to update.
- Item: A uMMORPG item. The variable will be set to the amount of this item in the player's inventory.
- Max Value: The variable will not exceed this value.
- Optionally assign events to the OnVariablesUpdated() UnityEvent. For example, you can call Dialogue System Triggers that check quest conditions and automatically update quest states.
Whenever the Loot panel closes, this script will update variables in the Item Variables list and invoke the OnVariablesUpdated() UnityEvent.
Lua Functions
In your conversations and triggers, you can use the Lua functions below. In the '...' Lua wizard dropdowns, these functions are available in Custom > uMMORPG.
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. |
OpenTrading() | Opens the NPC's trading window. |
OpenGuild() | Opens the NPC's guild window. |
OpenRevive() | Opens the NPC's pet revive window. |
CanTrade() | True if the current NPC can trade. |
CanManageGuild() | True if the current NPC can offer guild management. |
CanRevive() | True if the current NPC can revive summonables. |
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.
Server-Side Authorization
To enable server-side authorization of Lua functions such as adding gold and items:
- If you will only use Lua functions in conversations, untick the DialogueSystem_uMMORPG component's Allow Lua Outside Conversations.
- Inspect each NPC. Expand Reward Authorization, tick Enforce Authorization, and set limits. When a Lua function runs during a conversation, the server will validate that the function and its values are allowed.
- Scripting: You can also assign your own validation functions to the Player's validation delegates such as dsValidateAddPlayerExp and dsValidateAddPlayerGold.
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