x

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"

My AI don't want to move

Hello,

I don't understand why my AI spawn but definitely don't move. All suggestions are welcome :)

This is where spawn my AI and where should it move. (start in green and end in red)

alt text

This is my level blueprint

alt text

This my AI blueprint

alt text

Like you see, I have put in my IA blueprint the string "AI can't move" when AI move to fail. When I play the game, this string is displayed.

Thanks you for reading

Product Version: UE 4.19 Preview
Tags:
mylevel.png (808.0 kB)
myiablueprint.png (343.2 kB)
more ▼

asked Mar 05 '18 at 08:14 PM in Blueprint Scripting

avatar image

Orseiko
31 1 4 10

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Do you have a NavMesh? I see green but I can't tell if that's custom stuff. (https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/2/)

And by the way, it's AI (Artificial Intelligence), not IA. ;)

more ▼

answered Mar 05 '18 at 08:23 PM

avatar image

Jin_VE
4.4k 31 77 40

avatar image Orseiko Mar 05 '18 at 08:26 PM

Ahah thanks you for this correction i will be more careful :) Yes my Navmesh is in green on my path

avatar image Jin_VE Mar 05 '18 at 08:39 PM

Oh. I'm not sure about that loop in BeginPlay. Looping like that is confusing so I try to avoid it. It may work fine for all I know but how about we get you set up with a timer that ticks off once per second and does the spawn? Once I feel comfortable about that then I can look deeper. Or maybe someone else can verify that it's fine.

To use a timer, you want to add a custom event, call it SpawnNewAI (or whatever you want). Then from BeginPlay, you want to use SetTimerByEvent, giving it the time period and setting Looping to true. Then connect the Event pin to your custom event.

Now, from your custom event, you can run your spawn code and it will happen once per whatever time period you gave it.

That will do what your loop is doing but it will do it in a better way.

avatar image Jin_VE Mar 05 '18 at 08:54 PM

OK I see the issue. When you call Spawn, it runs BeginPlay in the AI pawn before TargetPositionEnd is set. What you want to do is go into the AI pawn and make TargetPositionEnd public and set "ExposeOnSpawn" to true. Then refresh the spawn node (right click menu). TargetPositionEnd will show up in the spawn node. Plug the end location into that and you should be good.

avatar image Orseiko Mar 05 '18 at 09:22 PM

I have do what you suggest me but i don't understand your last reply. I have set TargetPositionEnd to "ExposeOnSpawn" and i think that it is public because private is not ticked... But The AI stillnot moving alt text

test1.png (376.9 kB)
avatar image Jin_VE Mar 05 '18 at 09:34 PM

Get rid of the SetTargetPositionEnd node. You don't need that. If you set up Expose on Spawn correctly then click the down-arrow in the Spawn node and see if the pin is there. That is what you want to plug the end-location into.

avatar image Orseiko Mar 05 '18 at 09:44 PM

But if i delete the setTargetPositionEnd node, I'll not be able to tell where is the target at the end...

avatar image Orseiko Mar 05 '18 at 09:52 PM

Sorry now i understand, i should see now the setTargetPositionEnd pin into the spawn node

Edit : It work ! Thanks you for your help Jin :)

(comments are locked)
10|2000 characters needed characters left
Your answer
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