NPC Leads Player to Destination, and stops if Player goes out or range.

NitinBan55

New member
Hi. I am trying to create a behavior wherein the NPC will Lead the Player to a location (a Transform point in game). The NPC will only lead if the Player is within its range. If the Player goes out or range, then the NPC will Rotate and look towards a specific Direction (defined by a Transform in the scene), and will Bark, that is say any random dialogue like:- "Come on lets go. We don't have much time." or something like that. And when the Player gets into range again, then NPC will resume to Lead the Player to Destination.

P.S: I am using Dialogue System Integration foe Behavior Designer to make the NPC Bark.

Problem:
1. Now the NPC goes to the point (Note: I was using the MoveTowards behacior), but sometimes goes without taking the Player, i.e, doesn't care about the Range, directly goes to the destination alone.
2. I got that working somehow (this time I am using the Seek beahvior), but next thing the NPC doesn't rotate to look towards the specified transform point/direction. I want the NPC to turn back, and stay Idle while barking a dialogue and wait for the Player to return.

Here is a reference to the Behavior Tree:
NPC Lead Beahvior .png
 
When Seek reaches the destination it is going to return success which will then end that branch. I see that you have a Repeater but the next time the branch runs Within Distance will likely also return success meaning you'll never get to the right branch. You'll need to restructure that branch, likely removing the Selector completely.
 
Top