Question with Branch

I made a function using the branch, when I check the “condition” box I activate the “Spawn item and attach” and when I leave it unchecked the “Spawn” is activated, that said, I wanted to be able to do this directly in the game, pressing a key

1 Like
  • create a boolean variable and plug it into the Condition pin
  • we now need to communicate with this blueprint and set that variable’s state
  • how to do that will depend on what this BP is, how it made it into the game and in which BP Pressing a Key takes place.

Perhaps the function is already in the BP that processes input?

Hello, how are you?
So I’ll show you a broader view of the Blueprint


When “condition” is checked the character puts the weapon on the Back/Holster

When “condition” is unchecked the character puts the weapon in his hand

This is exactly what I want to do, but binding a key so that when that key is pressed, the “condition” is activated or deactivated thus making the character switch between Back and Hand

Does it mean the variable is inside a component owned by this actor?

Because that was my question. How to communicate with BP depends on where things are, who owns them and so on.

I understand, so you mean it like that?


I’m trying to bind the “1” key

Yes, but you wanted to set the state of the variable. Set Condition boolean.


Maybe so? But it hasn’t worked yet.

I also tried with “flip flop”
Any ideas on how to proceed?

Not sure I understand what you’re doing. Following what you originally requested:

You then created a variable:

image

Get component → Set Condition Variable:

Is this not what you asked about? Passing a variable will also work, the way you do it now. But it will always be false.


Yes, I want to set the condition of this variable with key 1 so that I can toggle it on and off within the game.

True, I tried to do it like that and the character always had the gun in his hand, which meant it was always “false”.


Let me see if my reasoning is correct
I created a “Condition” variable and applied it to the pin as you told me


So would I do something close to that?

My goal is to create a shortcut key for weapons that are in the holster socket to go to the hand socket, if there is another way besides this, I would also accept it.

I tested it here, but it only works partially, for example

when I add it to work but when I press the “1” key it can still understand but only when the weapon is not in the equipment slot