Download

[AI MoveTo] AI won't move to player location when excecuted

I’m still very new to BP Visual Scripting and this so happens to be one of my first stand alone classes, it’s an AI class that handles things like Roaming, Chasing Players, Initiating combat, determine combat types, aggressiveness etc.
It’s apart of a RPG Minimum Viable product so there hasn’t been much streamlining done yet (almost exhausted my knowledge of programming so it’s going to stay like this for a while).

I’m actually having two problems, but I’m hoping they go hand in hand.

First as you can see in the video as soon as it senses a Pawn it looks away so I need to re-catch it’s sight.
Second is when I’m out of it’s AttackableRange it’s instructed to Sprint/Run/Walk to my location and get back into it’s AttackRange (Melee, Ranged, Magic distances) which it isn’t doing, even though the Ai MoveTo is being executed as you can see when I’m out of the attack range, but it doesn’t move my AI, it may be a problem with my Initiate Combat Graph.

I’ve been staring at the bloody thing for hours now and probably need some fresh eye’s and some more expertises.

Also, if you have any tips, I’ll happily take 'em

Youtube Video: https://www.youtube.com/watch?v=jFNPsbq5zmU&feature=youtu.be
On PawnSee: https://i.gyazo.com/ee226ae5dcca4822f3e67691c84dbbb5.png
InitializeCombat Event: https://i.gyazo.com/7a0a8f112b8608d3a0985ccdad0f709a.png - https://i.gyazo.com/2e448a0b1bd692993630ac717f4c0a54.png

Cheers guys,

Press “P” in editor and see if your level gets all green. If no green in level then add navigation volume.

PS.
I am fighting with EQS system I think I could get it right this time. If so (Ie. if it really works) I will share that template project here. But finalizing it can take day or two, its not easy.

2 Likes

Will love to look at a EQS system, but the AI in my game is just going to be your basic mob you find in any mmo, so stupid drones.

Nav mesh is there, just wondering if I have a left over AI MoveTo getting called more than once in my code, I’ll have to run some simulations to see, not looking forward to re-writing all of this if I’m wrong

Well, my next guess is that you calling it every tick with new order, that can stall AI.
That aimovto in OnPawn see destination always has [0,0,0] as destination.

Your graph is quite complicated, you should debug that step by step. And for that visual logger is best. Add visual logger text in critical points then open visual logger tab (it is in debug tools).
I suggest adding 3 visual logger nodes right before AiMoveTo. Are you sure they really are called? From my experience in cases like this there is some very silly mistake somewhere.
So you need to debug information flow step by step.

Also you could do linetrace (for debugging\visualising) from AI pawn to its move to destination. Then you can see if you send correct values over. Visual debug also has location and 3d box for that.

You have to provide a valid location to the move to node. Perhaps try ‘Simple move to Actor’ instead.

0aebfa49e60707a9bf8ad35bb797a62f.png

You’ll need your AI Controller and the actor you want to chase.

If you absolutely must use the nodes you’re using, you need to get the location of the actor you’re sensing. That’ll go to move destination.

b0d2835194081500838906da0acfaaa3.png

Or you can pass in the target actor here, as well. I’d guess the reason why the AI is not moving at all is because 0,0,0 is not a reachable location (either out of the Nav volume, or too high/low).

Beyond that, I’d highly recommend looking into behavior trees for AI.

EDIT: Nawrot beat me to it :stuck_out_tongue:

Yuhp, just noticed, set the target actor to my player char, which has gotten the code working as planned, still sometimes changes direction away from the player, but I’ll get around to that.

I knew after a sleep it would become more apparent, was just hoping there wasn’t a flaw in my logic as I wouldn’t know how to correct it.
But thank you so much for taking the time to help out :slight_smile:

Yuhp, watched a few of Mathews videos on behaviour tree’s, might need to look into it again because the only reason I took the BP approach is that it looked like BT was limited in functionality <- I’m now going to assume it’s more flexible than I think.
Also, can you use BT and BP’s together? like having BH handling player chase and BP handling roam? I know both of those can be done in BH, but I just needed an example :stuck_out_tongue:

The AI Suite is pretty capable, even if it doesn’t look it. You can trigger states in the BT from BP and call events in BP from the BT.

Decorators, Tasks, and Services are used to great effect.

I gotta head off now, but I can tell you more about them some other time. If you want, you can add me on Skype: korkuveren.

Cheers man, I’ll give Mathew Wadstein vids the once over and follow along with some of the Unreal Vids till I get a hang on things, I’ll add you if I have any questions, thanks a lot man

Behavior trees are quite powerfull and you can always make own service or tasks which are blueprints.
Then when you feel that you know behavior trees you can add EQS. Only probvlem is all that stuff lacks good tutorials, everything ends at very basic functionality.