To prevent others from making the same mistake he did: in the behavior tree click on root then hit the drop down on blackboard to select your blackboard. No matter what, you should *always* be checking that this value is set correctly to prevent it from causing any issues later on.
If you are using a later version of ue4 and don't have the get ai controller function do this. Instead of starting with "Event Receive Execute" start with "Event Receive Execute AI" then you can skip the "get AI controller" and "get controlled pawn" nodes. All you have to do is pull off the Controlled Pawn pin on the "Event Receive Execute AI" node and plug that into the "get actor location". The rest of it should be the same. Got this comment from a different tutorial, might help some people.
This is great timing as I was just about to start working on building a basic AI for a project and haven't used the behavior tree before. Thank you so much!
Thank you thank you! I was looking for ai tutorials like this since last year and none of them I liked. I started looking today and I was watching each tutorial. You have hiding and roaming as if the ai was a guard. You are amazing, I've always wanted to have ai like this!
To improve this further, you could change the blackboard key to an actor instead of a vector, then set the value as the perceived actor (i.e. the player). That way he won't run to your spotted location and run sideways, instead he'll always run to your realtime location. Thanks for vid!
Steve Chapman somewhat not related to the AI series but I am working on a small project in my livestream series! Check it out and join us on discord to keep up to date with what's going on! :)
I had the Problem, that my Enemy see me, but don´t move to me. My Problem was, that i Cast to my Enemy in the "GetPlayerLocation" Task. But the right Cast is to the CONTROLLER of the Enemy. Hope that help somebody. Sorry for my bad English :)
RoamLoaction and RandomLocation are interchangeable if you're getting confused with these tuts. He just mixed some stuff up but it should still work. Don't forget to add a NavMesh, champ.
Fixed I am using paragon Yin as my AI Enemy. I got everything setup and she is moving, comming to me etc. But she is kinda floating/dragging herself around. basically there is no walk animation. I have set up the animation blueprint etc. I am using the same character with a different skin as my player character. So i duplicated the anim blueprint hoping it would work but it did not. Any ideas..?
Found a Solution.. Go to this link and check comments with a picture. Pretty simple Solution. answers.unrealengine.com/questions/821053/how-to-use-paragon-assets-for-ai-character.html And if your AI stays there without following you use nav mesh volume.
awsome, works like a charm! 1 thing i can't figure out though is my enemies still seem to sense me behind walls and seem to keep focus about 3k units away
Hello Good sir,I seem to have a problem that my ai is only on idle position and does not move around. I hope that you could help and guide me in this problem. Note: I use my custom character and my own animBP
Make sure you place a Nav Mesh Volume in your Level so the AI can walk around after you make it surround the area, like 10000, 10000, 2000 you can Press P to see the nav mesh has properly drawn. (That may be your issue).
So I'm using my own mesh/animations and I have built the blend space, the anim blueprint, and I got everything working, my issue is that my character doesn't walk when he moves. He moves in idle animation as if floating. Any thoughts on that? I know it's gotta be something I'm missing with the anim blueprint but yah I'm at a loss here and can't seem to figure it out. Cheers for the awesome lesson :)
I figured it out. I legit just didn't have anything in my anim bp event graph for the character. Everything works now. Which means if I can do it from this tut, so can everyone. Which also means, if you can't get it to work you either made a mistake, or missed something. Tutorial is great.
@@alistairbell1051 from what I can remember (2 years ago now) I literally just rewatched the tutorial 3 times. I remember literally having nothing in the anim BP's event graph for the character. It's easy to miss but just follow the steps at .75 speed and you'll catch it. It's hard to see why yours isn't working because there's no way to know what steps you missed. This tutorial is otherwise perfect and I just missed a step.
@@gatlinfitzgerald3425 nah my event graphs fine but same problem weird. I fixed it by spawning from class, think it's an engine bug. Thanks for taking the time tho much appreciated
Nice but why you don't use a Service (like "Set walking speed") with a public variable that you make instance editable that you can use for all situation in the behavior tree ?
Do you have a solution for when there's a bunch of AI and they just kinda all clump up together? I'm trying to figure out how to replicate an arching movement to spread out around the player.
My end result seems relatively unpredictable. If he sees me, he runs to the location that he originally saw me from instead of constantly updating the move to. If he doesn't see me, he roams as expected. However, judging by the 'true/false' print I did for whenever he sees me or not, it seems unpredictable. However, I don't know why I'm saying this here; it's not your problem at all, but I started this comment so I'm finishing it lmao Update: The focus isn't working for me and I'm not sure why... Update 69: 'Use Controller Rotation Yaw' needs to be true on your enemy character. It seems better now.
Great tutorial. One tip: Don't perform actions so quickly with your mouse when you're teaching. You click stuff really quickly sometimes and it's not clear what you clicked without pausing and scrubbing through the frames. For example at 15:19 when you create a task it's pretty instantaneous the base class you pick.
thanks for the tutorial using this to set up my own ai and thought id suggest rather than having two different events for walk/Run maybe use just one that has a walk or run boolean input that goes into a branch? could even just have a float input for the actual speed you want though that could get annoying later on
So after a few tweaks, I was able to get the Controller working with the Tree. Aside from not linking my tree and a couple of steps I overlooked, one of the problems was that I used a separate Animation Blueprint and Character Model. Now that I have the tree working, I'm having trouble mapping the Animation speed to blend from walking and running. Even though I don't know how Animation Blueprints or an Animation Blend work, seeing my model chase after me on a running Animation loop is pretty cool. Any help setting up my speeds to an Animation Blueprint or Blend would be graceful!
Anyone get this working for a 2D side-scroller enemy AI? My sprite is just sitting on the Idle animation and when i look into the behavior tree, it is just blasting to the "getRoamLocation" branch over and over thus calling the "Walk" event. Upon looking closer, the 'CanSeePlayer' is constantly set to False. I messed around with the peripheral vision, checked to see of the capsule component is set to my AI controller and placed a NavMeshVolume.
Hey, how are ya?? I have a question for you & am kinda struggling to find an answer... How do you make ai make a sound (along with chasing the player) when it spots the player?? Sorry I’m kinda new to UE4. Cheers!!🍺👍🏻👍🏻
everything works fine .. my one and only prob is that when the zombie does not see me. it does not roam at all it just spawns (i made a spawn system) and stands there.. any ideas on why this might happen?
My AI takes a few steps and then it automatically sets back to its start point, do you know where I'm going wrong? I have rewatched this about 3 times and still can't see what I did wrong lol
I followed very closely however I'm having an issue.. my AI can see me but he isn't moving. He's rotating on the spot towards my player and I'm really unsure where I've gone wrong :P Any help would be greatly appreciated!
Do you have a nav mesh bounds volume allowing him to walk? If not, what i would suggest is to leave your AI as it is, watch the rest of the videos in the series as they change and build upon what you have from this tutorial alone. If you need any more help, hop in the discord server, theres loads of people in there who love helping out :)
Did you find a solution? I’m having the same problem. Was it just needing a Nav mesh? I added a Nav mesh bounds volume but it doesn’t seem to do anything. I tried added it the scene and scaled it but doesn’t even turn the navigational areas green like the videos i was watching did.
what am i doing wrong??? my guy is not moving on the ground, he can see me but he just floats in the air! How do i fix this? also, in the editor he is on the ground, but when i click play he just dissapears! but if i put him in the air a little, he just floats. what am i doing wrong??? someone please help!
Anyone know why my GetPlayerLocationTut on the Tree is doesn't have the default option to select a key? I've checked that everything I've done is identical as far as I can see, and have compiled everything.
Thank you. This tutorial is great. I would like to make a number of enemies that have the same behavior, is there a way to use the primary blueprint we created for child actors?
Great tutorial but I have a problem. I followed this tutorial perfect but my Zombie just idles. I didn't use the same Zombie as you because that Mixamo animation pack doesn't work with my Unreal Engine. I only have a few animations for my zombie! Can you please help as I did everything you did and it does not work!
I now have the Mixamo animation pack and I am using the Vampire model. It sorta works. Only problem is that he runs sideways and the sticks to me (Player) Any ideas? It would be appreciated! =)
The main problems is how can we make many ai? it seem they use one behaviour and confused.. Also get static var of player its bad idea, what if we have many type of enemys for enemys ? Or target is not a player? Anyways thanks, its realy help to start.
Hello fellow gamers! The 8th Day released as an early access release.Thank you all for the support and have a great day. store.steampowered.com/app/563500/The_8th_Day/
After I finished the tutorial, UE4 deleted all the data inside of the blueprints (GetRoamLocation, GetPlayerLocationTut, etc) saying they are data only blueprints and if I wanted to add scripts and variable I'd have to open the full blueprint editor. So its literally impossible to finish the tutorial.
Hello Kevin, Im not exactly familiar with the issue you are talking about but it seems to be only you with that problem as far as im aware. Could i suggest you try this with a clean unreal engine 4 setup to see if it still works as it could be some other issue with your project causing this.
Thanks for ur tutorial this is what i am looking for, after i saw ur video i now have foundation on building my own ai. Just 1 last think i want from u is can u plz make video on how..... AI will switch target ? I mean to say is that for eg AI saw me and come to attack me, at that time if another friendly AI come in front of me and enemy AI, enemy AI will try to kill him first and then me. Thanks in advance.... i had subscribe u so i am waiting fir ur video i request for.
The update took it from being a low level implementation of AI to being the correct way to doing it. Yeah its a lot more confusing but when it comes to scale-ability , this system is much better suited to AI.
on simulate, they run to the middle and as soon as i touch the nav mesh no matter what they B-line to me.. what is the issue i have done version 4.19.2