Logo
  • Assets
  • Contact
  • About
  • Forums
  • Login

Recommended approach for referencing DialogueActors

Forums › 💬 NodeCanvas › ⚙️ Support › Recommended approach for referencing DialogueActors

  • This topic has 0 replies, 2 voices, and was last updated 7 years, 12 months ago by Gavalakis.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • June 9, 2018 at 1:03 pm #17322
    denzil
    Participant

      Hi,

      I am busy learning how to use the Dialogue system, so I’ve set up a basic dialogue tree for generic interactions between the player and NPCs. Depending on the option the player chooses, the player might initiate trading or have the NPC follow them. At the end of each multi-choice option I just call a method in my code base, but the problem is I don’t know which NPC the dialogue was engaged with.

      Of course when I kicked off the dialogue, I replaced the placeholder NPC in my tree with the actual actor (since there can be many NPCs with the same sort of interaction). So when I kick off the interaction I simply look-up the actor by placeholder name. However, I feel like there should be a better approach. Is there a way I can pass in a reference to the function of the relevant actor being talked to? I could just add a string parameter to the function with the actor’s name to do a look-up on, but I’d perhaps like to have a dropdown list here of all actors so I don’t have to manually type the name, kind of like the DialogueActor list you get on every Dialogue node by default (but instead have it here as a function parameter).

      Any best practice tips regarding this?

      Thanks

      June 9, 2018 at 8:58 pm #17326
      Gavalakis
      Keymaster

        Hello,

        Hmm… Right now this is not possible since Dialogue Actor parameters are not treated the same way as variables do (which can be passed as a reference to a function parameter called with the Execute Function action).

        Being possible to do this, I can see being useful and thus I will take a look at this possibility. Thinking about this, I could add a “special” variable in the dropdown called “Self”, which will always reference the “agent” of the node (thus the actor selected) and would work similar to how “Self” works when selecting the target agent for a task.

        Let me know what you think.

        Thanks.

        June 10, 2018 at 3:11 pm #17325
        denzil
        Participant

          Well, there’s already “Self” on the execute function task which I can use to access the owner of the node (which corresponds to the dialogue actor associated with the node if I understand correctly). Well that’s exactly what you said in your last sentence, but how will this allow me to reference other actors involved in the dialogue? I’m new to all of this. Also not sure which dropdown list you are referring to. Whatever you think is best 🙂

          June 10, 2018 at 3:27 pm #17324
          denzil
          Participant

            I think a decent solution for me would be to set the agent my player is interacting with on the dialogue tree’s blackboard from code at the same point I am replacing the placeholder agent. Then I can just access that agent via the blackboard.

            June 14, 2018 at 2:35 pm #17323
            Gavalakis
            Keymaster

              Hello again,

              Indeed, one solution for you would be exactly what you suggest; to set and use a blackboard variable for the actor.
              You are also probably right about “self”. A better implementation, would be to be possible for the actors to show and be selected like variables do in the variable selection dropdown.
              [attachment file=”VariableSelectionDropdown.png”]

              Unfortunately though, actor parameters are not treated the same way and are not blackboard variables per-se (code architecture wise), since actor parameters are specific to Dialogue Trees, while Blackboard Variables are common in all graph systems.
              I would have to think of something else, but once again, your suggested solution is probably better until then 🙂

              Thanks!

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

            Footer Logo

            Home | Contact | Privacy Policy
            Twitter | Discord | YouTube
            Paradox Notion

            • Login
            • Register
            Forgot Password?
            Lost your password? Please enter your username or email address. You will receive a link to create a new password via email.
            body::-webkit-scrollbar { width: 7px; } body::-webkit-scrollbar-track { border-radius: 10px; background: #f0f0f0; } body::-webkit-scrollbar-thumb { border-radius: 50px; background: #dfdbdb }