Button to disable/enable another button

Hi all

Here is what I have, 2 buttons and a door.
Once the player presses either button the door becomes active.
I now need it to disable the other button so that it cannot be pressed.

I however will have a number of these buttons and doors which I want to be separate so they cannot be activated by one of the many buttons located around the map.

Any ideas, i figure it will use referencing blueprints but i don’t want the 1 button to activate all the doors, only the 2 buttons within the room which are corresponding to that door.

Thanks all

Hello,
If you use 3 blueprints, you can store your buttons in your door bp and your door in your buttons. Then when you activate one you cast to the door to deactivate the other (or both, depending what exactly you want)
If you use one blueprint, you create your interacting system in and you use children to set locations in your level.

Thanks for the response.

I have 3 separate blue prints,
Button A
Button B
Door

I just have no idea how to link these together… I have a feeling once I do it will let any button A activate all the doors which I don’t want to happen.

Ok then try this :


First one is your buttons and door blueprint. Buttons have a box component, 3 variables ( 1 buttonb, 1 door and 1 activated ) and the activating event where we set activated on both buttons and where we activate the door. Door only have a mesh and a custom event (in which i set location of mesh to see it working. This is where you use a timeline to slide your door)

Second one is level blueprint with a sequence with 2 ways to set your variables in your level : first one is on spawn, second is with items set in level before start.

Edit : If you collapse the spawn to function, you’ll just have to define the 3 transforms in inputs and you’ll can spawn as much as door and buttons as you want without having any trouble. Same for other but you’ll have to define the items as inputs.

Edit 2 : If it seems too much for you, you can then try to set your buttons and your door in same blueprint with the same mechanic and set locations of components in level or in a function activated on spawn.

Ok here is what I have so far,


I cannot find this Set “Door” “Target” node at all…

You can’t find them because you have to create the variables in your blueprints first to be able to drag them.
door is a bp door variable and button1 and button2 are bp button variables. Once you’ll have create them, compile, save and then you’ll can drag them and set your system.

Do you know any tutorials (I have looked over quite a few but none show how to get this set node…?", I have not got a clue how to get this target for the boolean and for the “blue” set node.

One of the bast place to find infos is : Unreal Engine 4 Documentation | Unreal Engine Documentation (bookmark it if you haven’t do it yet and go in it each time you need.)
There you can find : Direct Blueprint Communications | Unreal Engine Documentation
where you have :

https://docs.unrealengine.com/latest/images/Engine/Blueprints/UserGuide/BlueprintComms/BP_CreateVariable.jpg

where you create your variable

https://docs.unrealengine.com/latest/images/Engine/Blueprints/UserGuide/BlueprintComms/BP_VarType.jpg

Where you select the type of the variable (boolean for your conditions and name of the blueprint for door and buttons)
and that’s all.
Then or you spawn your blueprint or you select the blueprints you want to link in your level and add a reference in your level blueprint.

That’s exactly what I did… These are the tuts I looked over as well haha, erhhh I am missing something so simple I know it :stuck_out_tongue:

Here is what I have so far
2 Blue prints (1 for door and 1 door button)
Button bp has door object variable
Door bp has button object variable

check if your variables are your door blueprint and button blueprint (if you selected mesh for exemple if names are close) then if your blueprints are in your level, select them and in your event graph right click and add reference to selected levels. Or if you spawn them spawnactor. And from the blue wire, right click and type the name of the variable. (if you change values, don’t forget to compile before trying right click)

I have just looked up that 4.5 has some problems with missing nodes or something. What version did you use?

4.5 too. You may have miss something somewhere. Is your context sensitive checked ?

Edit : To see if your variables are ok : from your variable buttonb in your button, you can drag a get / set variable door and a get / set another buttonb ^^

Yeah its checked. This might help, when I drag the door variable “set” it asked me to “select asset” which has nothing in…

Try this : Put a button blueprint in your level. Select it. open your level map. do right click and add reference to.
From this node, drag a wire and type door. you’ll have your get door and set door.

Got it! Haha, it seems I was working in reverse, I got confused with the target and the item.

Thanks a lot for the help really is appreciated!!! :smiley: