Charas-Project

Game Creation => Requests => Tutorials => Topic started by: blackskullwarlock on March 02, 2005, 01:50:44 AM

Title: Puzzle - Align the Switches
Post by: blackskullwarlock on March 02, 2005, 01:50:44 AM
Hey! This is BlackSkullWarlock bringing you a tutorial about a fun puzzle you can insert in your games. The idea of the puzzle is to make all the switches 'look' the same way in order to open a door,chest or whatever you wish. Note that this tutorials will use the terms of Rpg Maker 2003.

Things to know:
-- Switches
-- Fork Conditions/Conditional Branch

Thing you need:
-- Five switches, one for each puzzle switches and one to complete the game
-- Six Events, one for each puzzle switches, one for the result and one to complete the puzzle

The coding isn't complicated since I will provide it all. It uses switches and fork conditions, some sound effects and the wait command.

Puzzle Switch 1, Page 1(Preconditions: None, Trigger Condition: Action Key):

<>Play Sound: Key
<>Switch Operation [XXXX: Switch1] ON
<>Branch if Switch [XXXX: Switch2] is OFF
<>Switch Operation:[XXXX: Switch2] ON
<>
: Else Handler
<>Switch Operation: [XXXX: Switch2] OFF
<>
END
<>Branch if Switch [XXXX: Switch3] is OFF
<>Switch Operation:[XXXX: Switch3] ON
<>
: Else Handler
<>Switch Operation: [XXXX: Switch3] OFF
<>
END

Puzzle Switch 1, Page2(Precondition:[XXXX:Switch1] is ON, Trigger Condition: Action Key):

<>Play Sound: Key
<>Switch Operation [XXXX: Switch1] OFF
<>Branch if Switch [XXXX: Switch2] is ON
<>Switch Operation:[XXXX: Switch2] OFF
<>
: Else Handler
<>Switch Operation: [XXXX: Switch2] ON
<>
END
<>Branch if Switch [XXXX: Switch3] is ON
<>Switch Operation:[XXXX: Switch3] OFF
<>
: Else Handler
<>Switch Operation: [XXXX: Switch3] ON
<>
END

Puzzle Switch 1, Page 3(Precondition:[XXXX:PuzzleSolved] is ON, Trigger Condition: Action Key)

BLANK

Puzzle Switch 2, Page 1(Preconditions: None, Trigger Condition: Action Key):

<>Play Sound: Key
<>Switch Operation [XXXX: Switch2] ON
<>Branch if Switch [XXXX: Switch1] is OFF
<>Switch Operation:[XXXX: Switch1] ON
<>
: Else Handler
<>Switch Operation: [XXXX: Switch1] OFF
<>
END
<>Branch if Switch [XXXX: Switch4] is OFF
<>Switch Operation:[XXXX: Switch4] ON
<>
: Else Handler
<>Switch Operation: [XXXX: Switch4] OFF
<>
END

Puzzle Switch 2, Page2(Precondition:[XXXX:Switch2] is ON, Trigger Condition: Action Key):

<>Play Sound: Key
<>Switch Operation [XXXX: Switch2] OFF
<>Branch if Switch [XXXX: Switch1] is ON
<>Switch Operation:[XXXX: Switch1] OFF
<>
: Else Handler
<>Switch Operation: [XXXX: Switch1] ON
<>
END
<>Branch if Switch [XXXX: Switch4] is ON
<>Switch Operation:[XXXX: Switch4] OFF
<>
: Else Handler
<>Switch Operation: [XXXX: Switch4] ON
<>
END

Puzzle Switch 2, Page 3(Precondition:[XXXX:PuzzleSolved] is ON, Trigger Condition: Action Key)

BLANK

Puzzle Switch 3, Page 1(Preconditions: None, Trigger Condition: Action Key):

<>Play Sound: Key
<>Switch Operation [XXXX: Switch3] ON
<>Branch if Switch [XXXX: Switch1] is OFF
<>Switch Operation:[XXXX: Switch1] ON
<>
: Else Handler
<>Switch Operation: [XXXX: Switch1] OFF
<>
END
<>Branch if Switch [XXXX: Switch4] is OFF
<>Switch Operation:[XXXX: Switch4] ON
<>
: Else Handler
<>Switch Operation: [XXXX: Switch4] OFF
<>
END

