How do I get my dialog to use my player's blackboard?

Forums 💬 NodeCanvas 🗨️ General Discussion How do I get my dialog to use my player's blackboard?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #13448
    toreth
    Participant

      I have a Dialogue Tree with a Condition Task in it, but I’m unable to get my Condition Task to use my actor’s blackboard.

      I’m dynamically loading my Dialogue Tree in an action right before I start the dialog, like this:

      var dialogTreeController = Object.FindObjectOfType<DialogueTreeController>();

      dialogTreeController.behaviour = player.dialogTree;

      The dialog works, but it’s not using the blackboard values from my player.  I attached a picture of my dialogue.  Even though I have a blackboard parameter named dialogValue that is equal to 4 on my player, the dialog always says that my value is not equal to 4.

      How do I get my dialog to use my player’s blackboard?

      #13452
      Gavalakis
      Keymaster

        Hello,

        Dialogue Trees uses a local blackboard for variables, which is stored alongside with the graph, and not any blackboard component attached on a gameobject. I am a bit uncertain about your setup (you forgot the image 🙂 ).

        Can you please share more details (and the image) about your setup and what you want to achieve?

        Thanks!

        #13451
        toreth
        Participant

          Sorry I forgot the image.  Here’s the image.

          [attachment file=”Capture.PNG”]

          I want to select choices in the dialog based on the state of my game.  Here are two scenarios:

          • If the player has already gone through the tutorial — which is stored in a global flag somewhere in the game — then I want an NPC to say “welcome back”.  If the player hasn’t already gone through the tutorial, then I want the NPC to say “do you want me to explain”.  Since that branch will happen within a dialogue, I need the dialogue to be able to get data from the overall game, and not just its own local variables.
          • I am calling a dialogue in a “start dialogue action” from an FSM on an NPC.  Part of the FSM is to move the agent between two points, and then open the dialogue with the player.  If the agent’s most recent move was to move to point A, I want him to say “I’m at the first place”.  If the agent’s most recent action was to move to point B, I want him to say “I’m at the second place”.

           

          #13450
          Gavalakis
          Keymaster

            Hello and very sorry for the late reply due to Eastern!

            Thanks for the information. If the game state is stored in some static variable (field or property), then I would suggest creating local dialogue tree variables and binding those variables to those properties respectively. Binding variables, is a very poweful feature that lets you communicate data between any graph and you own code.

            So for example, you could have a static property stored in one of your own code somewhere like “IsTutorialDone”. Then you can create a dialogue tree blackboard boolean variable and bind that variable to that specific static property.

            Here is the relevant documentation for data binding variables and for your convenience. [LINK].

            Also please remember, that in order for your own class to appear in the menus, you will need to first add that class in the Preferred Types Editor.

            Another solution if for some reason data bound variables is not adequate, would be to use Global Scene Blackboards (Tools/ParadoxNotion/NodeCanvas/Create/Global Scene Blackboard). Global Scene Blackboard variables, can be seen by any graph, but I do believe that data binding variables is more powerfull since they can directly communicate with your own code.

             

            Please let me know if that works for you.

            Thanks!

            #13449
            toreth
            Participant

              Thanks for the response.  I see how to do it now.

            Viewing 5 posts - 1 through 5 (of 5 total)
            • You must be logged in to reply to this topic.