How to make a login console?

Hello everyone, im trying to create a login console for my game but i have no clue how to do it. I understand this can take a while to explain but if anyone has the time to do it, i would really appreciate it.

So i have this two consoles in my game.

What i want is to create a login system on the console on the right to give me permission to control the one on the left.

All i have right now is a camera switch when i get close to the console and press E

From here, the way i want this to work is the following:

First I want to pre-define a correct code, for exemple “3142”.

Then, I want to change the selected button (the orange color) whenever i press “shift” and confirm the number by pressing “enter”.

Whenever i select a number, the code above is updated

When i enter the correct order of numbers, the red light turns green and now i can interact with the other console

If the order is wrong, the code resets to 0000

Greetings @MikeCheck_3 !

We warmly welcome you to the Unreal Engine community! :medal_sports:

Just so you’re aware, this topic has been moved from the International forum category to the Programming & Scripting - UI forum category. I added the optional tag “Widget” for you.

Just remember, when posting, please review the categories to ensure your topic is posted in the most relevant space.

Wishing you the best of luck in your game dev journey,

Your Friendly Neighborhood Moderator :smiley:

Make the console have an ephemeral string called EnteredDigits and a configurable string called SecretCode

Make each of the buttons call a function AddDigit on the main console object passing their digit value as an argument. You can do this with “on clicked” or some other callback.

Inside AddDigit do something like (pseudocode):

AddDigit(string digit) {
  this->EnteredDigits += digit;
  if (this->EnteredDigits.Length() >= 4) {
    if (this->EnteredDigits == this->SecretCode) {
      EnableTheThing();
    } else {
      this->EnteredDigits = "";
      PlayErrorSound();
    }
  }
}

You’re probably doing this in blueprints, so you’d want to translate to a blueprint function.