# Gw Temp

## Tutorial - 'Sliding Puzzle' by Yoshmaster

An item about RPGMaker 2000 posted on

### Blurb

Ever played one of those little puzzles where you have to slide pieces? This shows you how to make one for your game!

### Body

Okay.
This is a tutorial about how to make a sliding numbers puzzle for a mini-game.
This is NOT for beginners and requires a lot of patience.
You need to understand
Variables
Fork conditions
Labels

OK

You should start like this:

6 3 5
2 7 4
1 8

or any other random scabble.
And finish like this:

1 2 3
4 5 6
7 8

Fun, huh?
Now for the scripting.

Make 9 variables called
Number 1
Number 2
...
Number 9

Now make 9 events called
Spot 1
Spot 2
...
Spot 9

Each event should have 9 pages

Page 1
Start conditon: Variable XX > 0
Auto Start
Graphic: Blank

Page 2
Start condition: Variable XX > 1
Auto Start
Graphic: 1

And so on.. X being the representive number.
Spot 1 gets Number 1 and so on.

Next you make a scamble event
Make it change variables 1-9
Into a random number between 0 and 8
Then make a script that will make sure that a number doesn't repeat itself. Like this:

Fade screen (So the player won't see the scambling)
Label 1
V. change Number 1 Rand 0-8
V. change Number 2 Rand 0-8
...
V. change Number 9 Rand 0-8

Fork Number 2 = Number 3
Go to label 1
End

Fork Number 2 = Number 4
Go to label 1
End

...

Fork Number 2 = Number 9
Go to label 1
End

Fork Number 3 = Number 4
Go to label 1
End

And so on until

Fork Number 8 = Number 9
Go to label 1
End

I know. Tons of script.
If anybody knows a better way, write to me.

If you want you can make another script on the same page to prevent the number to be it's neigbor (i.e. 1=2 2=3 )to stop the puzzle from being two steps away from being solved, just like the script above.

Next make a seperate event with the password action into a 10th variable ( Let's call it "action")

Next make 9 Auto start events with four pages
One with variable action condition-1(down)
One with two (right)
One with three (left)
One with four (up)

Make a switch condition on each of the pages
Condition : Switch "XX=0" ON

Note : Only the middle one needs 4 pages
The corners need two and the sides need 3
respective to the number of ajacent spots.

Let's take Spot 5 for an example,
On the page with up condition.

Change variable Number 5 = Number 8
Change variable Number 8 = 0

And so on in all the pages in all nine events.

Now make another Auto start event

Fork Number 1 = 0
Switch "1=0" On
End

Fork Number 2 = 0
Switch "2=0" On
End

and so on.

Got it?

Finally make an Auto start event

Fork N.1 =1
Fork N.2 =2
...
Fork N.9 =9
Switch "Winner" ON
[End] x9

And make a final event with winner switch condition that switches of all the switches an zeros all the variables , and gives the player a prize.

There. That's it.
You should have a puzzle game
Comments, questions, remarks , and bug reports
eagerly anticipated ('Cept for the bug reports)

I'm giving myself a huge pat on the back, <-ow-> and like pie very much

Yoshmaster