The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Tutorials and Eventing => Topic started by: TwilightPrince1002 on February 23, 2010, 07:40:49 AM

Title: Boulder Puzzle Help
Post by: TwilightPrince1002 on February 23, 2010, 07:40:49 AM
Okay...anyone who has played a Pokemon game will understand how this puzzle is supposed to work.

Basically, I'm trying to make it so that when the player pushes an object (ex. a boulder) onto a certain panel/switch, then that makes the path open up, right?

I have been successful in making the boulder move in a direction (though only one direction, sadly) and made it possible so that if the player steps on the switch, the door opens.

What I NEED to know is if there is a way so that when the boulder goes on top of the switch, the switch will activate. I've tried all I can, but every time the boulder goes on top of the switch, nothing happens. Any help is appreciated, thank you. ^_^
Title: Re: Boulder Puzzle Help
Post by: modern algebra on February 23, 2010, 02:42:31 PM

As for moving the boulder, try an event activated by Action Button, which then has one Move Event in it (Move Away From Player).

For checking the position, use variables. The Variable Operations event command allows you to set a variable to the X or Y positions of any event or player on the map. So, do that, one variable for X and another for Y, and then use Fork Conditions to check if it's on the right spot. You can do it either by parallel process or in the event where you move the boulder.
Title: Re: Boulder Puzzle Help
Post by: TwilightPrince1002 on February 23, 2010, 04:53:49 PM
Okay, the boulder-moving idea with making it just move away from the Hero was a great idea. Thanks for that.

However, as much as I try to tamper with Variables, I still cannot understand them for the life of me if a person just tells me how to do it. Call me nitpicky, but I guess I do better when I'm shown how rather than told...
Title: Re: Boulder Puzzle Help
Post by: madriel222 on February 23, 2010, 05:08:47 PM
Here is what you're going to look at doing...

In a parallel process somewhere on your map, do something similar to the following:

1) Make a new variable operation.  Select a new variable that you'll name "Boulder X".  On the next set of options, pick "Set Equal."  On the final set of options, select "Sprite", the event name of your Boulder, and "X Coordinate".  It's important that you DON'T use Screen Relative X, just X Coordinate is what you want.

2)  Do the exact same thing with a new variable called "Boulder Y".  Change "Y" out for all instances above where I said "X."

3) Go to your map and see what coordinates your switch is at.

4)  Go back to your event and make a conditional branch that checks if variable "Boulder X" is equal to the X Coordinate of your switch.  Inside of that conditional branch, make another conditional branch that checks if variable "Boulder Y" is equal to the Y Coordinate of your switch. 

That's going to be the skeleton of your system.  Put whatever you want inside of the second conditional branch; this will be what happens when the switch is pressed.  You'll need yourself some "Else" handlers if you want your puzzle to be unsolved when the boulder moves off the switch.

Hope that helps, enjoy!
Title: Re: Boulder Puzzle Help
Post by: TwilightPrince1002 on February 23, 2010, 06:25:53 PM
Here is what you're going to look at doing...

In a parallel process somewhere on your map, do something similar to the following:

1) Make a new variable operation.  Select a new variable that you'll name "Boulder X".  On the next set of options, pick "Set Equal."  On the final set of options, select "Sprite", the event name of your Boulder, and "X Coordinate".  It's important that you DON'T use Screen Relative X, just X Coordinate is what you want.

2)  Do the exact same thing with a new variable called "Boulder Y".  Change "Y" out for all instances above where I said "X."

3) Go to your map and see what coordinates your switch is at.

4)  Go back to your event and make a conditional branch that checks if variable "Boulder X" is equal to the X Coordinate of your switch.  Inside of that conditional branch, make another conditional branch that checks if variable "Boulder Y" is equal to the Y Coordinate of your switch. 

That's going to be the skeleton of your system.  Put whatever you want inside of the second conditional branch; this will be what happens when the switch is pressed.  You'll need yourself some "Else" handlers if you want your puzzle to be unsolved when the boulder moves off the switch.

Hope that helps, enjoy!

Okay...I'm very sorry if I'm being difficult with this, but I followed those instructions to the letter, and yet all I get is that as soon as I enter the area where the "boulder pushed onto switch" event happens, it starts up immediately and then keeps repeating itself over and over, thus not even allowing the person to push the boulder onto the switch...the event just happens as soon as you go into the area.

I've tried adjusting so many things, but I either get the above mentioned effect, or just no result at all...Seriously, what am I doing wrong here...? I really don't wanna sound like a whiner, especially since I'm relatively new here.
Title: Re: Boulder Puzzle Help
Post by: madriel222 on February 23, 2010, 06:53:38 PM
Post your code. You're doing something wrong.

EDIT: I've posted a sample of code of something similar to what you're asking for.  Granted, the code is checking for multiple "boulders" on multiple switches, but the premise is still the same.  It works, trust me.

Title: Re: Boulder Puzzle Help
Post by: TwilightPrince1002 on February 23, 2010, 07:35:50 PM
Okay, so...following your example, here's the process I did.

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi193.photobucket.com%2Falbums%2Fz44%2FSarasaland_Prince%2FRockProccess.jpg%3Ft%3D1266953554&hash=f217c9717334062b76b4df9ce7daf07fda87e1b8)

Again, nothing seems to be happening, but here's what should  happen in the game:

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi193.photobucket.com%2Falbums%2Fz44%2FSarasaland_Prince%2FExplanation.jpg%3Ft%3D1266953678&hash=f7e13728899e674dcc94c5225b1d2b701f95b9ad)
Title: Re: Boulder Puzzle Help
Post by: madriel222 on February 23, 2010, 07:38:37 PM
Found your problem! Or at least the first one that jumps out at me XD

See your conditional branches?  You're checking Boulder X and Switch Y.  This needs to be Boulder X and Boulder Y.

EDIT: Next thing that's going to go wrong is that your "Success" handler is going to trigger in a big loop once the boulder is in place.  To fix that, you'll need a third conditional branch within the other two that checks if switch "Rock Switch" is ON.  If it is, the event should do nothing; if it's not, carry out the event as written.

EDIT 2: Are you also just pulling the 14 and 15 from my code?  Those need to be the X and Y coordinates that your switch is sitting on.
Title: Re: Boulder Puzzle Help
Post by: TwilightPrince1002 on February 23, 2010, 07:41:09 PM
*facepalm* D'oh! Okay, lemme try that...

EDIT: YES! It finally works! Oh my God...thank you so much! I literally was toiling over this all night and into today, and I am so relieved it works now!

Now that I finally have this down, I can finally get back to work with this area and the puzzles involved. Now I only hope to take this a step further and see if I can make it so that you would need boulders (or something else, whatever the case may be) on multiple switches for the path to open, but I'm guessing it'd get even more complicated...

In any case, I'm gonna be sure to credit you in my game for this. You helped me a LOT.