MV SDJB_SafeLockSystem

PluginName: SDJB_SafeLockSystem
Author: ShadowDragon

t2 (1).gif


Add a SafeLock mechanic to your game, read how it works.
Spoiler: How it works
Code:
 Introduction
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 This plugin introduces a SafeLock system to your game.

 Safes require a specific combination of dial movements to unlock.
 Each safe can be uniquely configured with its own dial size,
 visuals, sounds, and combination logic.

 The system is designed to be user-friendly and flexible,
 allowing simple or complex combinations depending on setup.

 Image path for the SafeLocks:  img/pictures/safelocks
 
 There are 3 images, where 2 are required:
 => Background image
 => Dial image
 => Overlay image (optional)


 Features
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 → Create multiple safes with unique names
 → Configurable dial size (10 ~ 100 positions)
 → Custom background, dial, and overlay images
 → Fully customizable combination sequences
 → Direction-based input (Left|Right)
 → Optional full rotation requirements per step
 → Sound effects for tick, success, and failure
 → Automatic self switch activation on unlock


 Controls
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 → Left Arrow  : Rotate counter-clockwise
 → Right Arrow : Rotate clockwise
 → OK          : Confirm current step
 → Cancel      : Exit the safe


 How It Works
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 Each safe consists of a full sequence of dial inputs.

 Every input consists of:
 → A turn direction as Left (L) or Right (R)
 → A target number on the dial
 → Optional full rotations before stopping

 The player rotates the dial using left/right input
 and confirms each position with the OK button.

 When the full sequence length is reached:
 → The lock evaluates the input sequence against the combination.

 If the full sequence matches the expected combination:
 → The safe unlocks
 → A self switch is activated

 If the sequence does NOT match:
 → The safe resets completely


 Combination Logic
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 A safe is solved by discovering the correct full sequence
 of directional dial inputs.

 The full sequence (order, values, and length) must match exactly.

 Players can freely rotate the dial between inputs.
 Only confirmed inputs are stored and evaluated as a full sequence.


 Example (Safe Max = 10)
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 Each combination step is defined by parameters:

 → Turn Direction: Left (L) or Right (R)
 → Target Number: dial position
 → Required Turns: full rotations before stopping

 These parameters form a sequence of steps.

 Step: (Turn Direction|Target Number|Require Turns)

 Sample 1:
 → Step 1: L|2|0
 → Step 2: R|4|0
 → Step 3: L|2|2
 → Step 4: R|2|0


 Sample 2 (Complex):
 → Step 1: R|4|0
 → Step 2: R|5|0
 → Step 3: L|2|2
 → Step 4: L|3|0
 → Step 5: L|3|3
 → Step 6: R|1|0
 → Step 7: L|3|0
 → Step 8: L|5|1
 → Step 9: R|3|0


 The safe only unlocks if the full sequence matches exactly


 Script Call
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 Start a safelock by name or index:

   this.startSafeLock("Vault");

 or

   this.startSafeLock(3)

 The name must match the configured safe name.


 Design Note
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 This system allows players to freely explore the dial.
 The solution is based on discovering the correct sequence,
 not performing precise step-by-step movements.

 This makes safes more puzzle-like and less mechanical.


 Puzzle Design Ideas
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 Safes can be designed with optional clue-based progression.

 Instead of giving the full combination directly,
 the solution can be split into multiple discovered pieces.

 These pieces are not required by the system,
 but can be used to guide the player toward the solution.


 Example Concept:
 → A safe requires 5 correct steps to unlock
 → The full combination is not given directly
 → Instead, players discover fragments of the code

 Once all fragments are collected,
 the full safelock sequence can be reconstructed.


 Example Encoding Idea:
 → 46365 can represent a full combination
 → Players may discover parts of this code through gameplay
 → These fragments help infer direction and targets


 Design Note:
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 This system supports flexible puzzle design approaches.
 Developers may choose how clues are distributed,
 including fragmented codes, hidden hints, or full exposure.

More lockpicking available for MV ^^


=== TERMS OF USE ===
Free for Non-Commercial and Commercial use when credit is given.
credit one of the following:
Pixeldrama (it's not on his page, but would be nice if you did)
ShadowDragon
ShadowDragonJB


=== WARNING ===
YOU ARE NOT ALLOWED TO REDISTRIBUTE OR SELL IT OR TAKE CODE FOR YOUR OWN.
DO NOT REMOVE THE HEADER.

(require my base plugin (SDJB_Base or SDJB_BaseMVZ (minified version))
leave Feedback and or suggestions.

Download from itch.io
nice , would make for an interesting noir detective type game
nice , would make for an interesting noir detective type game
or safes in banks, offices, etc that doesn't require a key 😛
but with the 2 lockpicks, you can solve 1 and the other if it needs both.

but this require probably some changes in both plugin.
now that I think about it, I need to add a switch ID in order to switch pages XD

I completely forgot that to add in.... but the foundation works, so it gets a bit more
delayed, so I can add the entire functional system into play, but its coming along.

and maybe.... just maybe, I make cross so it works in MZ if enough demands.
SafeLock System almost ready for release, and everything is wired
to the parameters for you to set up and call by its name or index.

Just the helpfile for its release, easy to setup:

use Left, Right, Left Right or start with Right, Left, Right, Left
or go crazy like Left, Left, Right, Left, Left, Right, Left.

whatever the combination, it isn't fully to strict as if your number
is Left 4 and you go to 3, you can go back to 5, than left 4.

reason for this is you MUST confirm with the OK to set.
if its incorrect, it reset to 0.

Stay tuned, for its release, just the helpfile only. (there will be 2 images included)
2 are required, 3rd is optional

required:
- background
- dial

optional
- overlay

Sounds isn't yet available, but will be later on (turning, success, fail sound).
only base sound is here playing on opening.

while the base dial (included), as max 10, you need to create new one
if max is different.

I may or may NOT, make a default layout for 10 through 100, in a square of 200x200
where you can add a circle size to it, add numbers.

default placeholders is what you see in the gif.
Safelock plugin is released. enjoy the plugin, hope it works for you all.
Keep in mind that sound settings aren't fully implemented yet, as there
are parameters ready for them to be used.

if there is any questions, suggestions, feedback, leave it behind 🙂

Original thread: https://forums.rpgmakerweb.com/threads/sdjb_safelocksystem.183371/