Object variable not being picked up in Blueprint

Hi all, I’m wondering if someone could perhaps help me with a problem I’m having.
I’ve followed this tutorial through to make a bot patrol between waypoints and then attack the player when it detects that the player is within a certain radius: A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums
Now the patrolling part works fine, however after using the useful debug tool, it appears that the problem is in the BTService Blueprint Base blueprint and that one of the object variables (‘EnemyActor’) in this blueprint isn’t being picked up properly so the == condition isn’t being met which causes the branch to always be false. I could be completely wrong as I’m new to the unreal engine. I’ve also attached some screenshots of the behaviour tree (only the nodes I’ve circled in red get activated, I think because the attack branch is activated by the BTService Blueprint Base). I’ve also attached a screenshot of the Blackboard that I ‘think’ the EnemyActor object variable is set from. Sorry if I’m not very clear - I’ve only just recently got into this.

Thanks all, Andy :slight_smile:

Hey Andy,

Blackboards don’t “set” variables they only define them (keys though, not variables although they can appear similar.) you need to set the key value in the service before you perform your comparison check. Without a better view of your BP graph and better understanding of what you need I’m not sure I can give a better answer but I hope this helps some!

Jesse

PS

See this tutorial here https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/11/index.html

Notice the first image near the right edge where he “Set Blackboard Value As Object”. You need something similar depending on the key type (object, bool, vector etc)

Thanks a lot Jesse, I really appreciate your help!
I’ll take a look and see if I can figure it out from the link you provided, I’ve attached screenshots of the entire BTService Blueprint Base ‘Detect Enemy’ blueprint incase you’re able to see anything obvious :slight_smile:

I’m pretty sure you just need to set the value beforehand. If you have any other issues let me know. I’m on phone so will check out your images later but I’m confident you’ll have it resolved before I’m back on. And you are very welcome!

I’ve rebuilt the bot from the tutorial that you pasted a link to and all is well now.
Thanks for that Jesse! :slight_smile:

You’re welcome. I would be really appreciative if you accepted my answer to have resolved your question! Thanks

Done! - Thanks again! :slight_smile:

Thanks! But to “accept” the answer you need to click the little check mark that sits below the arrows next to my answer. When you do that, the answer plus all these comments on it, will highlight green :wink: