Sequential puzzle issues.

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
So I've got a puzzle of sorts that requires the player to perform actions in a specific order. I've looked up how to make sequential puzzles before, but after following what worked for them, it appears I am either doing it wrong, or our puzzles are just different enough that I need something different.

My "puzzle" so to speak is playing a 9-note ditty on a toy piano for a character, notes corresponding with numbers on your keyboard. So, I set up a "controller event" of conditional branches that would check to see if you've pressed the right numbers in the right order (by the way, the sequence is 3 2 3 1 5 3 8 7 2, so yes the sequence of script calls are correct).

The first page would check to see if the first key in the sequence has been pressed, turning on the piano switch.



This is where the conditional branches would be. Each time you got one right, it would add +1 to the Piano variable, and then check to see if you got the next one. But if not, if would set the variable back to zero, and turn off the piano switch, which I would assume send you back to the first page?



(Okay when I was working with this I had screencapped the page above before adding a third page, but this event does have a third page in the next screencap)

Then, after you get each key done in the right sequence, it would add up to +8 of the variable, which the third page would check.



I just have "Yay!" there in place of me designing the rest of the scene.

I'd think that this would work, but obviously I'm doing something wrong. Can anyone help?
 
Last edited by a moderator:

LostFonDrive

Veteran
Veteran
Joined
Feb 13, 2015
Messages
173
Reaction score
52
First Language
English
Primarily Uses
What exactly is the issue you're getting when you try this out?
 

supercow

Artist
Veteran
Joined
Jul 16, 2013
Messages
383
Reaction score
146
First Language
indonesia
Primarily Uses
the 2nd page usage of conditional branch is weird .

why not just just make 9 page and you dont need to use switch (maybe) just use variables for Conditions if you already using variable to remember the count.
 

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
What exactly is the issue you're getting when you try this out?
The issue is that it doesn't work. The text box doesn't appear after I finish playing the sequence.

the 2nd page usage of conditional branch is weird .

why not just just make 9 page and you dont need to use switch (maybe) just use variables for Conditions if you already using variable to remember the count.
...Do mean make 9 pages...?

The thing I looked up before where someone had a question about a sequential puzzle, this is basically what they did unless I read it wrong. They had a bunch of conditional branches inside conditional branches that added variables, but the Else caused the variable to go back to zero.
 
Last edited by a moderator:

supercow

Artist
Veteran
Joined
Jul 16, 2013
Messages
383
Reaction score
146
First Language
indonesia
Primarily Uses
there needs to be an additional conditional branch for the variables [017] to check otherwise the check is gonna get confused why would it continue to the other conditional branch .

conditional branch variables [017] = 1 (no else)

conditional branch input 2

variables 017 +1

else fail (decrease var etc)

conditional branch variables [017] = 2 (no else)

conditional branch input 3

variables 017 +1

else fail (decrease var etc)

etc

at least thats how im gonna fix it , i could be wrong.

the 9 pages , pages is the number in the top left
 
Last edited by a moderator:

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
there needs to be an additional conditional branch for the variables [017] to check otherwise the check is gonna get confused why would it continue to the other conditional branch .

conditional branch variables [017] = 1 (no else)

conditional branch input 2

variables 017 +1

else fail (decrease var etc)

conditional branch variables [017] = 2 (no else)

conditional branch input 3

variables 017 +1

else fail (decrease var etc)

etc

at least thats how im gonna fix it , i could be wrong.

the 9 pages , pages is the number in the top left
I'm a little confused about the conditional branch set up you're talking about. If it's not too much trouble, could you make an example of what you're trying to show in RPG Maker and send a screencap?

And also I don't see why I would need 9 separate pages.
 

EatYourBeetS

The Abysswalker
Veteran
Joined
Feb 23, 2015
Messages
96
Reaction score
30
First Language
Italian
Primarily Uses
Try this

