How do you get blackboard values in the player bp?

Inside my player bp im getting value as int and connecting the target to blackboard, but whatever i try to connect to the blackboard i get accessed none. I want to get my npc’s blackboard values in the player bp and print those values. Casting to the player from the npc bp is easy potatoes, but casting to the npc from player bp is a nightmare. Any help would be much appreciated.

1 Like

Getting the blackboard values isn’t hard once you have a reference (red circled object pin in image) to the NPC. Creating that reference can be done multiple ways, “get all actors of class” if you only have one is very simple but not the best way if it can be avoided, overlap events, hit events and spawn events are some of the ways you can create a reference to an actor depending on how and when the reference is needed and the gameplay set-up would determine which of these would work best. Once you have the reference just get the blackboard and get the value you desire from there as I show below.

Also make sure somewhere in your NPC controller is this node, otherwise there is no blackboard to “get” because no blackboard is being used.

So everything is working now? As for your question, for the player character there is built in code to create that reference with the “get player character/pawn” that wouldn’t work with all the unknowns and possibilities of AI that can be created so a “get NPC” would be significantly more challenging to create. Say you had 3 in a level? Which would you be referencing? Say there are multiple “classes” of AI, which would be the one you want? How do you determine that? The best you can do is the “get all actors of class” without using overlaps or hit events or something similar.

Thanks for the quick response! I ended up using an overlap event to get my reference.
When referencing my player i usually use “get player character” it’s a wonder there isn’t something as simple as “get npc character”

It’s working great now :slight_smile: I didn’t realize that npcs refs were so much more complex than a player refs. Thanks for the follow-up and explanation.

Get all Actors of Class-(say X) is returning an array, how to get an element of it ? I know that’s a weird question, i am still learning UE4.

All you need to do is drag off the array pin and search for “Get” this will give you a “get node” with an integer index input pin. That integer index is the array element it will return for you.