[HOWTO] How To: Show uMMORPG CE Messages As Barks

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

[HOWTO] How To: Show uMMORPG CE Messages As Barks

Post by Tony Li »

This post explains how to show uMMORPG CE player messages as overhead barks.

Player messages are different from conversations with NPCs. If you're talking with an NPC, the dialogue UI will appear locally on your client. It shouldn't appear on all players' clients. (Although it's possible to do that with a bit of scripting.)

Player messages, on the other hand, are part of uMMORPG, not the Dialogue System. You can still use the Dialogue System to display the messages. I recommend using barks (tutorial). Barks normally also play locally, but you can modify uMMORPG to show it on other clients.

When the player enters some text in uMMORPG's chat window, uMMORPG will call one of the following methods on all relevant clients: PlayerChat.RpcMsgLocal(), TargetMsgParty(), or TargetMsgGuild(). If you want local chat messages to appear as barks:

1. Make sure your player prefabs have bark UIs.

2. Make the Dialogue System's code available to uMMORPG:
  • Import Plugins/Pixel Crushers/Dialogue System/Scripts/DialogueSystemAssemblyDefinitions.unitypackage.
  • Inspect uMMORPG/Script/uMMORPG.asmdef. Add DialogueSystem.asmdef to its Assembly Definition References.
3. Add these 3 lines to the end of RpcMsgLocal():

Code: Select all

        GameObject go = GameObject.Find(sender);
        Transform speaker = (go != null) ? go.transform : null;
        PixelCrushers.DialogueSystem.DialogueManager.BarkString(message, speaker);
4. Add this line to the OnSubmit() method:

Code: Select all

    else if (!text.StartsWith("/"))
    {
        // local chat is special: it has no command
        lastCommand = "";
        CmdMsgLocal(text);
        DialogueManager.BarkString(message, transform); // <--- THIS LINE
    }
Post Reply