Did you get errors compiling that blueprint? Because that looks like an infinite loop.
Yeah I got an error but not because it’s an infinite loop. Infinite loop would work since we want the enemy to keep patrolling.
Instead I’m unable to set the targetpoint to a specific targetpoint in the scene and instead it just goes directly to the last patrol point rather than start from the first one
Oh, that makes sense. The loop is going to go to the next element immediately, it’s not going to wait for the move to to succeed; so the loop will go:
MoveTo TargetPoint1
~~ miliseconds later ~~
MoveTo TargetPoint2
~~ miliseconds later ~~
MoveTo TargetPoint3
~~ miliseconds later ~~
MoveTo TargetPoint4
~~ Loop ends ~~
~~ Once the AI reaches the last target point ~~
Loop again.
Oh I see! So instead I should probably add a delay to check if it’s reached the next targetpoint and only then execute the next loop. I thought it’d wait with the AI MoveTo
You could add a delay but then you would need to figure how long it would take to reach each point, and if they take different amounts of time you would need to also store that information or else some points might have the AI stuck waiting.
Instead of doing that. It’s far easier to just use an index into the array and keep track of that.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.