• News

• Industries

• Learning & Support

• Community

• Marketplace

# Looking for Better Way to Store Locations//Move NPC to Multiple Locations

Howdy there!

I’m currently learning to work with Behavior Trees and Blackboards and I need a little help with optimizing what I have.

What’s going on is I’m trying to get an NPC Character to search for the Player Character after losing sight of the Player (which is done through a Line Trace) at points of interest. Currently I have it setup where once the NPC Character shoots the Line Trace and doesn’t detect the Player Character—>the NPC Character will then trigger a Bool variable called E-Mode to True which will then trigger another Bool variable called TargetPoint1 to True which will make the NPC Character move to the first point of interest. Once the NPC Character reaches the first point of interest, then it triggers a Bool variable called TargetPoint2 to True and TargetPoint1 to False which then makes the NPC Character move to the second point of interest.

Although this system works, if I end up having say…100 different points of interesting then I end up having 100 different behaviors and variables (not saying I will haha). Is there a better way to get the NPC Character to move to multiple locations or better way to store the locations and call them in one Blueprint? I’ve included screenshots of what I’m working with.

EDIT: I’ve tried to use Arrays but I can’t seem to get those to work properly so let me know if that’s one way to do it then I’ll study up on that!

&stc=1

&stc=1

&stc=1

Well today I’ve came up with a better solution but still feels clunky and unnecessary. Within the E-Mode Behavior Task I created a function that sets three points of interest using ‘Set Blackboard Key as Vector’ which draws from an Array of predetermined locations. From there I’ve set up the Behavior Tree to walk to Point of Interest #1, then repeat with #2 and so on after a 5 second Wait timer in the Behavior Tree (#3 isn’t included because I didn’t feel like it at the time lol).

I’m still open to suggestions

(Attachment of Blueprints are included)