You can use the trace system with the pet tutorial.
Combine them and then improve them I guess, so he just sits there and when the trace is activated put the follow pet into action, meaning his trace hits you, you can make him walk around first I guess. I made an actor follow me on mountains, when he is in some range you ca also make him attack you, tho I did not use it for that.
You can use
YourActor location with GetActorForwardVector() times speed.
But there are lines of code you have to figure out.
I think after you solve your trace system this is for you.
You have enough information here to make things work for you.