Dialog System Interactable and Opsive controller

Announcements, support questions, and discussion for the Dialogue System.
vectorfrog
Posts: 86
Joined: Mon May 02, 2022 12:16 am

Dialog System Interactable and Opsive controller

Post by vectorfrog »

Hi, I have another question that I'm hoping you might have an answer for. I am using the Dialog System with the Opsive TPC, as well as Behavior Designer. I have an NPC setup with the TPC, and a behavior with Behavior Designer. I am trying to make this NPC interactable through the Dialog system as well.

What I have done is:

Installed the integrations package.
added the Converse ability to my player character
added the Dialog System Trigger Interactable Target component on the NPC character
added the Interactable component to the Capsule Collider child object of the NPC.

I also have a Selector component on my player character.

The Selector is not showing up when I move my crosshair/cursor over the NPC. I can trigger the conversation with the Interact ability since I have that set to OnUse in the Interactable Target component when I'm close enough, but nothing showing up saying I can interact with the NPC.

What am I missing? I have other NPC characters in the scene that do not use the Opsive TPC and the Selector works perfectly for them.
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialog System Interactable and Opsive controller

Post by Tony Li »

Hi,

The Dialogue System Trigger Interactable Target component and Interact ability are part of Opsive's interaction system. When you're using Opsive's interaction system, you don't need to use a Selector.

Inspect your Interact ability, and set the Ability Text or icon. This way you'll know when Opsive's interaction system has detected an interactable target.

You may also need to slide your Converse and Interact abilities higher in the Abilities list so they're not overridden by higher abilities.
vectorfrog
Posts: 86
Joined: Mon May 02, 2022 12:16 am

Re: Dialog System Interactable and Opsive controller

Post by vectorfrog »

Is there no way to have the Selector from the Dialog System to show up? I like that much better than the icon or text option and it'll stay consistent with what I have for other NPC's. The idea is have all NPC's controlled by behaviors and the TPC in some way and then also have the dialog system available for world building.
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialog System Interactable and Opsive controller

Post by Tony Li »

Hi,

Sure, if you want to use the Selector, then just set up a regular Dialogue System Trigger on your Opsive NPC. Add a Usable component, and a collider on a layer that the Selector can detect.
vectorfrog
Posts: 86
Joined: Mon May 02, 2022 12:16 am

Re: Dialog System Interactable and Opsive controller

Post by vectorfrog »

Ok, that works and I've got the Selector showing up. I'd like to be able to control the behavior depending on the dialog, is this still possible while not using the Opsive interact system?

For example I would like the NPC to be in a somewhat neutral position in the beginning of the conversation, and then depending on the responses of the player, the NPC gets angry and the behavior changes based on this, eventually becoming hostile, or depending on the outcome of a quest or current status of a quest, etc.
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialog System Interactable and Opsive controller

Post by Tony Li »

You can do that. Some options:

1. Add a Dialogue System Events component to the NPC. Configure its OnConversationStart() event to tell the behavior tree to enter a neutral position. Configure OnConversationEnd() to return to whatever it was doing before, such as patrolling.

2. Or add 2 Dialogue System Triggers -- one set to OnConversationStart and another set to OnConversationEnd -- and use their Actions section to do the same as #1 above.

Options #1 and #2 are best when you just need to put the NPC in an idle start during conversations and then release it to move around at the end of conversations.

3. Or control it within the conversation itself. Since you mentioned changing the NPC's activity based on responses, this is probably the best option. You could define some variables in your behavior tree, such as an angerLevel variable. When the player chooses responses that make the NPC angry, use Lua functions such as bdSetInt() to increment the angerLevel variable. (See Behavior Designer integration for details on Lua functions.)
vectorfrog
Posts: 86
Joined: Mon May 02, 2022 12:16 am

Re: Dialog System Interactable and Opsive controller

Post by vectorfrog »

Once again, perfect. I will play around with these ideas and see what I can get to work for what I'm doing. Thanks for making such a valuable asset. I really appreciate the help also.
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialog System Interactable and Opsive controller

Post by Tony Li »

Happy to help!
vectorfrog
Posts: 86
Joined: Mon May 02, 2022 12:16 am

Re: Dialog System Interactable and Opsive controller

Post by vectorfrog »

Since there is no Quest Machine/Behavior Designer integration, how can I get the status of a quest in BD? I have QM and DS integrated, and see that there are ways of getting various information from the DS quests, but nothing for Quest Machine. As usual, what am I missing?

I'm trying to have the NPC do one kind of behavior while a quest is in a certain state, and behave differently if the quest is in another certain state.
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialog System Interactable and Opsive controller

Post by Tony Li »

Quest Machine's Dialogue System integration has a "QM To DS" utility window that creates stubs in your dialogue database for your Quest Machine quests. Use this utility and also add a DialogueSystemQuestMachineBridge component on your Dialogue Manager GameObject. Then you can use the regular DS integration tasks to check and set quest states. If you need to check a quest node state, use a Run Lua task to run a GetQuestNodeState() Lua function and store the result in a DS variable, and then use a Get Dialogue Variable task to check that variable value.
Post Reply