Custom Player Character

Original Discord Post by catboiler | 2024-09-10 16:18:54

I’m looking to add ConvAI functionality to an existing project, that uses a third-person controller and existing NPCs. What do I need to add to the player character to make it compatible, and the same for the NPCs?

Reply by k3kalinix | 2024-09-10 16:23:01

Hello <@178079698574639104>,

Reply by k3kalinix | 2024-09-10 16:23:22

Which version of the Convai SDK are you using?

Reply by catboiler | 2024-09-10 16:25:28

Core Unity

Reply by k3kalinix | 2024-09-10 16:39:26

Version Number?

Reply by catboiler | 2024-09-10 16:44:11

Just checking now. I think it’s the most recent. Basically, I’m trying it out with an RPG Builder demo scene, so I’m seeing if I can attach it to the player character and NPC so that, rather than be given a quest, I can converse to get the quest. The player character is existing, as is the NPC, so I need to attach ConvAI scripts to each to get them to talk. That’s what I’m struggling with.

Reply by catboiler | 2024-09-10 16:44:39

The documentation is great about importing custom characters etc, but I can’t find the part about setting up a player character, or setting up an NPC

Reply by catboiler | 2024-09-10 16:45:56

3.1.0

Reply by k3kalinix | 2024-09-10 16:47:55

Okay,

Reply by k3kalinix | 2024-09-10 16:48:38

So for player add these components:

  • ConvaiNPCManager.cs
  • ConvaiGRPCAPI.cs
  • ConvaiPlayerDataHandler.cs

Reply by k3kalinix | 2024-09-10 16:49:38

For NPC:

  • Animator
  • ConvaiNPC.cs
  • A collider

Reply by catboiler | 2024-09-10 16:50:07

Damn, I was so close :slightly_smiling_face: I added those to the NPC, but only the PLayerDataHandler to the player

Reply by catboiler | 2024-09-10 16:50:14

Thanks dude :slightly_smiling_face:

Reply by k3kalinix | 2024-09-10 16:50:23

No worries.

Reply by k3kalinix | 2024-09-10 16:50:44

Let me know if you can’t.

Reply by catboiler | 2024-09-10 17:00:19

Hmm. it works when I put the NPCManager and GRPC API on the Main Camera, but, because it’s third-person, it won’t activate because the camera is far away. When I put them on the player itself, it doesn’t work at all.

Reply by catboiler | 2024-09-10 17:09:09

Sort of got it working :slightly_smiling_face: On the camera, moved the camera closer and increased the range.

Reply by catboiler | 2024-09-10 17:09:16

Thanks for your help :slightly_smiling_face:

Reply by k3kalinix | 2024-09-10 17:10:25

Images:

Reply by k3kalinix | 2024-09-10 17:10:48

You can increase these values.