Puzzle Switch 3, Page2(Precondition:[XXXX:Switch3] is ON, Trigger Condition: Action Key):

<>Play Sound: Key
<>Switch Operation [XXXX: Switch3] OFF
<>Branch if Switch [XXXX: Switch1] is ON
<>Switch Operation:[XXXX: Switch1] OFF
<>
: Else Handler
<>Switch Operation: [XXXX: Switch1] ON
<>
END
<>Branch if Switch [XXXX: Switch4] is ON
<>Switch Operation:[XXXX: Switch4] OFF
<>
: Else Handler
<>Switch Operation: [XXXX: Switch4] ON
<>
END

Puzzle Switch 3, Page 3(Precondition:[XXXX:PuzzleSolved] is ON, Trigger Condition: Action Key)

BLANK

Puzzle Switch 4, Page 1(Preconditions: None, Trigger Condition: Action Key):

<>Play Sound: Key
<>Switch Operation [XXXX: Switch4] ON
<>Branch if Switch [XXXX: Switch2] is OFF
<>Switch Operation:[XXXX: Switch2] ON
<>
: Else Handler
<>Switch Operation: [XXXX: Switch2] OFF
<>
END
<>Branch if Switch [XXXX: Switch3] is OFF
<>Switch Operation:[XXXX: Switch3] ON
<>
: Else Handler
<>Switch Operation: [XXXX: Switch3] OFF
<>
END

Puzzle Switch 4, Page2(Precondition:[XXXX:Switch4] is ON, Trigger Condition: Action Key):

<>Play Sound: Key
<>Switch Operation [XXXX: Switch4] OFF
<>Branch if Switch [XXXX: Switch2] is ON
<>Switch Operation:[XXXX: Switch2] OFF
<>
: Else Handler
<>Switch Operation: [XXXX: Switch2] ON
<>
END
<>Branch if Switch [XXXX: Switch3] is ON
<>Switch Operation:[XXXX: Switch3] OFF
<>
: Else Handler
<>Switch Operation: [XXXX: Switch3] ON
<>
END

Puzzle Switch 4, Page 3(Precondition:[XXXX:PuzzleSolved] is ON, Trigger Condition: Action Key)

BLANK

Puzzle Solved, Page 1(Precondition:None, Trigger Condition: Paralle Process, Event Layer: Below Hero)

<>Branch if Switch[XXXX: Switch1] is ON
<>Branch if Switch[XXXX: Switch2] is ON
<>Branch if Switch[XXXX: Switch3] is ON
<>Branch if Switch[XXXX: Switch4] is ON
<>Play Sound:Success2
<>Wait: 0.8 Sec
<>Play Sound: Open1
<>Switch Operation:: [XXXX: PuzzleSolved] ON
<>
: END
<>
: END
<>
: END
<>
: END
<>

This ends the very long coding part. To make the explanation short, all these codes makes some puzzle switches moves when you push them. The final event (Puzzle Solved,Page 1) is where you should put whatever happens once all the puzzle switches have been aligned. In my case, it was a door that opened. Feel free to experiment with the code and if you find any mistakes, private message me with the correction.

Well that's all folks!
Title:
Post by: InsaneJP on March 02, 2005, 02:05:01 AM
Hey i like the tutorial but do you have maybe a screen shot of what yours looks like IN the game??
Title:
Post by: blackskullwarlock on March 02, 2005, 02:37:45 AM
Quote
Originally posted by InsaneJP
Hey i like the tutorial but do you have maybe a screen shot of what yours looks like IN the game??


Sure, here it is with a small explanation.

What the above codes do is very simple. Once all the red switches (currently facing right) will face left, the spikes will lower and the door will open. The trick is if you activate one switch, it will switch those adjacent as well!

Example: You press switch 1(Upper Left) and it turns to left but so does switch 2 and 3(Upper Right and Lower Left respectively).  If you decide to press switch 4(Lower Right) it would turn to left but both switch 2 and 3 would turn right again. Get the trick?
Title:
Post by: InsaneJP on March 02, 2005, 02:44:58 AM
yeah that explains it alot better i could probably use it in my game ;)