ThenewGhost

Warper
Member
Joined
Jan 1, 2022
Messages
1
Reaction score
1
First Language
English
Primarily Uses
RMMV
I'm trying to implement a random password generator to open a door in the game, but to find the password, the player needs to find a paper with the password written in it, but actually i dont know how to do this.
Someone know how to implement this?
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
16,769
Reaction score
9,305
First Language
English
Primarily Uses
RMMV

I've moved this thread to MV Support. Thank you.

 

Htlaets

Veteran
Veteran
Joined
Feb 1, 2017
Messages
404
Reaction score
217
First Language
English
Primarily Uses
Well, there's the no-script no-plugin way and a script-y way.

The no-plugin way is to first randomize a variable over a range. Let's say 1-10. Then create a series of conditional branches for each possible number from that randomization, and each of those conditionals change a variable to a different word or series of words. Then, call that variable on the piece of paper and on the text input for the password to match it.

The script-y way I can't help you with, but googling will probably yield results. Javascript can read and parse text files, and assign index values to each word.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,799
Reaction score
6,619
First Language
English
Primarily Uses
RMMV
Just out of curiosity...is there a reason for it to actually be random? Unless you have something in your game that strongly encourages a person to replay it, it seems unlikely to matter. Not that it's a huge amount of effort, either way :smile:
 

Htlaets

Veteran
Veteran
Joined
Feb 1, 2017
Messages
404
Reaction score
217
First Language
English
Primarily Uses
A lot of games with puzzles randomize passwords so that you can't skip objectives and go straight to the password by looking at a guide.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,799
Reaction score
6,619
First Language
English
Primarily Uses
RMMV
...are there many people writing guides for indie RPG Maker games?

Regardless, that always falls in my mental camp of let the player do what they want with the product they bought...if they want to grind/use cheats/follow a guide, and playing that way is enjoyable to them, why should it matter to me to try to control it? :stickytongue:
 

Htlaets

Veteran
Veteran
Joined
Feb 1, 2017
Messages
404
Reaction score
217
First Language
English
Primarily Uses
It isn't just RPG maker games that do randomized passwords, though I can think of a few examples. Zero escape: VLR, for a non-rpg maker example, randomizes the passwords to get out of each room so you more or less have to go through the puzzles to progress. Going through the puzzles also has dialogue and story relevant details.

Basically, it's a good tool for ensuring that the player goes through things a certain order and sees certain content even if they use a guide.

For the OP's case, it could be that there's an important cutscene on the way to the password paper that would be missed if a player looked at a guide to bypass it.

In this case, it's a perfectly legitimate thing to do even if you don't agree with it.

As for the guide thing, there are plenty of threads just from a cursory google search that ask about how to randomize passwords in rpg maker with suggestions and the like.
 

GregorDuckman

Villager
Member
Joined
Oct 14, 2021
Messages
25
Reaction score
21
First Language
English
Primarily Uses
RMMZ
I'm trying to implement a random password generator to open a door in the game, but to find the password, the player needs to find a paper with the password written in it, but actually i dont know how to do this.
Someone know how to implement this?
I'll go over one possible way to do this using only events. To do this you'll need to understand how to use variables. I will assume your scenario is as follows: the player is trying to get through a passworded door. The player can find an event, a piece of paper, that has the number written on it, but they cannot take the paper with them, so they must remember the number. I will assume a 5 digit number. As with most of my explanations, the key step is to break your task into as many small pieces as you can.

First, you will have to decide when the number is generated. It could be at the very start of the game and is a piece of data that is carried along the entire game until it is needed. An alternative is, the number is generated at the moment you enter the area with the passworded door. Whichever it is, you must make sure not to overwrite the number in the variable editor until you're sure it will never be used again.

Then, you generate the number. For 5 digits, you want a number between 0 and 99999. From the Event Editor, go to Control Variables... and create a new one called "Locked Door Passcode". Press the Set" bubble and choose random, a number between 0 and 99999. Once this event runs, you will have your number. This number will persist between saves, as long as you don't call "Control Variables..." on this variable again. Make note of the number next to your new variable, as you will need it in the next step. Let's assume it's "123: Locked Door Passcode".

Next, you want your paper event to display the number in a basic message window. You create the event, Open the "Show Message..." option, and write something like "The password is \V[123]". This instructs RPG Maker to insert the value stored in Variable #123, our "Locked Door Passcode" into the message window. If you test it with the "preview" button, it will show a zero, but that's because all variables are zero by default. This will tell the player the random number we generated.

Now for the door. You can use the "Input Number..." option and select 5 digits, and set the variable to a new variable, for example "124: Passcode Input". This will store the 5 digit number you enter as a new variable. Then, you compare this variable to your previous variable using a Conditional Branch. If the two numbers are equal, then the door should open. In the "else" case, the password the player input is wrong, and the door shouldn't open.

I made this very basic so apologies if this is too basic or even too advanced for the advice you were looking for, but the kind of thing you're after is definitely possible without any scripting at all. Hope this helps!
 

ovate

tale
Veteran
Joined
Dec 16, 2016
Messages
1,049
Reaction score
1,765
First Language
English
Primarily Uses
N/A
Event page examples (image in spoilers)

Create an event with parallel process. (for generated variable)
In contents use Control Variable for Single 0002 paper, operation: Set, Operand: Random - 0 ~ 999 (3 digits) Then use the Control Self Switch: A =ON

cv1.png

On the same event, click on New Event Page and in Conditions click on check for Self Switch A is ON

cv2.png


For paper event, in contents use Show Text and put the control character \v[2] to show generated password. Click on the Graphic box to set an image for paper event.

cv3.png

Conditional event, requires the player to password by Input Number. Use a variable for password.
Then use Conditional Branch to set condition for correct input (Variable for paper = password) and else for incorrect
Don't forget to use Control Self Switch on second event page or this event repeats

cv4.png
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,799
Reaction score
6,619
First Language
English
Primarily Uses
RMMV
In this case, it's a perfectly legitimate thing to do even if you don't agree with it.
I didn't say it's illegitimate, and I wasn't arguing with you - I'm not sure why you're kinda jumping all over my responses here :stickytongue:

I posed the question to the OP simply to stimulate the train of thought to make sure what they want to do is worth the effort of implementation, regardless of of how much or little that is. I did not say they shouldn't do it, I didn't say you shouldn't do it, and I didn't say there was anything wrong with your answer.
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
7,509
Reaction score
3,019
First Language
Dutch
Primarily Uses
RMMV
running a variable to generate a passord in parallele = NOT needed,
but rather optional.

you mostly need 2 variables (so we use variable 1 and 2 here)
variable 1 is password, variable 2 is the check.

on boot of the game , variable 1 = -1 (this includes 00000 wont work)
as variabls starts with 0 (so 00000 will work)!

on paper, you randomize a password:

variable 1 = random 11111 - 99999 (or any numbers you see fit)
variable 1 set variable 2
Oh, look, the password I need is \v[1].
(you can grab the paper if you wish)
selfswitch A

on page 2
repeat \v[1] or leave empty.

on item description if taken, you can set \v[1] to be readed.

on the door page:
a conditional branch:

if variable 2 (password) = variable 1 (code)
you can open the door
else
you cant open it
end

which you can make random password.
I use a bit more complex version of this though, but it does the trick :)
 

Latest Threads

Latest Posts

Latest Profile Posts

will large empty map space cause lag?


ARPG battle helper event effect
making character designs is the hardest thing ever for no reason
Who turned on the industrial battle fan!?

Forum statistics

Threads
131,570
Messages
1,221,153
Members
173,266
Latest member
liampoolMV
Top