Page 1 of 1

Dialogue system leading to AI combat

Posted: Thu Oct 13, 2022 9:55 am
by myles.mackey
Hi

Does anyone know how I can use the dialogue system that then leads to the AI either becoming hostile or friendly depending on the choices selected?

I have the Invector AI system as well as the dialogue system, Quest Machine and Love/ Hate just as a FYI.

Thanks
Myles

Re: Dialogue system leading to AI combat

Posted: Thu Oct 13, 2022 11:02 am
by Tony Li
Hi,

We don't have an official Invector FSM AI integration, but the Dialogue System has lots of ways to trigger activity in other systems such as this. Here are some ways you could do it:
  • During the course of the conversation, set a Dialogue System variable (e.g., "Turn_Adam_Hostile" = true). Add another Dialogue System Trigger to your NPC (e.g., "Adam"), and set its Trigger dropdown to OnConversationEnd. Set its Conditions to require that "Turn_Adam_Hostile" is true, and select Add Action > OnExecute() UnityEvent to configure a UnityEvent to make the AI hostile.
  • If the AI script (which we're not familiar with) has methods such as SetHostile() and SetFriendly(), you can use the SendMessage() sequencer command in a dialogue entry. Example:

    Code: Select all

    SendMessage(SetHostile, , Adam)
  • You can also write C# methods to control the AI's state and register them with Lua so you can use them in dialogue entry nodes' Script fields.
If you have questions about any of these approaches, please let me know.

Re: Dialogue system leading to AI combat

Posted: Thu Oct 13, 2022 12:39 pm
by myles.mackey
Thank you, this is really useful to know and for getting back to me.

its greatly appreciated.

I did actually find an alternative, although I expect I may need to change it later if it causes to many issues.

I created two Identical characters and then created a variable for the conversation pathway.

If one was selected, I turned one game object off and turned the other one on.

It works but it does have a few issues, for example if I want to turn them back to being friendly and then not being in the same location.

So, I may need to come back to you for clarification at a later date, as its a much better solution.

Re: Dialogue system leading to AI combat

Posted: Thu Oct 13, 2022 12:56 pm
by Tony Li
If you have two separate FSM components (one for friendly, one for hostile), you could use the SetEnabled() sequencer command to enable one and disable the other.

Re: Dialogue system leading to AI combat

Posted: Thu Oct 13, 2022 3:17 pm
by myles.mackey
That is actually a really good Idea.

I will have a look in to that option.

Thanks

Re: Dialogue system leading to AI combat

Posted: Thu Oct 13, 2022 9:39 pm
by Tony Li
Glad to help. If that doesn't work (since I'm not familiar with Invector's AI), let me know and we can dig into it further.