AI Moveto always goes to location instead of actor

Hello one and all. I’m currently trying to get an AI to move to a static Actor set as a variable. However, every time I try to run the game, the AI moves to the Location set by default instead of the actor. The actor variable has Instance Editable and Expose on Spawn set to true.

Make sure the Bench is reacheable by the ai actor, making it z value location the same as the ai actor might help. Check the output log for any warning as well.

Can you put a breakpoint on the move to node to make sure that the bench variable is correctly populated?

Thanks for the replay.
I’ve checked the output log and no error seem to appear. I’m also fairly confident that the AI can reach the bench.
image

Thanks for replying.
That seems to be the problem. When looking at the Goal Actor, it tells me that the Research Bench variable is Unknown. Not too sure where to go from here though.

Where do you set the value of ResearchBench?

It’s set in the Character Blueprint I use for the AI.

Is that when spawning the AI?
Basically the only way this can work is if you pass the Bench in the SpawnActor node when spawning your character

If you manually call Set after SpawnActor, it won’t work

Could you post a screenshot

I’m not too sure what you’re saying.
Both the AI and the bench are already in the scene when I start up the game. Should I spawn in the AI after starting the game?

If both are there on begin play, how do you set the value of ResearchBench on your AI? There are multiple ways to do it, and it all depends on your specific case

You can use a soft object pointer instead, which allows you to select a specific actor instance in a level, but will break if you rename it or if you use it on another level

You can perhaps use a GetActorOfClass to set the value of ResearchBench, which would take the first actor of the specified class that it finds in the level

You can search nearby using a Sphere Overlap Actors or an EQS query

But all of that needs to happen before you order the AI to Move

Well, I used GetActorOfClass and that seems to work! Thanks a lot!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.