How can I evoke narrative design trigger after specific event?

Original Discord Post by ___1576 | 2024-09-14 16:44:52

Hello, I am working on Narrative Design in Convai and trying to implement it in Unity. I want to evoke a trigger that activates when a specific ‘event’ occurs, not just when entering a certain space. However, I can’t figure out how to do this. How can I achieve this? I apologize if my writing is unclear, as I’m not very good at English. Thank you.

Reply by k3kalinix | 2024-09-14 16:49:06

Hello <@785917121926266892> :wave:t2:,

Reply by k3kalinix | 2024-09-14 16:49:14

Welcome to Convai Community!

Reply by k3kalinix | 2024-09-14 16:53:08

Which version of Convai are you using?

Reply by kagura4549 | 2024-09-14 16:54:03

Im sure documentation had somthing similar to the three types of triggers it talked about.
But if you arent able to work with that then u can use a similar solution i posted to my problem and u can alter it such that when that certain event occurs, there should be a prompt sent to the NPC and you can alter the narrative design part of the NPC from playground such that when that specific prompt is being recieved by the NPC, it should behave to however you want the NPC tobehave when that event occurs

My problem: Discord

Replying to k3kalinix’s Message

Reply by k3kalinix | 2024-09-14 16:53:08
Which version of Convai are you using?

Reply by ___1576 | 2024-09-14 16:57:41

How can I check which version it is? I’m still a beginner, sorry😥

Replying to kagura4549’s Message

Reply by kagura4549 | 2024-09-14 16:54:03
Im sure documentation had somthing similar to the three types of triggers it talked about.
But if you arent able to work with that then u can use a similar solution i posted to my problem and u can alter it such that when that certain event occurs, there should be a prompt sent to the NPC and you can alter the narrative design part of the NPC from playground such that when that specific prompt is being recieved by the NPC, it should behave to however you want the NPC tobehave when that event occurs

My problem: Discord

Reply by ___1576 | 2024-09-14 16:58:57

Oh, I will check it out. Thank you for letting me know!!

Replying to ___1576’s Message

Reply by ___1576 | 2024-09-14 16:57:41
How can I check which version it is? I’m still a beginner, sorry😥

Reply by k3kalinix | 2024-09-14 16:59:07

When did you download?

Reply by ___1576 | 2024-09-14 17:02:45

I’m not really sure, it was probably between July 10th and 20th, 2024

Reply by k3kalinix | 2024-09-14 17:04:22

if (TryGetComponent(out NarrativeDesignTrigger narrativeDesignTrigger))
  {
    narrativeDesignTrigger.InvokeSelectedTrigger();
  }

Reply by k3kalinix | 2024-09-14 17:04:27

Create a script

Reply by k3kalinix | 2024-09-14 17:04:37

And use this method.

Reply by k3kalinix | 2024-09-14 17:05:33

It is up to you to customize this.

The basic logic is to call the Invoke SelectedTrigger function of narrativeDesignTrigger when an event occurs.

Reply by ___1576 | 2024-09-14 17:08:07

Thank you. I want to evoke a trigger when a specific event occurs. In that case, should I add the method to the script of that event?

Reply by k3kalinix | 2024-09-14 17:14:13

Ok but don’t use trygetcomponent for your case

Reply by k3kalinix | 2024-09-14 17:18:33

[SerializeField] private NarrativeDesignTrigger _narrativeDesignTrigger;

private void YourFunction()
{
_narrativeDesignTrigger.InvokeSelectedTrigger();
}

Reply by ___1576 | 2024-09-14 17:23:53

I tried it as you suggested, but I encountered the following error.

“The type or namespace name ‘NarrativeDesignTrigger’ could not be found (are you missing a using directive or an assembly reference?)”

In fact, I had previously tried the same method because the Convai documentation provided a similar code, but I got the same error back then, which is why I ended up asking for help here :frowning_with_open_mouth: How can I resolve this?

Reply by k3kalinix | 2024-09-14 17:25:24

add this

Reply by k3kalinix | 2024-09-14 17:25:30

using Convai.Scripts.Runtime.Features;

Reply by ___1576 | 2024-09-14 17:27:37

The type or namespace name ‘Features’ does not exist in the namespace ‘Convai.Scripts.Runtime’ (are you missing an assembly reference?)

This time, this error has occured. I’m so sorry for asking so many questions.:disappointed_relieved: