This page describes how to set up the Dialogue System with Vis2k's uMMORPG (Remastered - Components Edition).
uMMORPG copyright © Vis2k.
Features
The Dialogue System's uMMORPG Remastered 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.
Installation
- Import the package Third Party Support ► uMMORPG Remastered Support. This will unpack files into the folder Assets ► Pixel Crushers ► Dialogue System ► Third Party Support ► Dialogue System uMMORPG Support.
- Edit PlayerSkills.cs and add this method at the end of the class:
public void SetSkillExperience(long value) { skillExperience = value; }
- Edit PlayerAttribute.cs and add this method at the end of the class:
public void SetValue(int value) { this.value = value; }
- Edit PlayerItemMall.cs and add this method at the end of the class:
public void SetCoins(long value) { coins = value; }
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 Player Prefabs
- Add the Player_DialogueSystem component to your player prefabs.
Configure Network Manager
- Add the Database_DialogueSystem component to the scene's NetworkManager GameObject.
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 GameObject.
- Set the Dialogue Manager's Canvas > Sort Order to a higher value than the uMMORPG HUD, such as 9. If you want to hide the HUD entirely during conversations, add a Dialogue System Events component and configure OnConversationStart() to disable the uMMORPG Canvas and OnConversationEnd() to re-enable it.
- 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.)
Conversations
- Add a Dialogue System Trigger to the NPC, and set its Trigger to OnUse. Configure activity such as starting a conversation.
- Add a Talk_DialogueSystem component to the NPC. You can specify which Dialogue System Trigger(s) to use when talking to the NPC. If the list is empty, Talk_DialogueSystem will check all Dialogue System Triggers on the NPC.
- 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.
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.
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.
- Add a Combat_DialogueSystem component to the monster. Tick Dialogue System → Use Trigger On Death.
- 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. Add an Npc_DialogueSystem component if the NPC doesn't already have one. It has a Reward Authorization section. 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.
<< Third Party Integration