I’m new to making AI in Unreal 4. I was following this youtube series for basic ai.
I can’t seem to get the AI to move to the waypoints i’ve set in the level.
My bot character is set to use my Ai controller in the class defaults. I’ve tried spawning and placing the bot in level, but it doesn’t seem to make a difference. My nav mesh should be ok, i can see it normally highlighted with green on the level.
The series is pretty old, so i’m guessing that some of that info is dated.
Here is a screenshot of my behavior tree in action.
Try removing the decorator from the MoveToRoute node. What’s that for? If you’re trying to wait until FindRoute is done (and a location has been set) then that’s not how to do it. FindRoute should not call the “FinishExecute” node until it’s finished doing its thing. Tasks get ticked like actors so you they can wait until it’s time to finish. Hope that makes sense.
Hey there, if it’s getting stuck on Find Route then you either dont use Finish Execute node on the task or the decorator you have on the MoveToRoute is always failing. Can you show me the decorator condition code?
Actually I now realized that the condition check is no longer the same in 4.17 than in the tutorial. What is the current method to set the condition for a decorator?
(In the screen cap i’m not currently doing anything with the condition check.)
Debugging the MoveTo is a pain… Make sure the location is somewhere near the NavMesh and the NavMesh is positioned properly relative to the floor. You can visualize the AI by hitting the ’ key while in the game. Then the numpad keys enable/disable different aspects of the AI.
OK I removed the event begin play execution from my bot character, as the bot is based of a playable character i made. Something in that code was preventing it from physically moving. Now the bot is moving to the first way point.
Edit: Adding the decorator back seems to break, something is not right with my decorator (UpdateRoute)
Looks like you don’t need it. You just need to set the location and then move to it. Does the decorator make sure the location is good? If so, you should handle that differently (as I said before). If you can’t get a good location then the failure is in the task that tries to find it (FindRoute). There you can finish execution with success set to false. At that point the BT will fail up the tree and the MoveTo will never get executed.
Ok thanks for the good info, I was just following the tutorial and that’s how he implemented it. The Ai i’m making is for a fighting game, so im not even sure if making way points is a good way to implement the movement patterns. What i really want is for the Bot to make decisions based on how the Player is moving and acting. For example if the player is moving closer the bot will move to a “saver” position, if the player is attacking the bot will dodge or try to counter the attack.
No prob. Doing that kind of thing is a lot more complex. I suggest getting comfortable with the system. Plus, once you get to a certain level of complexity, it’s hard to avoid C++. Moving around can be done better using EQS. There’s a good tutorial from Epic on that (Setting Up Advanced AI | Live Training | Unreal Engine - YouTube). And be careful which tutorials you watch. Some of them are learning as they teach so they aren’t the best examples. GL out there.
I’ll be sure to check that tutorial, thanks again. I’ve been meaning to start c++ with unreal, as i know how to code c++. However for this project i’ve just haven’t had the time to dive in to it yet. Thanks again and have a awesome christmas =)
ps. the link seems to be dead