AI NPC by Convai

Integrate Convai Action API in UE


(Optional) Part 1
In the "Convai Content" folder will be located under the "Engine" folder
Open Convai Plugin map,
open the Compansion BP, where introduce 3 action funcitons: pick up, drops, change colors
image.png

Part 2

In Metahuman BP, extend the event begin play node (from Transcription and Other Event tutorial), add Environment and Actions:
image.png

Add on action received
Optional, can jump this and go to create the graph with For Each loop
Following is for reference shows how the node works:
image.png
Set For each loop and graph as
image.png

Go to Meta Player BP (downloaded alternatively from a 5.1 demo project and migrate to my 5.2 project)
image.png
On the Space Bar node, set the start and finish talking under the environment graph as follow:
image.png
tick Plane View on the green node, and tick generative action in start talking node
contiunue:
image.png
continue:
image.png

Now Go back to metahuamn BP, modidy the description in Make Array (improve accuracy of AI undetstand)
image.png

(Optional, help to understand with print sting shown)
On Action to received node, extend the print string node
image.png
Test in game to see if it shows as:
name: player,
action: move to
whole action string: move to player
image.png

If it works, remove the strings components in BP and set implement the move to action:
P.S. : make sure the metahuman class setting, Parent class is at least Pawn, not actor
image.png
In Class defaults, BP Beryan, Pawn, AI Controller Class, set as AI Controller Convai
image.png

Go to Plugin folder, Convai Content, Core,
Open Convai Base Character BP:
image.png
Go to methauman BP, copy Floating Pawn movement components, paste in convaibasecharacter BP
(allow the convai character moves around the scene)
image.png
image.png
Copy the following 2 functions from Convai Base Character to metahuman BP (to let metahuman rotate to face the player when walking, and always stick on the ground)
image.png

Copy the follow nodes in event tick (except handle simple lipsync) in convai base character
image.png

Paste in metahuman node (event tick node will become customevent, just delete it)
Recreate Set Actor in focus variable (will have error after complie)
Remove Then 0 in remove execution pin from Sequence
image.png
Drag a NAV mesh bound volume in the scene

Test if the character walks over

Add more actions:
Go to metahuman BP, Make array, add:
image.png

Test by voice:
Hey, can u follow me?
See if he keeps following if players move
Can u stop following me, please?
See if he stops
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.