# Multiple Button Puzzle

**URL:** <https://forums.unrealengine.com/t/multiple-button-puzzle/491203>\
**Category:** UI\
**Tags:** buttons, unreal-engine, puzzle, level-blueprint, Blueprint, question\
**Created:** [November 22, 2021, 9:30pm UTC](https://forums.unrealengine.com/t/multiple-button-puzzle/491203 "2021-11-22T21:30:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maddlu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Maddlu](https://forums.unrealengine.com/u/Maddlu)\
**Post date:** [November 22, 2021, 9:30pm UTC](https://forums.unrealengine.com/t/multiple-button-puzzle/491203/1 "2021-11-22T21:30:45Z")

</div>

My puzzle is a player who has big buttons on the floor and can jump on top of them, changing their color, symbolizing they are on. The solution to the puzzle is turning on specific ones. I made a simple mesh of a button, to conserve space, and dragged copies of it into the level.  
The issue I am having is designating which “Button On” variables need to be true to complete the puzzle, and how to check them all in the level blueprint.  
Any help would be greatly appreciated.

 ![352847-button-mesh-blue-print.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/0/4/004a69e4f42f1e589c2fff8019217dea1b143d68.png)

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [November 22, 2021, 10:19pm UTC](https://forums.unrealengine.com/t/multiple-button-puzzle/491203/2 "2021-11-22T22:19:42Z")

</div>

You could try adding a bool that’s instance editable called bSolutionButton, for example, that when the instance is turned on, if true runs a custom event in the level blueprint adding 1 to a variable. If the bSolutionButton is false on a tile the player activates, it calls the event and resets all tiles / player dies / etc.

Having that bool instance editable allows you to set it and iterate in editor. The event inside the instance will either +1 if true or reset if false.

the idea of adding 1 is to check that when a tile is activated, if that variable equals to total of solution tiles, player completed puzzle. So you don’t actually check the buttons, you just check if the player has activated the total amount without interrupting the count (without activating the none valid ones).

You could also create a function on begin play that checks the tiles to count the total amount of valid tiles. So after setting it up all you have to do is tick those that are valid and it takes care of itself.

**Edit** : [Link to a quick test](https://www.youtube.com/watch?v=NUJgNQcVwns).

---

<div class="post-metadata">

**Author:** ![Eslake](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Eslake](https://forums.unrealengine.com/u/Eslake)\
**Post date:** [November 23, 2021, 3:48am UTC](https://forums.unrealengine.com/t/multiple-button-puzzle/491203/3 "2021-11-23T03:48:26Z")

</div>

If you’re saying you don’t know how to Identify which button you’re changing because they’re all the same blueprint class, you can still give them unique values.

The simplest way, just give them an exposed variable… like this.

 ![352857-editable.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/4/8/e4899bb455814cffbdba4768309fd5853d7142e2.jpeg)

Making it editable you can give each button an index # as you place them.

Then when you jump on them,…

 ![352858-passingit.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/2/8/e287a2cea6fdda7edb9fcd3dab73c0041d366ea8.png)

---

<div class="post-metadata">

**Author:** ![Maddlu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Maddlu](https://forums.unrealengine.com/u/Maddlu)\
**Post date:** [November 23, 2021, 12:41pm UTC](https://forums.unrealengine.com/t/multiple-button-puzzle/491203/4 "2021-11-23T12:41:42Z")

</div>

How do you call a custom event that is in the Level Blueprint, from the Mesh BluePrint? I made a customer event in the level blueprint, but it doesn’t show up in my Mesh blueprint.

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [November 23, 2021, 2:13pm UTC](https://forums.unrealengine.com/t/multiple-button-puzzle/491203/5 "2021-11-23T14:13:40Z")

</div>

You have to use Event Dispatchers to bind the events in the level BP: [HTF do I? Event Dispatchers in Unreal Engine 4 - YouTube](https://www.youtube.com/watch?v=sEcoWGrF1Hg)

If you want an example for this specific puzzle, I could share later tonight how I did it in the link above.

---

<div class="post-metadata">

**Author:** ![Eslake](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Eslake](https://forums.unrealengine.com/u/Eslake)\
**Post date:** [November 24, 2021, 3:57am UTC](https://forums.unrealengine.com/t/multiple-button-puzzle/491203/6 "2021-11-24T03:57:59Z")

</div>

^ Definitely something you’ll need to learn at some point, so worth the look.

But you don’t want to place events in your level blueprint, as a general rule.  
The only real reason to do so would be to have that event available at all times across any map in your game…  
But you can do that with a simple GameInstance and be able to reference it the same as your other blueprint classes. Cast, Get, etc.

Things like level and remaining lives need to be there anyway, so personally, I put everything that would make up a game’s Save, build a structure out of it, and put that into the GameInstance.  
it cleans up save/load and I never have to remember where I’m keeping a variable when I need it.-

---

<div class="post-metadata">

**Author:** ![Maddlu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Maddlu](https://forums.unrealengine.com/u/Maddlu)\
**Post date:** [November 24, 2021, 10:51pm UTC](https://forums.unrealengine.com/t/multiple-button-puzzle/491203/7 "2021-11-24T22:51:42Z")

</div>

I followed the video and this is what I did to the end of my button mesh blueprint, and what I added to my level blueprint. For some reason, the level blueprint is not getting called when I step on the button.

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [November 25, 2021, 12:43am UTC](https://forums.unrealengine.com/t/multiple-button-puzzle/491203/8 "2021-11-25T00:43:39Z")

</div>

When you right click the event Dispatcher and select Open Graph, make sure the first node is the only one with the variable:

 ![353029-screenshot-2021-11-24-203136.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/3/e/c3ec4b1ab5a1d72d5751cc583faf47e6fda5ee9f.png)

This is what the call node in the actor should look like:

![353030-screenshot-2021-11-24-203235.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/c/3/bc3a9927a5ff3fac7dc4ec855b6c255f69834e3e.png)

In the Level Blueprint, when you bind the event, make sure you create a matching event:

 ![353031-screenshot-2021-11-24-203417.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/8/0/9800ad311369697c26f78acdca3e8359ce77994e.png)

After that, it should work just fine:

![353032-screenshot-2021-11-24-203531.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/2/8/028e946180aeeef86fc63c5048632fa1ac6fb062.png)

The Compiler Results tab bellow tells you if there is a problem.
