Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

AI Patrol move backward


This is for 2d Paper, maybe it's for 3d Sidescroller too.

I used a simple AI Patrol with Behaviour Tree, but the problem is that the moment the AI spot the Player through the Sensor Sight (In AI Controller) and when the AI doesn't detect my Player, it goes to the backward path point (Target Point Location) instead of going to the forward path point.

I mean, my game has 2 path point, one from the left and one from the right.

1.-If the AI sees me when i'm in the left side and when i leave its sensor sight (If i left from the left side), the AI will go to the right side (Backward) instead of going to the left side (Forward).

2.-And vice versa, if the AI sees me from the right side and when i leave its sensor sight from the right side, the AI will go to the left side instead of the right side.

3.-If the AI sees me from any side, lets say from the left side and when i leave its sensor sight from the right side (Since the AI has 90' angle and of course, the AI will turn its body towards me), then the AI will go to the left side, where it spotted me.

alt text

My BT is too simple (From the UE4 Basic AI Tutorial, since i still doesn't a lot how to do with the Key things).

The problem is, what should i do to make the AI go forward instead of backward? Because the AI will go to the opposite side from where i leave its sensor sight and i don't know what is the problem.

I want to make it go from path 1 to path 2, even if i interrupted it with the sensor sight, i want the AI still going in an order of path 1 to path 2 then to path 1 and path 2, instead of going to the opposite side...

The AI sensor sight task (FindEnemy) doesn't has nothing, it's empty, i left it so it can stop moving when it sees me.

alt text

Thanks for the answer, i appreciate it since i don't even know what is the problem behind it, so i think, it will take me a lot of day to resolve it alone (Maybe forever... since i want to use BT instead of BP that i find it quite easy than BT).

PD: the AI patrol does work fine when the AI doesn't spot me, it goes path 1 to path 2 and vice versa.

Product Version: UE 4.17
problem.png (113.7 kB)
bt2.png (70.3 kB)
more ▼

asked Jan 12 '18 at 11:31 PM in Blueprint Scripting

avatar image

27 1 3 8

avatar image HiHelloEverybody Jan 13 '18 at 09:59 PM

I resolved it, well, i had the idea yesterday but since you can't cast an actor in others actors, ai controller, character, i thought it was useless. (I tried it with a print text and look likes it doesn't flow past the actor's box thing).

But i find out today that you can cast an actor in a Behaviour Tree's Tasks to check a condition (Branch) and since it works just for 1 time because i put a collipsion to the actor and since the actor doesn't know how to desactive-active the condition, i put a delay to desactive-active it.

And i only needed to copy the FindNextPoint and rename it to FindFirstPoint and FindSecondPoint (Each one with its own actor, path node).

Quite hard to explain but i already resolved it.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question