If you have a new project, you can simply connect a ready-made character in your project! To do this, go to: //Project Settings/Maps & Mode/Default GameMode/ Here, just select BP_TST_GameMode and you will have a customized character.
Connecting your character
To connect the system to your character, simply add a component to the character BP_InteractComponent and choose BP_PlayerController in your BP_GameMode. After that just copy the control that is in the comments from the standard character Lock System or customize the management in your own way using the functions:
World Interact - To interact with locks
Hide - To close the lock menu
Pressed Button - To manage in widgets
Creating new items
In order to create an additional item using the lock system, you just need to create a child element. To do this, right-click on the subject and select the first item Create Child Blueprint Class. After that, you can make any settings in it.
BP_MasterLock - Parent class for all locks
BP_MasterKeys - Parent class for all keys
Castle events
Three events are used for locks:
Event Action on opening - Triggered 1 time when the lock is opened
Event Action - Triggered every time the player interacts with an open lock
Event Action on locked - Triggered 1 time when the lock is closed
Customizing items on the stage
Open? - Is the lock open?
Open Directly? - Can I open the item directly?
Random Cod? - Generate random code?
Length Cod - Code length
Cod - Code to open
Key - Key for opening the lock
On Lock Array - An array of addresses of locks that will be opened along with this one
Categories Widget - Selecting a widget when interacting
Components
BP_InteractComponent - A character component used to interact with castles
BP_LockSystemComponent - The lock component containing all the functionality
Adding Lock widgets
In order to add your widget to the system, you need to do 2 things. Write a clear name for this widget in the list E_CategoriesWidget. Then add it to the locks component at //BP_LockSystemComponent/Show / Hide Lock Widget/ and in the block select select the widget you created