I have my AI character moving from a given location to another given location, in the blueprint of My_AI_Controller. I would like to repeat the process. But the second time the AIMoveTo is aborted. I tried for loop, put it into macros, a custom event, it plays only one time.
Ideally I want my characters move randomly in the filed from random target points to random directions, within random period of time. Then I plan to process interactions with the AI (overlaps and custom animations).
I find myself lacking knowledge in the understanding of the hierarchy of the blueprints. Perhaps I should create another blueprint, then, what and why.
If my plan seem clear to you, what would you recommend me to do? At this moment I want my AI characters move from point to point, then appear and move randomly again, and again within some time frame.
I would check out using behavior trees, personally I found them easier to work with to add, change, and reuse functionality to all my AI pawns. You basically just spawn a Pawn, assign an AI controller to it, create a blackboard and run a behavior tree - all what you’re doing there.
Here’s an older video that shows setting up a basic AI to find a random spot and walk to it.
if im reading it right you want the character to move to a position then once there move on to another position right? its not too hard to do that and ill explain in a min.
first theres a few issues with what youve posted here. you mention trying a for loop for example, for loops work between frames so it would never work as intended. next the way you showed another attempt in the picture doesnt work because your just calling the event twice right in a row. basically your telling it to cancel the first runbaby event and try something else.
how i would go about accomplishing this is to create your own looping script (see picture below). the basic idea is that when the character gets to the location or fails to get there then you give them a new destination and run your move to script again. in the picture below you can see that i get a random location from the Locations array then tell the character to move there, then we delay, and call the run to location event again. i also added in the bit for setting the actor location for the inital start position which is limited to being done only once by the do once node.
Thank you for reminding me about the “Success” pin!
I understand, AI characters won’t appear before the AIMoveTo is successful. Then I call next AIMoveto from success pin. Yes, it works.
But in the code it won’t be correct logic, if I link them in one long intestine manually (without much clarity of what will happen).
So the question comes - how to cycle? When the execution only works from the “Success” output…In other words, how to repeat action on the “Success” criteria?
I also realize that I should create several AI characters similar ways and then do same to them. This way I will have a field of randomly running AI from spots to spots within a time frame. In addition I want to be able to “overlap” actions in the next step of my project.
Wow! Thanks for your effort!
I copied your blueprint and now my baby runs from point to point, with stops for delay. Almost perfect, BUT I wanted it run next time from a different random point. so I tried to avoid your DoOnce node, but it wasn’t good idea.
Any more thought?
I’m having an issue where a large group of AI follows me and moves to my last visible location. Problem is if course acceptance radius and that the actors in front stop and block the ones behind from getting within an acceptable radius to that location and when they turn to run back they often get stuck on the ones behind them, which can’t reach their target location and execute subsequent behavior.
Anyone have any ideas on how to counteract this? Tried turning off collision but that gave a pretty crappy result, especially if the AI spots me again and turns collision back on (they are all stuck inside each other).