How to move a ennemi on a target point

Hi, I have tried to do something to do that but the ennemi don’t move. In my Blueprint Scripting there are the input “controller” that i don’t understand. So I have put something that I think good '^^

Is your enemy a pawn or character? Otherwise it wont have a controller

If your mesh is a pawn you should use “AI move to node” in the levelBP.

If you want to keep it in the AIBP you’ll have to get the target point ref.

My enemy is a static Mesh Actor, if i leave “controller” without link, it tell me that ennemi is not a AIcontroller…

And if my mesh is not a pawn how should ido ? :confused:

Only the simplest of enemies can really not be pwns. If you want any type of complex movement then you want to be using at least a pawn if not a character. Also if your uaing a blueprint then your enemy would be a actor which contains a mesh component

did you add a navmesh volume in your scene?

Ok, thanks you. So i have set my ennemy like a pawn and i have do this in my level blueprint but it don’t want to go on the TargetPoint 2 it don’t move

Sorry but i don’t know what is that … I don’t have it in my scene. Why ? It can be a problem ?

No, this allow AI to navigate in your scene, search it in the volumes panel of the place mode, add it in your scene and size it as you want, then it should work.

Don’t work, i think that the problem is elsewhere but thanks to trying to help me

alright this is how i would make a basic pawn enemy move. to start create a pawn, then add a mesh and a movement component. next we are going to make the script for moving in the event graph. its best to do the script on the enemy blueprint rather than in a separate blueprint because its much easier to control this way and will lead to much better results when adding many enemies to the scene. for the example pictured below i used a floating pawn movement and i scripted the movement to patrol between actors in a array.

ok so to start i right clicked and searched for custom event and named it move to target. next i created a AImoveto node. this move to node will actually accomplish all of the movement for us, we just need to make it trigger and give a location. so in this case i wanted to have multiple targets to move to so i created a array variable (TargetLocation) and set its type to actor. i also created a regular variable of the int type(TargetToGet). i dragged the array var into the graph and selected get, i did the same with the int var. then i dragged off the array for a get node. this will get a actor from the array at the position/index we tell it to. to define the index i used the other variable which will allow me to get a different actor every time this script is ran(more on that in a min). ok now we have a system for the enemy to move to locations but that will only occur once and only to one place. to fix this we need to increment the target to get variable so that each time the script runs we get the next actor on the list as a target. to do this drag off the targetto get var and in the search type ++ this will select the increment var node. the next part of the script i made will make the list repeat so that once you reach the last actor in the array it will begin from the first. to do this we just get the value of target to get and compare it to the length of the array (drag off the array var and search for length, then drag off that and search >= to get a greater than or equal node). now plug that into a branch, if the value is larger then the length then we need to reset it and the branch will read true. so we simply drag the targettoget variable into the graph and select set. now we just need to call the custom event again so that the script will run over and over. i know this may be confusing but just use the picture as a guide and youll get it. the last step is to put a nav mesh bounds in the level and scale it so it encompasses everywhere you want the enemy to be able to move to. note you only need one bounds volume in the level, not one for every enemy. once the nav volume is in the level is you press the P key it will chow you the nav data (green is where the enemy can move to)

Wow, thanks for that clear reply and detailled. I have do all of what you write and I get it but there are something that stop me. Where is the contains of the array “TargetLocation” ? Must I use the “make array” and specify what is inside ?

im guessing you dont know how to make an array variable. or are you asking how to put actors into the array.

ti make an array you go to the my blueprints area in the bottom left and click the + sign next to the variables heading. then select the variable and go to the details panel and look for the symbol next to the variable type. click the symbol there (it should be a capsule like shape) and change it to the one with all the boxes.

to set the actors in the array you have a few options. you can set the variable to be editable so when the enemy is placed in the level you just go to the details panel and fill in the array. Or you could use the make array node to set the array. Or you could set the value from a list when the enemy is spawned. or you could use a get all of class node to set the values though this method wouldnt allow control of the order or length of the array. theres many ways to accomplish this task. without knowing the full exent of what your looking to do its hard to say which method is the right one to use.

I have try the make array node on the level blueprint but it doesn’t work… I should be bad on blueprint scripting :confused:

there are a few issues here.first this shouldnt be done on tick and second you dont need the cast. to fix this delete the cast node. connect the return value on the spawn node to the target on the set node, then connect the exe (white pin)pin on the spawn to the exe on the set. this should fix the issues with this blueprint.

try dragging off the pawn pin on the ai move to and search for self

Oh yes sorry i didn’t see it in your last picture. I have add the “self” reference to the pawn pin but … Nothing happens

Ok so now the level blueprint is fixed, thanks to Thompson but this pawn definitely don’t want to move !!
1: Where the enemy spawn (he spawn)
2:Where the enemy should go (he don’t move) (and after go to 3, 4, 5 ect…)

3:This is my level blueprint

3:This is the blueprint of the enemy

perhaps a physical problem ?

its probably because your spawning it in. open your pawns blueprint and press the class defaults button near the top. then go to the details panel and look for the pawn section then look for auto posses ai and set it to “placed in world or spawned”.

also while we are in the pawn blueprint lets solve one other issue that will result from setting the actors in the array by the level blueprint. after the event begin play and before calling the move to target event add a slight delay via the delay node.if you dont do this the initial move to will be to 0,0,0, which is not good. alternatively this issue can also be solved by selecting your array variable and setting expose on spawn to true then plugging the make array node directly into the spawn node in the level bp.