Charas-Project

Game Creation => Requests => RPG Maker Programming => Topic started by: elementalhero76 on September 19, 2006, 03:15:55 PM

Title: Sound puzzles
Post by: elementalhero76 on September 19, 2006, 03:15:55 PM
Gong puzzle

I started a puzzle where you read a sign in the dungeon and it tell you the order of touching the panels by a series of gong sounds at different pitches. Now not far from that sign are four music note panels when touched make thoes sounds. now how do i program the pattern expressed on that sign in that order  in which i had it? And can anyone tell me how to make numbers appear when you mess up three times or so?
Title:
Post by: WarxePB on September 19, 2006, 07:32:56 PM
This would be a situation where variables would be useful. You would need to have 5 variables - Gong1, Gong2, Gong3, Gong4, and Attempts. When you activate a sound, it would check (via branches) if any of the first 4 variables were set to anything.

Code for that would look like:

<>Branch if Var[0002:Gong1] is 1 or more
|<>Branch if Var[0003:Gong2] is 1 or more
||<>Branch if Var[0004:Gong3] is 1 or more
|||<>Branch if Var[0005:Gong4] is 1 or more
||||<>(Nothing happens here)
|||<>Else Handler (Gong4)
||||<>Variable Operation: Var[0005:Gong4] Set, 1 (or whatever gong is touched)
||||<>
|||<>End
|||<>
||<>Else Handler (Gong3)
|||<>Variable Operation: Var[0004:Gong3] Set, 1
|||<>
||<>End
||<>
|<>Else Handler (Gong2)
||<>Variable Operation: Var[0003:Gong2] Set, 1
||<>
|<>End
|<>
<>Else Handler (Gong1)
|<>Variable Operation: Var[0002:Gong1] Set, 1
|<>
<>End
<>

Now, when the fourth gong is hit, it will check if it's the right order. To do this, create a Parallel Process event, with preconditions set to "Variable Gong4 is 1 - Greater or equal". The code would look something like:

<>Branch if Var[0002:Gong1] is 4
|<>Branch if Var[0003:Gong2] is 1
||<>Branch if Var[0004:Gong3] is 4
|||<>Branch if Var[0005:Gong4] is 3
||||<>You solved the puzzle. Continue on with the code here.
||||<>

In the Else handlers, use a Variable Operation to add 1 to the Attempts variable. At the end of the Parallel Process event, create a branch that checks if Attempts is 3. If it is, then do whatever you want to help the player out.