So I am failing to wrap my head around how to properly use Sequences and Selectors properly and hoping someone can shed some light on how to do what i want to do to aid me in learning.
I have two services right now that work, one gets a random location on the NavMesh and sets a Blackboard TargetLocation, the other does a Multi sphere trace looking for a particular pawn with a specific tag. Both of these work.
What i want to happen is for the AI to get a random location, then move to that location. While it is moving i want it to be running the Multi sphere trace check and if it finds something to cancel its movement to the random location and move to the new target location.
I have gotten my AI to randomly wander to targets, and to find the object but not at the same time…i tried Parallel nodes with no real success.
You just need to think about what states you need. Inside these “States” you can do what you want.
Let’s say you have these States:
SearchWaypoint
WalkToWaypoint
FollowEnemy
AttackEnemy
So in “SearchWaypoint” you do your random waypoint thingy. If you found a waypoint, you switch to “WalkToWaypoint”. In this state, you call the MoveTo function and the multispheretrace. If he reaches his Waypoint, you go back to “SearchWaypoint”. If he finds the enemy, you go to “FollowEnemy” and if he is near enough, you go to “AttackEnemy”.
Maybe add a State with “SearchForEnemy” if he looses sight, or directly go to “WalkToWaypoint” if you want to keep moving to your last Waypoint, or “SeachWaypoint” when you want a new Waypoint.
That is the basic thing. I can’t show you Blueprints by now, but as long as you put all your Trace and Run Logic in ths “WalkToWaypoint” State, it should work like a charm.
This tutorial pretty much covers what you want - I just finished putting it together so I hope it helps!
You may want to skip back to the very beginning of the series where I go over basics of behaviour trees, and how the UE4 ones differ. Also just explain the basics of the UE4 AI set up.