It took some time, But I've re-created the exact same system that I used for this... I had to do this so that it does not sound confusing while trying to explain. I also didn't want to send the actual file because it download size is kinda big, so this here is simple and low on the memory(I hope)!:
download
Before start: This is the first puzzle I'm making, and I don't have too much experience with RPGMaker VX Ace... So you may see a lot of code that is repetitive, I hope I didn't make too many useless program in it... Also, I made some variables to keep track of the cursor location (checks "which tile is it currently over?") while other variables are for checking where the cursor should be when a button is pressed, I made this picture showing how the up/down and left/right variables keep track of the cursor position:
Spoiler
[IMG]http://i702.photobucket.com/albums/ww25/emperor24/Sample2_zps0c1e8906.png[/IMG]
The top numbers represent left/right movements while the side numbers represent up/down movements
Goal: create a puzzle using pictures that requires the player to select two tiles and swap their positions to reveal the solution code, every time the player exits, the scene will remain the same (not yet programmed) until the reset button is pressed (not yet programmed)... when the solution is found, they may enter the code in the solution box on the bottom right of the puzzle (also not programmed) and unlock a switch.
How I did it: First, I had to make an event that would activate and load all the pictures when started... the second page is the processor that takes all the players button inputs and returns a result depending on the button pressed. After making all the button controls, I had to make a common event with all the information that can be gathered and used (such as updating the highlight cursor and changing tile positions (not yet programmed, stuck on this)... After finishing the common event and making all the proper requirements (using conditional switches), I began working on what would happen if "spacebar" is pressed the first time... what this does is that it gathers the data on that certain tile and saves it in a variable so that the cursor can remain there until the second tile is selected. the second time "spacebar" is pressed, the parallel processor changes it's instructions and should begin the "swap picture position" function... but I cant do that without storing the picture number ID inside a variable first.
I want to store the picture ID inside a variable so that later on I can use a script call to show a picture in the proper spot using this script call function to show images "screen
.pictures
[index
].show
(file_name
, upperleft
/center
, x
, y
, x zoom
, y zoom
, opacity
, blend type)" and all I would have to do is make the picture index the variable with the previous picture selected... that's why I asked if anyone knew how to store a picture ID inside a variable, I needed some kind of way to make the system remember which was the last picture selected so that I can program something to make them swap positions.
EDIT: added mechanics
- when the scene is accessed, the player can move the cursor and select two tiles to swap with eachother
- the first time you select a tile, the system should display a cursor on that spot, and also store information on the picture ID number (we will know what picture the player is currently on because of the two variables that keep track of the location.. to keep track of picture location after swapping, I would have to make variables store information about each tile)
- the second time you select a tile, the system should remove the first cursor and begin processing the swap function
- the solution to this puzzle is that you can only create one possible answer 486 which you may enter into the passcode box (the answer can actually just be entered without solving the puzzle). In order to prevent the player from creating a wrong solution such as "684" or "846", I would have to lock 1 tile on each number.
EDIT 2: I forgot to say:
- the puzzle you are looking at is already solved, I was planning to manually re-arrange each block so that the player would have to solve the puzzle to show the code, and enter that into the code box
- everything is done on the map, in the demo I used 4 events (1 event for the processor and the other 3 to lock the player from moving), 1 common event (for all the functions to be called by the processor), and a lot of variables and switches.
I hope that I covered everything and made it easier to understand what I was trying to accomplish in this system...