Download

Behaviour Tree Advice.

Hi,

I am wondering if anyone can explain to me whats wrong with this tree?

Here goes : My AI does not move anywhere but the Index stops at 4 (There is 4 patrol points) so I know its getting the length of the vector array but this EnemyAIGetPatrolVector instantly goes to move to and then ENemyAIGetNextPatrolIndex instantly runs, There is no stopping whilst the NPC performs the “MoveTo”, Any ideas why please?

EnemyAIGetPatrolVector : EnemyAIGetPatrolVector > BlueprintUE.com | PasteBin For Unreal Engine 4

Move To :

EnemyAIGetNextPatrolVector : EnemyAIGetNextPatrolIndex > BlueprintUE.com | PasteBin For Unreal Engine 4

I thought it would "pause before moving to the next one in the sequence with the move to command but it seems to run almost instantly.

I managed to get it to move the 1st vector location but then this has printed out before it even reaches the 1st point.

Many Thanks for anyone who responds!

Hello!
For AI Patrol I use a simple, easy to expand, easy to debug way that work very well for me :

  • Make a TArray of AActor named “PatrolRoute” on The BotPawn (Fill the array on placed Pawn or at runtime on spawned Pawn with any AActor). This will be the patrol route.
  • Make a Blackboard variable of type Object->Actor named “PatrolRouteActor”
  • Make ABlackboard variable of type integer named “PatrolIndex”
  • Make a BTTask “ChoosePatrolPoint” to cycle through the array “PatrolRoute” (See below)

Sequence->ChoosePatrolPoint->MoveTo: “PatrolRouteActor”->Wait
voila.

BTTask ChoosePatrolPoint : [Edit] Forgot to say, don’t use “GetComponentByClass”, just Cast to Your BotPawn and get the Array