How do i set up a Boolean in a blueprint Interface?

I want to do it so when the Player presses a key in the character blueprint, that sets a boolean value that will be checked via branch inside of the HUD blueprint that when implemented will show or not show accordingly
How do i make a blueprint interface like that?

Make an interface with a boolean variable, then call it’s function in your player blueprint. Promote that bool of the interface to a variable and set it with whatever event you like. Then call the event of that interface in your HUD blueprint and attach the bool to branch’s bool input.

Hey there still having trouble, can you take a look at my picture links to see if im doing each part respectively right?
1: Blueprint Interface = Dropbox - Error
2: Calling Function in Character = Dropbox - Error
3: Setting the variable = Dropbox - Error
4: HUD Blueprint = Dropbox - Error

So first of all, you dont need to connect the execution output and input of the function. Make sure there is only Input in the interface with a boolean. Then, add the interface to your player blueprint > right click on the canvas and get the Function of that interface, not Event. Set the boolean as i said earlier and then head to HUD BP. Add the interface to the HUD blueprint > right click and get the Event of the function this time. drag from its boolean and attach it to the branch. You dont need to use the execute output of the function, just boolean.

All this may sound complicated when written but it really isn’t so dont go crazy if you happen to fail along the way!(BP interfaces tend to drive people crazy every once in a while when you first meet them ;P)

Thank you for your patience so far, i followed the instructions you said and i was led into a difficulty when it came to the HUD as shown via screenshot

If the problem persist and your happy to take a look at the file id appreciate it

Thanks thats actually the second time iv been directed to that video, Iv watched it through and I cant seem to convert what he does, to what i need to do
I feel bad for continuously commenting on here, is there perhaps an email address you use so I can try and fix this?

Ok, check this;

What you see on the left is the interface function in my pawn blueprint. And the one on the right is the hud blueprint, calling the interface as an event.

Actually there is a tutorial that demonstrates BP interfaces in one of the official tutorial videos. I’ll edit the post when i find it.

Edit: Here;

It is ok to comment here. It helps others running into the same problem in the future.
Can you describe how you are setting everything up step by step please? Or record a video of your process if you are able to.

Okay the first thing i did was:
Create the blueprint interface called ButtonPressed and made one Input bool called ShowAmmo and left the value empty.
Then i went into my character blueprint, I created the event begin play event that i was going to use in a minute.
I got the event keypress i wanted to use and dragged off top the right looking for “ButtonPressed”, i found one for Call function and one for Interface Messages, I used the Call function. I dragged off the bool pin and used promote to variable to create a new “ShowAmmo” bool inside of the Character Blueprint, i used that same bool to set to no at the start of the game (Event Begin Play)
From there i went onto the HUD, Right after the Draw Event and assigning my Screen X and Y, i right clicked and typed in “Event ButtonPressed” I hooked up its red (bool) pin to the condition pin of the branch right next to it, but i didnt hook anything up to the white pin of the event node, after the branch i had two prints set up, one to say Show Ammo and the other to say No Ammo, to see if this had worked.
Whenever i go into game, the only text going along my screen is No Ammo, iv set it up in the character blueprint so when the button is pressed it will print “Clicked” so i know thats working fine and there isnt a problem with the button press itself.

Use the Interface Message one instead of Call Function and see if it helps.

Ok, in the pawn blueprint right click > Get Player Controller. Then drag from the player controller and Get HUD. Then plug that hud into target of the interface. It should work now.

Comes up with an error “must have a self pin connection”

It allowed me to compile and run the game, but the outcome still insists there is no ammo no matter how many times i press the button :frowning:

The only current interaction the HUD has with relevant other blueprints is whats shown in the picture, should there be more/different?

Well i’m out of ideas then. :\ Double check the rest of your blueprints to make sure you are sending that information to the HUD. Then start a thread in the forums if you like to get more help, if you still can’t solve it.


I fixed the problem

Glad you sorted it out!