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

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?

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

Hello <@1122792808181420033>,

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

You can use something like this

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

cc: <@&1163218322200989806>

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?

Reply by golden_possum_87097 | 2024-07-01 01:34:06

<@1023671043287699568>

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

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

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

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

Images:

Reply by golden_possum_87097 | 2024-07-04 08:24:07

Yes, It’s work. Thanks.

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

Glad we could be helpful