Download

Use "Input F" to cycle move locations

Hello all, I am very new to blueprints only started last week and I have minimal to no experience using C++ (im currently in a class for it though). Basically the idea is a simple follower system in my game, the character will either follow you(the player) or when you push “F” it will go to an actor location… but when you push “F” again it will return to you(the player). I have gone through countless tutorials regarding AI systems but none show how this might be done. As of now I have it so the character moves to a target location when you push “F” but once he gets to the location thats it, he stays there. How would I set up the “Input F” to cycle through the values infinitely?

Hello,
Use two vector variables to store “start” and “end”, before your first move and a bool variable “back”.
Add “back” with a branch to event key “f”. If back is false you do your move from “start” to “end” and set “back” true, if "back is true, you do the move from "end to “start” and set “back” false.

Edit : Instead of a bool / branch, you can use flip flop too, which will do the same.

Outstanding! thanks a ton, especially for getting back to me so quickly. But I am having one more issue with this… ive attached a screenshot showing you what I have put together. The problem is that the “AI_Dink” variable travels to the center of the play area instead of following me (the “player_character”). The cycle works fine though, using “F” does make the character move between my target point, but just not to me which is what i need. In this instance would i need to use something like a trace to keep the AI following me around the map?

I did a try and modified few things : with flip flop variables are no more needed, you can delete them. This set up works fine. I have change move to location by a move to actor for player.
moveto.jpg
I suppose your issue is due to your character reference which is may be not set on event begin play, then it is empty and ai goes to 0,0,0.

Alright so i got it all up and running perfectly, much appreciated.

Not sure if I should make this a different thread or not but let me ask here for now. Now that i have this set up what would i add to make the character continue to follow me after it has reached my location? Meaning when you hit “F” the charcter will continue following you no matter how many times it reaches your location. Cause right now the character comes to you then once it reaches you you need to hit “F” 2 more times (goes to target location first then cycles back to you) in order for it to get to you again.

To do that you need to go deeper in a.i and use behavior tree. Here is a start guide : https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/
You can find different tutorials in forum too, from mhousse1247 https://forums.unrealengine.com/showthread.php?25415-Basic-Enemy-AI-(BluePrints-Only)-(Project-Link)&highlight=ai not using bt but really helpfull, from silentx : Create an AI Bot that Shoots, Chase, and Patrols [Tutorial] - Community Content, Tools and Tutorials - Unreal Engine Forums and others.