Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How do I create keypad widget to unlock safe?

I'm trying to create a widget for a keypad that unlocks a safe. I have the basic logic and the widget made, but I need to know how to do the following: Set the 4 digit password, make the keys function, whenever you type a number it shows up on the screen, resets upon failure, sound effects upon entering key, failure, and success, and a way to close the widget by either walking away from it or pressing "E". Any help would be greatly appreciated.


Product Version: UE 4.21
more ▼

asked Feb 10 '19 at 12:42 AM in Using UE4

avatar image

1 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

so you basically havent started then huh. below you will find a basic example of how this could be done.

the first picture shows the widget script, for this example i made a 3 key keypad to keep it simple. ok so create a widget and add a button for each button you want on the keypad (probably 10, 0-9). next add a text component (text block). now go into the graph section and create two text type variables, comboInput and CorrectCombo. now go back to the designer and bind the text to the comboInput variable. back to the graph (enough with the back and forth right).

next we will work on the main functions script, we will begin at the end (bottom of picture) by creating the test combo event which will test if the combo entered matches the correct combo. we d othis test simply with a equal node (==) then a branch, if true then the combo is right and we do something, if false the combo is wrong and we reset the variable. the next event we will work on is the update combo event which will serve to add numbers to the variable as we enter them. here we take a input parameter and append it to the current Comboinput then we set the comboInput variable. we then test the length of the variable and if it matches the length we want then we test to see if its the right combo with the test combo event. note that i ran into some unexpected behavior with this last section where i had to set the greater than equal(>=) node to one value higher than what i testing for so 4 became 5. ok now on to the last step here, create a on click event for each of the buttons and connect to them a call update combo node as shown and make sure to set the parameter as well. oh i also noticed you asked about sounds as well, this is where you would play a sound for a button press

the second picture shows how you could setup the creation of the widget based on your requirements. i didnt test this bit but it should work. it seems a bit complex but its not too bad. do note that this is where you set the correct combo variable so you could have many of this same kind of keypad with different combos in your level.

alt text

alt text

capture.png (375.8 kB)
capture1.png (283.4 kB)
more ▼

answered Feb 10 '19 at 04:09 PM

avatar image

10.1k 33 10 23

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question