4 Digit code system

This guide will go over how to make a 4 digit code system for doors or aome random stuff. It will be randomized every time the game starts, to make it harder, and an input for it (with counters and buttons, you can do triggers too).

""Credits""

This guide by @Dragons_Bane came first (idk if I need to do that but when i post one people keep saying this):

System

This is how it should look like when done (not exactly like this but it should have these things):

Things Needed:

  • 8 Properties (yes its alot but you need em’, it also depends on how many digits your code is, digits*2 is the amount of properties you need.)
  • 4 Counters
  • 2 Triggers (6 if you use them for inputting the code)
  • 6 Buttons (2 if you use triggers for the code)
  • 5 Wire Repeaters
  • 1 Popup
  • 1 Overlay
  • 1 Lifecycle
  • 1 Repeater
  • 3 Block Codes
Code Generator

You will need to place 4 Properties, I reccomend to name them #1, #2, #3, etc. You can go up to like 8 digits, but it will be hard to make the block for checking if the code inputted is equal to one was generated. Set property type to number.

Then, place a Lifecycle, make sure it is set to Game start.
Place a Trigger, go to “Blocks”, and make a block for “When triggered”. In the block, make this script:

Screenshot 2023-11-13 2.03.44 PM

Wire the life cycle to the trigger with “When event occurs” to “Trigger”

You can make an overlay to display what the code is, place an overlay, go to blocks, make a block with channel, name it what you want and make block like this:

Screenshot 2023-11-13 2.06.59 PM

The amount of it will go up like in the trigger. They should also be in order so that it won’t be like (#4#2#1#3, it will mess up how you see it and you will have to guess the order).

For it to update, place a repeater, set its interval to 0.5, and stop strategy to “After recieveing on channel”, set the channel for “When task occurs” to the on e you made in the overlay. Wire the lifecycle to it and make it start the repeater.

When you play the game, it should show a number in the corner you set the overlay to be in.

Code Input

Place a button, a counter, and a wire repeater. This will be how the code will be inputted.
Go to the counter and set it’s target to 10. Then wire it all like this:

Button (or a trigger)>Counter: Button Pressed > Increment Counter;
Counter>Wire Repeater: Target Value Reached > Repeat Wire Pulse;
Wire Repeater>Counter: Wire “Pulsed” (or what idk) > Reset Counter.

What this does is when the counter goes up to 10, it will reset to 0.
Make a property named something like “Input#1”, go to the counter, “Property” tba, and set set the property to change to the property you just made.

Repeat this the amount of digits you have, changing the property to #2, 3, 4, etc.

Code Check

You will need a button (or a trigger) and a trigger. Wire the button (or you can use the trigger individually with player collision on). In the trigger, make a script something like this:

If Get Property ("#Digit") = Get Property ("Input#Digit") 
and (repeat this amount of digits increasing the digit of the = check
Then broadcast on channel (what you want)

I couldn’t make a screenshot for since the script is too “wide”, I don’t know if you can make out something from this:

And you’re done. The channel can be for like opening a door, or give an item.

Difficulty?
  • 0/10
  • 1/10
  • 2/10
  • 3/10
  • 4/10
  • 5/10
  • 6/10
  • 7/10
  • 8/10
  • 9/10
  • 10/10
  • 11/10
0 voters
2 Likes

Nice guide!

1 Like

Shlep I can’t edit to add difficulty screams

1 Like

Great guide, but adding BRAH- might not be the best idea, you know, flags?

1 Like

sorry for that I’ll remove it.

2 Likes

Hi I’m trying to use your guide but I cannot figure out the last block coding. Could you put two separate screenshots instead please? Also is the overlay required?

1 Like
  1. how much memory does this take up? I need to know to see if I can implant it to my game(s) also nice guide @Ele_Rals!

  2. I hope he still uses forum…it doesn’t look like it on profile…

With all the devices and blocks they had, 1%…. However i cannot get it to work! If you end up using it and it works for you, could you help me?

With all the devices and blocks they had, 1%…. However i cannot get it to work! If you end up using it and it works for you, could you help me

there is a much simpler way to do this… but i wont say it rn as i am busy

Sorry I was eating…sure I could try…Though it would probably be better to make a help topic or something as this would be near the end of the gamemode I am making and It will probably take a while.

Ok i will make a help topic :slight_smile:

I ALWAYS COME BACK.

What is your problem?

lol…. I figured it out :slight_smile:

Well I’m glad that you did, sorry I couldn’t help on time my laptop broke and it lost most of my stuff, and I forgot the password for my account and couldn’t get in…

1 Like

Lil’ update, you can use checkers in some cases instead of blocks for checking if the code entered was right. I didn’t know those existed until now lol.

this is essential for puzzle maps, bump :fire:

final bump of the day i hope :pray: