Patrolling Enemy problem

Hey guys! getting into blueprints and having a lot of fun. I was trying to make a simple enemy that Patrols to the left, and to the right, until you get into their radius (collision sphere) and chases you until you get out. I’ve got the chase part working, and when you exit the enemies detection radius, they stop following you, but they dont return to their spot and begin patrolling again.
I made a distance Variable hoping that I could change the distance that the enemy patrols.



Hello,

I don’t really get what your distance variable stand for here ?

But why don’t you use a sequence + do once node ?

Like, when an overlapping end :
→ first, go to your start position,
→ then, start patroling

Thank you for the reply!
So I was hoping that my distance variable would allow me to change the distance my enemy npc walked.

I tried removing the variable, and using a sequence node as well as a Do once node, and I’m not sure what I’m supposed to get here, as I’m still not getting any results unfortunately :confused:

Oh no sorry, the end overlap is triggered once, not continuously, so you have to make a linear sequence.
On component overlap end → ‘ai move to’ patrol start position - and when ‘completed’-> do the patrol stuff

Its no problem!
I think i’m having some trouble wrapping my mind around this. This is what I tried doing, and still no dice.
Ultimately I’d like for the enemy to move to the right a few paces, and then to the left. Maybe i’m over complicating it?

Ok i though you got this part already. This is what you need :

You said :
“but they dont return to their spot and begin patrolling again”

So first, you have to store in a variable this ‘spot’ position.
When overlap end :

  1. make the character go to this spot, and after,
  2. doing a loop moving to ‘the spot position + some distance to the right’,
  3. When arrived there, going to the ‘spot position + some distance to the left’ and when completed go back to step 2; etc.

Before making the blueprint, you have to set the logic clear in your head first, maybe draw a logic schema, it helps a lot

Thank you for the suggestion! I didnt think to do that (making the logic clear in my head).
This is what I’m picturing.

Yes exactly. And just add a 5th step for going to patrol the opposite direction if I understood what you wanted.
Don’t forget to store your starting position in a variable. And now you have everything to do your blueprint :slight_smile: give it a try and show us