Emerald AI Integration

Announcements, support questions, and discussion for Quest Machine.
parnell
Posts: 3
Joined: Wed Mar 02, 2022 7:29 pm

Emerald AI Integration

Post by parnell »

I have Quest Machine, Dialogue System, and Love/Hate.
Quest machine so far has been working great. Got working fetch quests, etc. All working solid.

I installed the integrated package for Emerald AI but once I setup a Quest Giver and then applied EmeraldAI setup the triggers to enter a quest no longer work. Is there a tutorial for how to setup Quest Machine to work with Emerald AI?
I'm mostly looking to make an NPC that wanders around and head tracks the player. Once you enter into the trigger they stop what they are doing and turn to face the player and if the player is in the trigger initialize the quest prompt. Upon completing the quest they could fire off an Emote animation from the Emerald AI Emotes too.

UPDATE:
Ok i dug in a bit more, and can see that most of these scripts need to happen on Quest Action. However, is there a way to have the AI stop moving on trigger enter event?
ie:
On trigger enter I was hoping to set him to stationary (currently set to dynamic) and have him rotate towards the player.
On trigger exit have the NPC then switch back to dynamic.

I did get emotes to play on quest action success so I am understanding that portion of the integration.

Any ideas?
Thanks
Brian
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Emerald AI Integration

Post by Tony Li »

Hi,

As you've seen, Quest Machine's Emerald AI integration provides actions to work with Emerald AI inside quests.

Turning to face the player is kind of out of scope for the integration. You could use a Dialogue System Trigger to rotate the NPC to face the player, start a conversation, and deactivate its AI during the conversation. Assuming you want to control Quest Machine through Dialogue System conversations like this integration tutorial series, you could set up the NPC something like:

emeraldAILookTalk.png
emeraldAILookTalk.png (50.4 KiB) Viewed 2187 times
parnell
Posts: 3
Joined: Wed Mar 02, 2022 7:29 pm

Re: Emerald AI Integration

Post by parnell »

Ahh kk. I'm happy I get figured out the Quest Action setup.
Hopefully, this won't be too tricky to set up the setting to stationary/dynamic stuff on our end then.
Thanks for the info and thanks for the awesome products!
Brian
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Emerald AI Integration

Post by Tony Li »

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

Re: Emerald AI Integration

Post by vectorfrog »

Hello,

I'm trying to accomplish something similar to this. I haven't followed any process yet for integrating E-AI and DS or Quest Machine as I'm still gathering requirements.

Basically, I have an NPC character set up as a Quest Giver. This NPC character also is an Emerald AI agent. I have this agent following a path. I want to be able to stop the agent while the player is engaged in getting the quest from them. I am not giving the quest through dialog, as of yet, Just a simple quest dialog, accept, yes/no type thing. Pretty basic.

I'd like the AI to stop following the path while engaged, and then resume when finished. I've tried a Dialog System Trigger, but I don't think I had it set up right, as it didn't work, but I think that might be because I didn't have an actual trigger on the the NPC.

Is this possible and if so, am I on the right track?

Thanks!
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Emerald AI Integration

Post by Tony Li »

To make an Emerald AI character stop, call its EmeraldAISystem component's Deactivate() method. To make it resume its pathfinding, call Activate().

The screenshot above shows how to do that with a Dialogue System conversation, which uses the Dialogue System's OnConversationStart and OnConversationEnd events.

Quest Machine, on the other hand, sends messages using the Pixel Crushers message system. When Quest Machine dialogue starts and ends, it sends the message "Pause Player" and "Unpause Player". You could configure your AIs to listen for these messages, such as:

pauseEmeraldAI.png
pauseEmeraldAI.png (71.42 KiB) Viewed 2133 times

Note: Since "Pause Player" and "Unpause Player" are sent globally, all AIs with this component setup will stop during dialogue -- which may actually be exactly what you want. If not, let me know and I'll describe how to manage a single AI.
vectorfrog
Posts: 86
Joined: Mon May 02, 2022 12:16 am

Re: Emerald AI Integration

Post by vectorfrog »

Hmm. I tried this and doesn't seem to be working. The quest dialog opens like it supposed to but the AI agent still follows the path and moves away from the player.


I'd like it to only affect the AI that I have configured and not the other AI agents when the player triggers the quest dialog.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Emerald AI Integration

Post by Tony Li »

Hi,

Looks like you'll also need to set NavMeshAgent.isStopped since Emerald AI doesn't stop its NavMeshAgent when deactivated.

Since you only want to affect the NPC that the player is speaking with, you can listen for the "Greeted" message. Continue to listen for the "Unpause Player" message to know when to resume the NPC's AI. You can wrap this into a subclass of QuestGiver. Here's an EmeraldAIQuestGiver script that I'll include in the next release of the Emerald AI Support package:

QM_EmeraldAIQuestGiver_2022-05-23a.unitypackage

If you replace your QuestGiver component with EmeraldAIQuestGiver, the NPC should stop while the player is talking to it.
vectorfrog
Posts: 86
Joined: Mon May 02, 2022 12:16 am

Re: Emerald AI Integration

Post by vectorfrog »

I replaced the normal Quest Giver component with this one, and it didn't stop, and also quit following the path. Looks like it lost all NavMesh abilities because it's not navigating around obstacles either.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Emerald AI Integration

Post by Tony Li »

You're getting there; at least it's stopping navigation during dialogue. Can you send a reproduction project to tony (at) pixelcrushers.com?
Post Reply