Help with making a puzzle

1669636581135.png

I'm fairly new to RPGMAKER MZ and have been trying to make a sokoban type puzzle. I've watched a few tutorials but haven't
really understand how any of it works. The above image is just some level I copied to base my test on.
I'm trying to figure out how to make it so when all of those rocks are above the blue coloured platforms, an event will trigger,
I have the moving aspect of the rocks done but have no clue where to start to have the game recognise the rocks being above said platforms and making it trigger an event.
I also am not quite sure on how to make a reset button but I can probably figure that out myself with some playtesting.
variables would do wonders for this. simply have a parallel event say "if variable X equals Y the Z happens." X in this scenario is the variable, Y is the number that is set by the parallel event or added on and Z is what happens if the block enters the blue square.

although this is all speculation, what does the event page look like for each of the rocks?
you can rather too instead of variables, check if they are all on region 1.
have it count the rocks would be the easiest way.

but you can make a longer list based on rockX/Y (4 rocks require 8 variables).
and nested conditional to check the places on the mapX/Y.

there are some methodes how to pull this one off, even with switches.
if they are all ON, a new level is open (which you can reset) to OFF.

search a tutorial on how to do "weight switches" which is ideal for rocks as well.
switches or region count is probably the best approach for this kind of puzzles.
I have a MV example, i believe in MZ the Eventcommand Get Location Info can directly select an Event, in MV we need some Variables.
Create this Event 1 Time, than just copy Paste it to get 4, no Editing needed.
You need to Paint the Region with the Number 5 to the spots where you want the Rocks to be pushed to.

Without the Sound Effect the Code could look like this:

Code:
◆Set Movement Route:This Event (Skip)
:                  :◇Turn away from Player
:                  :◇1 Step Forward
◆Wait:2 frames
◆Set Movement Route:Player (Skip, Wait)
:                  :◇1 Step Forward
◆Control Variables:#0003 magic_x = Map X of This Event
◆Control Variables:#0004 magic_y = Map Y of This Event
◆Get Location Info:var5_info, Region ID, ({magic_x},{magic_y})
◆If:var5_info = 5
  ◆If:Self Switch A is OFF
    ◆Control Self Switch:A = ON
    ◆Control Variables:#0013 Puzzle_Count += 1
    ◆
  :End
  ◆
:Else
  ◆If:Self Switch A is ON
    ◆Control Self Switch:A = OFF
    ◆Control Variables:#0013 Puzzle_Count -= 1
    ◆
  :End
  ◆
:End
◆If:Puzzle_Count ≥ 4
  ◆Control Switches:#0003 Puzzle Finished Switch = ON
  ◆
:End

puzzlerockhelp012254.png
What Bex showed is a simple way to do this - just check after each movement if the boulder is in the right place.

As far as a reset button, you simply use the Set Event Location command to put each boulder wherever you want it to go back to, then put your variable tracking the puzzle back to 0.
I have a MV example, i believe in MZ the Eventcommand Get Location Info can directly select an Event, in MV we need some Variables.
Create this Event 1 Time, than just copy Paste it to get 4, no Editing needed.
You need to Paint the Region with the Number 5 to the spots where you want the Rocks to be pushed to.

Without the Sound Effect the Code could look like this:

Code:
◆Set Movement Route:This Event (Skip)
:                  :◇Turn away from Player
:                  :◇1 Step Forward
◆Wait:2 frames
◆Set Movement Route:Player (Skip, Wait)
:                  :◇1 Step Forward
◆Control Variables:#0003 magic_x = Map X of This Event
◆Control Variables:#0004 magic_y = Map Y of This Event
◆Get Location Info:var5_info, Region ID, ({magic_x},{magic_y})
◆If:var5_info = 5
  ◆If:Self Switch A is OFF
    ◆Control Self Switch:A = ON
    ◆Control Variables:#0013 Puzzle_Count += 1
    ◆
  :End
  ◆
:Else
  ◆If:Self Switch A is ON
    ◆Control Self Switch:A = OFF
    ◆Control Variables:#0013 Puzzle_Count -= 1
    ◆
  :End
  ◆
:End
◆If:Puzzle_Count ≥ 4
  ◆Control Switches:#0003 Puzzle Finished Switch = ON
  ◆
:End

View attachment 246055
Thanks, this helped out a lot
variables would do wonders for this. simply have a parallel event say "if variable X equals Y the Z happens." X in this scenario is the variable, Y is the number that is set by the parallel event or added on and Z is what happens if the block enters the blue square.

although this is all speculation, what does the event page look like for each of the rocks?
1669714713432.png

the event page for the rocks is just the movement tutorial code
you can rather too instead of variables, check if they are all on region 1.
have it count the rocks would be the easiest way.

but you can make a longer list based on rockX/Y (4 rocks require 8 variables).
and nested conditional to check the places on the mapX/Y.

there are some methodes how to pull this one off, even with switches.
if they are all ON, a new level is open (which you can reset) to OFF.

search a tutorial on how to do "weight switches" which is ideal for rocks as well.
switches or region count is probably the best approach for this kind of puzzles.
How would I go about making a code to know when a rock is on region 1
the event page for the rocks is just the movement tutorial code
just as an info: an event page is more than just the content, and when someone asks for a screenshot of the event page(s) you should include the entire event window including conditions, properties, page numbers and so on.

How would I go about making a code to know when a rock is on region 1
there is an event command "get location info" that will let you load the region ID or a lot of other info from a map position into a variable, where you can check it with a conditional branch
@Geetee check post #4 of Bex, that has that region check.
you simply paste that event into a rock or common event.
and have that rock that event.

when 4 rocks are in regionID you specify, it counts +1, else -1.

Study Bex event page and your good to go.

as I said, the same puzzle can be done in around 5-8 different methodes,
each methode a bit differently, from each to complex, depending the needs 🙂

Original thread: https://forums.rpgmakerweb.com/threads/help-with-making-a-puzzle.152962/