Together with self switch A = true you can put any condition or line of code you need, just make sure to exit event processing after that.

Edit: Sorry, there's a typo, instead of setting @i=0 you have to set @i=nil, in the last script I wrote
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,669
First Language
German
Primarily Uses
RMMV
The problem with any check for button pressed is that it checks the button in that exact frame/moment.


Which means that the sequence can only work like your intention if you'll be able to press each button within 1/60 of a second and switch to the next valid button in the next 1/60 of a second.


If you want to have any pause of more than that 1/60 second in your button sequence, you need to check the status (the piano variable) each time before checking whether or not a button is pressed.


Theoretically you don't need to use nine pages - but spreading the sequence over different pages (each conditioned to the current number of the variable) is a lot easier than the logic for combining those parts into a single page.


If you really want to make it into a single page for the entire sequence, then you need to place a loop around each check for button pressed, and that loop has to be placed inside a conditional branch for checking the current variable status.
 

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
@AbyssWalker

Woah, that is all gibberish to me, but I added it in (changing the number of the variable of course to 17 for the Piano), buuut... it's not working :c Maybe it has something to do with the number input...? I'm using this script to make it possible for me to use the numbers on the keyboard.

@Andar

Sadly I have no idea how to use loops.
 
Last edited by a moderator:

EatYourBeetS

The Abysswalker
Veteran
Joined
Feb 23, 2015
Messages
96
Reaction score
30
First Language
Italian
Primarily Uses
Have you changed @i=0 to @i=nil , and changed both the first line and the first conditional branch to variable 17?

I must tell you that this asks you to select a number with directional arrow instead of a direct input (Joypad friendly), is it still ok?

If it's not I will think of something else.
 
Last edited by a moderator:

C-C-C-Cashmere (old)

Resident Weirdo
Veteran
Joined
Mar 7, 2014
Messages
832
Reaction score
341
First Language
English
Primarily Uses
Does the number input actually work? Have you tried just activating a message by pressing a single number?
 

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
Have you changed @i=0 to @i=nil , and changed both the first line and the first conditional branch to variable 17?

I must tell you that this asks you to select a number with directional arrow instead of a direct input, is it still ok? If it's not I will think of something else.
Here's what I have:



EDIT: Oops, looks like I missed an @ on i += 1... But I just changed it, and it still doesn't work.

EDIT2: Made it a parallel process, and then the number input came up. I didn't know that's what you meant by number input, and that's not what I mean. What I mean by the numbers is you press numbers on your keyboard, then the picture of the toy piano keys on your screen will change to look like corresponding keys are being pressed, and a note will chime. Here's the event that controls that:

Does the number input actually work? Have you tried just activating a message by pressing a single number?
Yes it does. I can even play Mary Had A Little Lamb.



Not to brag but look how cute this thing is.
 
Last edited by a moderator:

C-C-C-Cashmere (old)

Resident Weirdo
Veteran
Joined
Mar 7, 2014
Messages
832
Reaction score
341
First Language
English
Primarily Uses
What happens if you use this, and then put a "show message" after the final note? Does it activate?
 
Last edited by a moderator:

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
What happens if you use this, and then put a "show message" after the final note? Does it activate?
I don't know what a "show message" is, and I think Andar is right about the loop thing. But, I don't know how to use loops. Can someone explain that to me?
 

C-C-C-Cashmere (old)

Resident Weirdo
Veteran
Joined
Mar 7, 2014
Messages
832
Reaction score
341
First Language
English
Primarily Uses
I don't know what a "show message" is, and I think Andar is right about the loop thing. But, I don't know how to use loops. Can someone explain that to me?
Just a message. Like, a regular message. To see if it's activated at that point. Never mind, go with the loop one then.
 

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
I still need to know how loops work...
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Your event is wrong, you can not use parallel process like that for this puzzle.


The issue comes from the else parts of your conditional branches.


