Game setting

AI move randomly (Behavior tree)



Create a BP character called BP_NPC
image.png

Select the mesh and Anim class in details
Tick Use Controller Desired Rotation in BP component detail
image.png
Also unitck rotation yaw (only useful when use player controller)
image.png

R click, Blueprint class, All class, type AI controller, select. Name as AI(Controller)_NPC
image.png

Create Behavior Tree and Blackboard, called BT_NPC and BB_NPC
image.png

In AI(Controller) NPC event graph, add
image.png

In BP NPC, Select AI(Controller) NPC in AI Controller Class
Also, change auto possess AI to Place in world or spawned
image.png

Open the Anim BP used for NPC BP (case here is manny ABP), add follow (bottom 3) nodes
image.png

Open behavior tree, set bl;ackboard asset to BB BPC
Create tree as below
image.png
Click New Task at top menu, name as MoveToRandomLocation
image.png
Change Functions Overrid to Receive Execute AI
image.png
The relevant node is created, create a graph as below (gonna execute as in BP_NPC graph, but in behavior tree here)
Create varianle Radius, tick instance editable
image.png
Also promote variable on acceptabnce radius, tick instance editable
image.png
Continue (min and max variables are renamed and tick instance editable
image.png

Back to behavoir tree, add the follow node, in default can set all variables values
image.png
set radius 5000, acceptace 100, min idle and max idle depends

Set nav bound volume and NPC character in the scene

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.