Solve a simple math question to open a door

You can also use key events, but try to keep it simple and then work your way to more complicated solutions.

The textbox just holds the player input - the trigger to check if the input is correct should be (to keep it simple now) a button. Just throw a button on your widget canvas - and to make it look nicer throw a text onto the button. Change the text to “Solve”.

Now if you scroll down a bit on the button properties you can enable the “clicked” event. Do that and in the graph you can now define what happens at the clicked event.

Here is my blueprint from the button event.

Basically i just branch on condition.

I threw my textbox into the blueprint (GET), then use the “GetText” node to get the actual text from it, that goes to a textToString node, that goes to a StringToInt node, that goes to an “equals” (int) node where i just check if it equals to “2”. in the final version you wanna have a variable here that holds the solution to your random math equation. For the simple example a fixed one is good enough as a start. In the end we just branch to a print string to print “Correct” or “Wrong”.

For testing i just call the widget from a key pressed event in my level blueprint. For testing that is good enough.

Play a bit with that, then make it more complicated.