Hi all,
I’m sure most of my questions have answers out there but finding exactly what I need is proving difficult so I was wondering if you lovelies can help me find the way
Currently working on some AI behaviour for a game - it’s your classic see player, chase player, search for player behaviour tree. I’ve got all the basics down and I’m currently struggling with just a bit of (hopefully) simple expansion so here goes:
-
When the AI is searching for the player I have him moving to a random point in nav radius, however this means that he can frequently move near a solid object (wall, box, door etc) that he can’t see through but he’ll just stare at. Can I put another function at the end of the BT loop to effectively say “rotate the AI so that he’s looking down a clear path, not into a wall”
-
Within the same BT section, when the AI is finding it’s random point in nav radius how can I put in some calculations to effetively give me a minimum distance between points? The max radius is all good so he doesn’t wander the entire map, but it’s also silly that he’ll pick a random point that’s 5 units away from his current position. I’d prefer to say pick a random point that’s within 300 units of last known player location and also make sure your next point is at least 100 units away from your last random point
-
I use an enum for AI state - unaware, suspicious, alert - to catch the state of the AI and do stuff on the BT. I’ve successfully cast the blackboard enum variable to the character BP and I use it to then update the character’s colour so that when the BB enum is alert, the character turns red etc. I’m however having real trouble trying to also feed the BB enum value into a variable for the animation blueprint. I want to use the state enum to change the anim state so that if he’s alerted or suspicious he’ll raise his weapon and patrol/chase with it aimed at the player. The statements I have to change the anim state work fine as if I manually change the enum value in the preview I get sent down the correct channel but I can’t figure out how to pass the blackboard variable value over to the anim graph (as above, I’ve cast it to the character fine)
Sorry, I know this is long and involved, just want to try and iron out as many trivial things as I can before I try and build out to more complexity