Ai Moveto cant find the target actor?

Ive been working on a project where the Hunter of HunterActor spawns in and scans the area for an apple from the AppleActor. The scanning works but for some reason my AI MoveTo doesnt
I wish to make the pawn Hunter go towards the Apple and collide with it. (Yes, I have put navmesh around the area for the AI to work)

Heres a picture of the AI MoveTo blueprint in the level blueprint:

Heres a picture of the Scanner blueprint in the HunterActor blueprint:

I don’t know if cast works. Alternatively you can drag and drop your apple actor into level blueprint.

It didnt work

Its only supposed to hunt the specific apple it finds first with its scanner

I also have to say that there are multiple apples and hunters in this projects spawning

Where do you set the Hunter?
(you cast to the cast but I can’t see where you set the variable)

I think you need this node

The hunter variable is an object reference to the hunter pawn
image

Where should I use this node?

in place of the cast to class node

but only if you have one of those hunter actors. the node will find the first in the scene. which may be not what you want

Unfortunately I need all of the hunters detections :sweat_smile:

there are currently only 3 hunters but since this is a sort of “evolution” project which means there will certaintly be more afterwards

well then find a way to keep track of them. if you spawn them at runtime create a list variable or similar and add them there. or, if you add them manually inside the scene then create a public list and drag the scene actors in that list so you know about them in the scene :slight_smile:

If the hunter spawns, I assume you use “spawn actor from class”?
Because from there you can possess the pawn (either player controller or ai controller) and set the variable to the possessed pawn. From there on, you can use the variable

Already tried this before, did not work sadly

I dont think this would be necessary since I am checking if a certain hunter detected a certain apple. I do sort of have a list where I know where every hunter spawns in coords but I dont really know how creating a list would detect these kind of things

casting is a heavy operation, doing it on tick in the level blueprint is not good. Since the hunter is the actor that will see the apple and then move, he can trigger the movement himself.

try this, when he sees an actor he checks if it has an apple Tag. if thats true the hunter gets the controller thats controlling him and triggers the movement to the seen actor, now that he confirmed its actually an apple.

if you dont know how to put tags in actors you can see this video

if you are using AI unreal has all sort of specialized components that are made to be used to detect stuff in the level.

so if you have a hunter that needs to detect an apple and then you need to know about it i think this can be done using the AI tools as those are made to avoid writing repeating tasks to check every frame if an apple was found or not.

1 Like

This one was close, They dont move but they do however find the apple due to the “actor has tag” giving out true:

Well I figured out how to get information of the apple but now the apple needs to be hunted by the Hunter. Ive found out that the AI MoveTo cant make the Hunter move.

I assume its something to do with the pawn itself or that it doesnt get the controller but idk :thinking:

for the MoveTo to work you need a character. Like the standard character that is included when you create a third person project. It has all the components required by the AI to move the character. Also you need navigation data in the level

How do I add that mannequin to my project?

I don’t know. Try creating a new project and then migrate the character from there