I'm trying to make a random password puzzle where the player finds a note that has a random 4 digit number in it and that number is the only number that will work on the safe, I tried making it as "◆Control Variables:#0162 password = Random 1..9999" but if the player opens the note again the password changes. I am really new to RPG Maker so I may not know the most simplest thing. Making it so that the player doesn't get past it by looking at a walkthrough/guide.
How to make a Random Password Puzzle
RPG Maker MV SupportHy, i made a few password events, you can find them here in my demo projec: https://forums.rpgmakerweb.com/index.php?threads/demo-town.141882/
To your problem, you did it right but everytime you call that event again you put another variable at random, so when you got it the first time, you have to stop the event somehow from changing that variable again, with selfswitches ect....
I tried everything from my very old project in RPG Maker 2000 (It's in Japanese).
Seemed like it worked, when I open the note though the password is just stuck in『0』.
Probably because I need to change it's constant but that'll just make it "not random but on purpose"
send us then pls pictures of the events but it should look something like this:
This one is generated directly in the event, its also static... if you want it like you said then it should look something like this:
This is one way to stop the number generating every time you activate the event.
This one is generated directly in the event, its also static... if you want it like you said then it should look something like this:
This is one way to stop the number generating every time you activate the event.
There lies the problem, everytime you run this event the variable changes so the password changes.
So could I do anything about it in an common event? I've seen your above solution, but I may go for another approach if there is one.
How do you call that common event? You could add there the variable generating event and then just switch it...
Programs are really an abstraction of reality.
Let's say you find a safe that is locked with a code. When is that code defined? Right before you read a note with the code in it?
In reality, the code is defined at the very beginning, and the note is written only after you have a code.
This means that you need to create those random numbers when your game starts (in an event that only runs once).
Let's say you find a safe that is locked with a code. When is that code defined? Right before you read a note with the code in it?
In reality, the code is defined at the very beginning, and the note is written only after you have a code.
This means that you need to create those random numbers when your game starts (in an event that only runs once).
Through items, basically.
Thats what he does not want, so the code is random for every gameplay... actually i saw such a thing in some games, wish i would remember one.. 😀
You can also generate the code anywhere, lets say at a door where you must go trough, then you turn the door just to 2nd page and it works normal again without changing your variable... Or you can put it in any cutscene, the point is just to generate the code once and never again, you can do it even automatically per autorun and then just turn it off...
EDIT: if you still want it only to generate in that common event, then you could do it with a switch, make a conditional branch with switch blabla OFF, then inside the condition generate the code and turn ON that swtich, so it wont ever generate again.. .
I think we have a misunderstanding.
If you define a random code whenever the player starts a new game, then the code will be different (random) for every playthrough.
@Nolonar is right. The most efficient way of doing this would be to have the random number generated in whatever autorun event opens the game. That way you know the number won't randomize again, and you can just call the variable when needed.
Yup, i did misunderstand, sry. ^^
How about a set of variables set at the beginning of the game that determine what the password is. And using the variables in text function to display it to the player?
The control variables in the note is triggering again when you open the note, so they need to be set somewhere else
The control variables in the note is triggering again when you open the note, so they need to be set somewhere else
Couldn't you just keep your Common Event as it is, but instead of
Control Variables: #0162 password = Random 0..9999
do a conditional
if #0162 password doesn't equal 0
Control Variables: #0162 password = Random 1..9999
end
That way the password is only generated the once and never gets changed. Though, do note, I started the random number with 1, not 0, because if it did select 0, it would be run again. Also, wouldn't it be better to keep the number of digits defined?
Control Variables: #0162 password = Random 1000..9999
Control Variables: #0162 password = Random 0..9999
do a conditional
if #0162 password doesn't equal 0
Control Variables: #0162 password = Random 1..9999
end
That way the password is only generated the once and never gets changed. Though, do note, I started the random number with 1, not 0, because if it did select 0, it would be run again. Also, wouldn't it be better to keep the number of digits defined?
Control Variables: #0162 password = Random 1000..9999
@Lady_JJ that is something smart, but keep in mind, if the note isn't
found one, and = equal to 0, 0 mostly works, so you need to start the
variable on boot game as -1, than your code can work 🙂
found one, and = equal to 0, 0 mostly works, so you need to start the
variable on boot game as -1, than your code can work 🙂
Putting the "#0162" Variable into -1 then generating the Ran. number worked!
I also had to remove the "Ran. Number" that only generates when opening the note,
that's where I went wrong when starting new game, I forgot to remove it from the common event.
Before opening the note again.
Thanks everyone!
Here's what I did if anyone is wondering:
◆Control Variables:#0162 password = -1
◆Control Variables:#0162 password = Random 1000..9999.
This thread can be closed.
I also had to remove the "Ran. Number" that only generates when opening the note,
that's where I went wrong when starting new game, I forgot to remove it from the common event.
Before opening the note again.
Thanks everyone!
Here's what I did if anyone is wondering:
◆Control Variables:#0162 password = -1
◆Control Variables:#0162 password = Random 1000..9999.
This thread can be closed.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-random-password-puzzle.145239/