Jan 2 2010, 02:51 AM
I'm making a puzzle game with RMXP. I got the idea to make a switch puzzle: you have to step on the switches in the right order to solve it. but the problem is: i dont know how to make it without making hunderds of variables and switches.
can somebody help me making the puzzle made easier.
-sorry for bad english-
Jan 2 2010, 03:24 AM
You should be able to do this with one switch or variable with some careful thinking (or various other methods).
The simplest method to keep track of is using a single variable (remember a single variable can contain a multitude of different information, so it is quite flexible).
Let's say for example you have 4 chests, and you need to approach them in a certain order. When a user approaches the first correct chest, change a variable (for example a variable named CHEST_PUZZLE) to 1 (from 0, which should be it's default value), then when they get the second chest correct set it to 2 (and so on and so forth), if however they get the in-correct chest in the sequence, reset CHEST_PUZZLE back to 0 and close all the chest, or whatever is you want to do.
The individual chests can have a simple event that checks to make sure CHEST_PUZZLE is at the expected numeric value (meaning they have gotten chest(s) correct up to this point).
Of course it does not have to be a numerical value if memory serves me right, it can be a more meaningful value such as a string (CHEST_1_OK) etc etc.
I don't play too much with RPG Maker and as I am a programmer my ideas generally come from that experience so there may be limitations to my ideas as far as RPG Maker is concerned, but I am pretty sure the above is feasible and quite easy to do.
I do not have RMXP but RMVX and if you have that or a trial copy etc, I can probably create a basic example of the above using the RTP graphics and a small map, if you cannot follow my explanation.
Jan 5 2010, 06:57 AM
Moving this topic to the RPG Maker XP section.
Jan 5 2010, 12:16 PM
Well, let's see, here.
I'd say that you could do this pretty easily with two variables and one switch per trigger. (Trigger=floor switch=button=box=whatever.)
The switches are just used to record whether or not the trigger has been activated. They aren't self-switches because hey, you'd like to be able to reset the puzzle easily, right?
We'll call the two variables A and B.
Trigger #1 will, when activated, do the following:
1) Control Variables: Add one to A.
2) Conditional Branch: If A=1, add 1 to B. If A=2, add 10 to B. If A=3, add 100 to B. If A=4... you get the idea.
3) Activate the switch for this trigger so that you can't keep hitting it.
Trigger #2 will be like #1, but instead of adding 1/10/100/1000 to B, it will add 2/20/200/2000 to B, and so on for each trigger.
Thus, when you hit all the triggers (and you can use up to 9 with this method, which I hope will be enough for you, as that's something like 362,880 possible numbers generated), you'll have an up to 9-digit unique number that records the order of triggers that you hit. For example, looking at a 4-trigger number, if you hit the triggers 1-4 in that order, you'd get 4321.
So, at the end, you have an event page or conditional branch that is looking for the a variable B to equal 4321. You could even have it check other numbers, if you wanted to, and (for example) tell the player when the number's wrong and reset the puzzle, or send the player to different maps depending on the order they picked.
Was that reasonably clear?