# How to implement if you need NPC to read a text sent to him

**URL:** https://forum.convai.com/t/how-to-implement-if-you-need-npc-to-read-a-text-sent-to-him/1136
**Category:** Unity SDK
**Tags:** question, unity
**Created:** [June 28, 2024, 8:40am UTC](https://forum.convai.com/t/how-to-implement-if-you-need-npc-to-read-a-text-sent-to-him/1136 "2024-06-28T08:40:17Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![K3](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.convai.com/k3/32/2611_2.png) [@K3](https://forum.convai.com/u/K3)
#### Post date: [June 28, 2024, 8:40am UTC](https://forum.convai.com/t/how-to-implement-if-you-need-npc-to-read-a-text-sent-to-him/1136/1 "2024-06-28T08:40:17Z")

</div>

**Original Discord Post by golden\_possum\_87097 | 2024-06-28 08:40:17**

Hi, How to implement if you need NPC to read a text sent to him? For example, after the player goes online, NPC will tell the player how much money his mine earned for him during the time he was offline.  
I find this function: [public async void TriggerEvent(string triggerName, string triggerMessage = “”)]. And How to use this triggerMessage in Narrative Design?

---

<div class="post-metadata">

### Author: ![K3](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.convai.com/k3/32/2611_2.png) [@K3](https://forum.convai.com/u/K3)
#### Post date: [June 28, 2024, 12:16pm UTC](https://forum.convai.com/t/how-to-implement-if-you-need-npc-to-read-a-text-sent-to-him/1136/2 "2024-06-28T12:16:59Z")

</div>

**Reply by k3kalinix | 2024-06-28 12:16:59**

Hello \<@1122792808181420033\>,

---

<div class="post-metadata">

### Author: ![K3](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.convai.com/k3/32/2611_2.png) [@K3](https://forum.convai.com/u/K3)
#### Post date: [June 28, 2024, 12:18pm UTC](https://forum.convai.com/t/how-to-implement-if-you-need-npc-to-read-a-text-sent-to-him/1136/3 "2024-06-28T12:18:58Z")

</div>

**Reply by k3kalinix | 2024-06-28 12:18:58**

You can use something like this

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

```

cc: \<@&1163218322200989806\>

---

<div class="post-metadata">

### Author: ![K3](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.convai.com/k3/32/2611_2.png) [@K3](https://forum.convai.com/u/K3)
#### Post date: [June 29, 2024, 1:48am UTC](https://forum.convai.com/t/how-to-implement-if-you-need-npc-to-read-a-text-sent-to-him/1136/4 "2024-06-29T01:48:46Z")

</div>

**Reply by golden\_possum\_87097 | 2024-06-29 01:48:46**

Let me repeat the requirement with an example. I want the NPC to read a piece of news. I use triggerMessage to send the news to the NPC. Then how can the NPC read the news?

---

<div class="post-metadata">

### Author: ![K3](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.convai.com/k3/32/2611_2.png) [@K3](https://forum.convai.com/u/K3)
#### Post date: [July 1, 2024, 1:34am UTC](https://forum.convai.com/t/how-to-implement-if-you-need-npc-to-read-a-text-sent-to-him/1136/5 "2024-07-01T01:34:06Z")

</div>

**Reply by golden\_possum\_87097 | 2024-07-01 01:34:06**

\<@1023671043287699568\>

---

<div class="post-metadata">

### Author: ![K3](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.convai.com/k3/32/2611_2.png) [@K3](https://forum.convai.com/u/K3)
#### Post date: [July 2, 2024, 10:24pm UTC](https://forum.convai.com/t/how-to-implement-if-you-need-npc-to-read-a-text-sent-to-him/1136/6 "2024-07-02T22:24:09Z")

</div>

**Reply by k3kalinix | 2024-07-02 22:24:09**

When you Invoke Trigger.  
It should. \<@1122792808181420033\>

---

<div class="post-metadata">

### Author: ![K3](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.convai.com/k3/32/2611_2.png) [@K3](https://forum.convai.com/u/K3)
#### Post date: [July 4, 2024, 8:18am UTC](https://forum.convai.com/t/how-to-implement-if-you-need-npc-to-read-a-text-sent-to-him/1136/7 "2024-07-04T08:18:52Z")

</div>

**Reply by raghuvanshagarwal | 2024-07-04 08:18:52**

Hi \<@1122792808181420033\> you can modify the InvokeSelectedTrigger like the image provided below, after that as \<@1023671043287699568\> suggested you can call this function when you want and pass the message

Hope this answers your query

---

<div class="post-metadata">

### Author: ![K3](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.convai.com/k3/32/2611_2.png) [@K3](https://forum.convai.com/u/K3)
#### Post date: [July 4, 2024, 8:19am UTC](https://forum.convai.com/t/how-to-implement-if-you-need-npc-to-read-a-text-sent-to-him/1136/8 "2024-07-04T08:19:32Z")

</div>

**Reply by raghuvanshagarwal | 2024-07-04 08:19:32**

**Images:**

 ![image.png](https://canada1.discourse-cdn.com/flex004/uploads/convai/original/2X/4/4245acae605e44260ed85dfb95dadbfdf588b24f.png)

---

<div class="post-metadata">

### Author: ![K3](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.convai.com/k3/32/2611_2.png) [@K3](https://forum.convai.com/u/K3)
#### Post date: [July 4, 2024, 8:24am UTC](https://forum.convai.com/t/how-to-implement-if-you-need-npc-to-read-a-text-sent-to-him/1136/9 "2024-07-04T08:24:07Z")

</div>

**Reply by golden\_possum\_87097 | 2024-07-04 08:24:07**

Yes, It’s work. Thanks.

---

<div class="post-metadata">

### Author: ![K3](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.convai.com/k3/32/2611_2.png) [@K3](https://forum.convai.com/u/K3)
#### Post date: [July 4, 2024, 8:24am UTC](https://forum.convai.com/t/how-to-implement-if-you-need-npc-to-read-a-text-sent-to-him/1136/10 "2024-07-04T08:24:28Z")

</div>

**Reply by raghuvanshagarwal | 2024-07-04 08:24:28**

Glad we could be helpful

---

<div class="post-metadata">

### Author: ![K3](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.convai.com/k3/32/2611_2.png) [@K3](https://forum.convai.com/u/K3)
#### Post date: [November 25, 2024, 12:15pm UTC](https://forum.convai.com/t/how-to-implement-if-you-need-npc-to-read-a-text-sent-to-him/1136/11 "2024-11-25T12:15:03Z")

</div>

This conversation happened on the Convai Discord Server, so this post will be closed.
