AI Character as Enemy (part1)

Change AI Speed (between roam & chase)


Open ninjaAI controller BP, add new nodes from Run Behavoir Tree node:
promote variable to create SET node
image.png

Go to Behavoir Tree, click New Service
Name as NPCSpeed, open this BP class, create node as follow:
Target node created by: Drag “As AI controller” arrow, then typed by NinjaBP /Character movement→ Get as Ninja BP/Character movement
change Max Walk speed variable to public
image.png

Go to ChasePlayer BP, add new variable, set as blackboard selector
Add new nodes between simple move to location and finish execute (tick success too):
image.png
Back to Behavior Tree, R click on Random Roam Sequence, add Service → choose NPCSpeed
Change its max walk speed to 100
image.png
Copy and paste the NPC speed to Chaseplayer side Sequence, this time change the max walk speed to 400

Go to Blackboard, add bool new key, name as KeepFollowingPlayer?
back to behavoir tree, choose ChasePlayer node, change New Var 0 to KeepFollowingPlayer?
image.png

Add newboard based conidition on Random Roam Sequence (R click, Add Decorator, Blackboard)
Change its condition in detail as follow:
image.png

P.S. If delete blackboard based condition on chastplayer side, enemy will keep running and chasing u even u are out of their sight, once they find you
image.png

Improve ninja animation between walk and run:


Go to ninja walk animaiton, change rate scale to 0.5
image.png

Go to blandspace 1D, drag walk keyframe from 200 to 100 in speed
image.png

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.