My AI don't want to move

Hello,

I don’t understand why my AI spawn but definitely don’t move.
All suggestions are welcome :slight_smile:

This is where spawn my AI and where should it move. (start in green and end in red)

This is my level blueprint

This my AI blueprint

Like you see, I have put in my IA blueprint the string “AI can’t move” when AI move to fail. When I play the game,
this string is displayed.

Thanks you for reading

Do you have a NavMesh? I see green but I can’t tell if that’s custom stuff. (https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/2/)

And by the way, it’s AI (Artificial Intelligence), not IA. :wink:

Ahah thanks you for this correction i will be more careful :slight_smile: Yes my Navmesh is in green on my path

Oh. I’m not sure about that loop in BeginPlay. Looping like that is confusing so I try to avoid it. It may work fine for all I know but how about we get you set up with a timer that ticks off once per second and does the spawn? Once I feel comfortable about that then I can look deeper. Or maybe someone else can verify that it’s fine.

To use a timer, you want to add a custom event, call it SpawnNewAI (or whatever you want). Then from BeginPlay, you want to use SetTimerByEvent, giving it the time period and setting Looping to true. Then connect the Event pin to your custom event.

Now, from your custom event, you can run your spawn code and it will happen once per whatever time period you gave it.

That will do what your loop is doing but it will do it in a better way.

OK I see the issue. When you call Spawn, it runs BeginPlay in the AI pawn before TargetPositionEnd is set. What you want to do is go into the AI pawn and make TargetPositionEnd public and set “ExposeOnSpawn” to true. Then refresh the spawn node (right click menu). TargetPositionEnd will show up in the spawn node. Plug the end location into that and you should be good.

I have do what you suggest me but i don’t understand your last reply. I have set TargetPositionEnd to “ExposeOnSpawn” and i think that it is public because private is not ticked… But The AI stillnot moving

Get rid of the SetTargetPositionEnd node. You don’t need that. If you set up Expose on Spawn correctly then click the down-arrow in the Spawn node and see if the pin is there. That is what you want to plug the end-location into.

But if i delete the setTargetPositionEnd node, I’ll not be able to tell where is the target at the end…

Sorry now i understand, i should see now the setTargetPositionEnd pin into the spawn node

Edit : It work ! Thanks you for your help :slight_smile: