Player starting dialogue issues

Hi,
I was going thru the RPG Dialogue and Quest course and wanted at least some of my Dialogues to start by Player saying something f.eg.

Player - Hello
Blacksmith - huh, what do you want?
ect.

Now its not possible.
Simply if you tag a root node as isPlayerSpeaking = true it will be ignored.

  • Conversant name will be set up to “Blacksmith”.
  • Our dialogue text will be considered as “AI text”.

Was trying to change it via PlayerConversant.cs

public void StartDialogue(AIConversant newConversant, Dialogue newDialogue)
        {
            currentConversant = newConversant;
            currentDialogue = newDialogue;
            currentNode = currentDialogue.GetRootNode();
            TriggerEnterAction();

            //isChoseing = currentDialogue.GetRootNode().IsPlayerSpeaking();

            onConversationUpdated();

        }

but it fails on many other levels basicly:

  • we get conversant name fixed
  • we lose our dialogue text
  • we lose Next button
  1. Can you, please suggest some solution?
  2. Is it possible to have multiple “root nodes”?
    So the Player would have a choice how to start conversation?

Thanks.

It is possible to have multiple root nodes, though you might need to jigger the DrawLinkButtons() code a bit to make it happen. I accomplished this by creating a child node, and then unlinking that node, leaving it as an orphan node.
To get the collection of “root” nodes, change GetRootNode to GetRootNodes() and run conditions on them.
For what you’re looking to do, however, this is overkill, as there is a much simpler solution. Keep the root node as the speaker, but give him no dialogue, or perhaps a line like “The blacksmith doesn’t seem to notice you”. Then you can put the multiple player choices on the next level, still leaving the player “initiating” the conversation.

Thanks, Brian,

after sleeping with the problem I came up with (in my opinion) an even better solution:

For PlayerConversant.cs:

     public string GetCurrentConversantName()
    {
        if (isChoseing || currentNode.IsPlayerSpeaking())
        {
            return playerName;
        }

        else if (currentNode.GetNarrator() != "") return currentNode.GetNarrator();

        else
        {
            return currentConversant.GetName();
        }
    }

For DialogueNode.cs

    [SerializeField]
    private String narrator;

    public String GetNarrator()
    {
        return narrator;
    }

This way we can define a speaker f.eg. The narrator for a given node. Even if it’s the RootNode.
So that for the words: Blacksmith seems to have not noticed you - speaker will be labeled as Narrator or whoever we specify.

PS. The ItemEditor tutorial was a BLAST!

This is a fantastic idea! Well done!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms