Original Discord Post by kagura4549 | 2024-09-12 22:39:53
So i have a prompt saved in a .txt file in my computer, any idea how do i make the NPC get that prompt. I am using unity so any help on any form of C# script or anything will work. TIA
Original Discord Post by kagura4549 | 2024-09-12 22:39:53
So i have a prompt saved in a .txt file in my computer, any idea how do i make the NPC get that prompt. I am using unity so any help on any form of C# script or anything will work. TIA
Reply by tyke_18 | 2024-09-13 05:26:56
K3 will be along to answer you properly, in the meantime can I point you to this support question where I asked something quite similar Discord in addition to that you’ll also need to get the prompt from your text file using IO C# code (you’ll do that before integrating what is at that link I gave) then pass what’s in your text file as a variable to your character to speak it using Narrative Design Template Keys (if you want it to speak it). Basically, learn the basics on how to use Narrative Design for your character as this is what you will need to do on the Convai side, learn about file access read/write in Unity C#, then do what’s at that link
Reply by kagura4549 | 2024-09-13 08:23:20
I already know how to write IO C# code
i even read the link you sent before i posted this
i am not quite sure how do i integrate what is at the link into my own code
Reply by k3kalinix | 2024-09-13 10:35:14
Embedded Content:
Character API | API Docs
All the relevant APIs needed to create your own intelligent AI characters with Convai.
Link: Character Base API | Documentation
Reply by kagura4549 | 2024-09-14 15:38:51
This is solved. Not through the link which <@1023671043287699568> gave me, but <@433610960725344267> guided me.
Reply by k3kalinix | 2024-09-14 15:40:09
Please share the solution for future questions.
Reply by k3kalinix | 2024-09-14 15:41:22
<@689150981748949061>
Reply by kagura4549 | 2024-09-14 15:43:07
I am facing another problem right now, can i get your help?
in the meanwhile i am posting the solution
Reply by k3kalinix | 2024-09-14 15:43:37
Create a new post for other question.
Replying to k3kalinix’s Message
Reply by k3kalinix | 2024-09-14 15:43:37
Create a new post for other question.
Reply by kagura4549 | 2024-09-14 15:45:26
Discord pls help here
Just give me a while i will be posting the solution to this problem
Reply by kagura4549 | 2024-09-14 16:18:54
Solution:
ConvaiNPC
tab then click Add Components
, check the NPC Design Manager
and then click on Apply Changes
Narrative Design Manager (Script)
and then click on Check for Updates
.+
sign on the On Section Start
None (Object)
part of itNo Function
drop down box, hover to the name of your script then click on the saySomething()
option. (You can name the function however you like in the script and then select that function from this)using UnityEngine;
using System.IO;
using Convai.Scripts.Utils;
public class triggerScriptSimple : MonoBehaviour
{
private string data;
// Start is called before the first frame update
public void Start()
{
}
// Update is called once per frame
public void Update()
{
}
public void saySomething()
{
// Read the text from the .txt file and save it in the data variable
data = File.ReadAllText("Path/To/Your/TextFile.txt");
ConvaiNPCManager.Instance.activeConvaiNPC.SendTextDataAsync(data);
}
}
Reply by kagura4549 | 2024-09-14 21:52:55
<@1023671043287699568> please mark this as completed
This conversation happened on the Convai Discord Server, so this post will be closed.