Parallel process events execute constantly, so with your event, the puzzle will be reseted after 1 single frame all the time, because it is impossible for the player to press that many buttons within 1 frame.


Here is what I did:


1. Make an autorun event with this:


puz2.PNG


Yes, it contains script commands, but it is not hard to understand them, I think.


What we did here?


We made variable 1 to be considered as an array.


We made variable 3 to be the required sequence for the puzzle.


The letter I used represent the button triggers I will use in the next common event. You can replace them with numbers if you use those for triggering the "notes" for your puzzles.


And lastly, we turned on the switch for the next parallel common event.


2. Now make a parallel common event like this:


puz1.PNG


Yeah, some more script commands, slightly harder to understand, but still not complicated at all.


Let's see what happens here:


The first line is basically a switch, but I used a scripted "switch" instead of a built-in one. That line is initializing the scripted switch to be "false" at startup. This line will only run once in the entire common event, regardless of the common event being a parallel process!


After this, I used 4 conditional branches to check for button inputs. I used the default inputs available in RPGMaker, but you can change them to your own buttons, like :num3 or so, which you used in your event. You can also make as many checks like these as you want.


As you can see, there is no else part of these branches. This is important, we don't need else parts!


In each of these checks, comes a script command again.


This script call will add the pressed buttons letter to the array we created. Remember, we used variable 1 for this in the autorun event. Initially it was an empty array. After each button press, something will be added into that array in the order of buttons pressed. I used letters, but it can be anything, symbols or numbers too.


After adding the letter to the array, we turn ON the scripted switch we initialized at the start of our event. This will activate the next part of the common event.


So, below all of your button press checks there comes the comparison of the two arrays we created.


As you can see, it will only run if the scripted switch is turned ON, which means only after a button has been pressed.


Variable 1 holds the current sequence, while variable 3 (which we predefined in the autorun event) holds the correct sequence.


Inside the scripted switch check, comes another one which will compare the currently pressed button with the required sequence at the right position in the arrays. This check is not fully visible, so here it is:

$game_variables[1][$game_variables[2]] == $game_variables[3][$game_variables[2]]What this means?
Well, the elements in the array are counted from left to right. The first element's index is 0, the second one's index is 1, and so on.


So, effectively, this check will compare the values in the array at the same position. If they match, it will add +1 to Variable 2, which we use to track the number of already pressed buttons, as well as the right positions for the checking method used in the conditional branch above.


If the player pressed the right button, a sound effect will be played. This is totally optional, of course. After this, comes another check. This is the final check. If the two arrays match, the puzzle ends with an ME played and a text shown for the player. It also resets the puzzle (optional) and switches it off.


Let's take a look at the else part of the conditional check.


This will trigger if the player pressed the wrong button. It resets Variable 2 (the position counter), and empties the sequence. Effectively, if the player fails a button, the puzzle will be reseted.


After this, you must turn OFF the scripted switch, so it stops checking for this part until the player press another button.


This works for me. Although I get a lot of frame-skipping and the button press sometimes won't trigger the effect. I hope that is just my laptop being a crappy one. :D


Change what you need in the above example, and you should be able to make your puzzle.
 

supercow

Artist
Veteran
Joined
Jul 16, 2013
Messages
383
Reaction score
146
First Language
indonesia
Primarily Uses
-failed-
 
Last edited by a moderator:

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
This works for me. Although I get a lot of frame-skipping and the button press sometimes won't trigger the effect. I hope that is just my laptop being a crappy one. :D

Change what you need in the above example, and you should be able to make your puzzle.
There is a lot of frame skipping it seems D: Like... sometimes it works, sometimes it doesn't. Maybe I need to add some very quick wait times...?
 

supercow

Artist
Veteran
Joined
Jul 16, 2013
Messages
383
Reaction score
146
First Language
indonesia
Primarily Uses
weird i seems to have lost touch with event :guffaw: , used to be easy enough, ill look into it .
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top