Puzzle With Objects That Manipulate Other Objects

boldpaste2

The Dragon Heretics
Veteran
Joined
Dec 7, 2013
Messages
797
Reaction score
439
First Language
English
Primarily Uses
[SIZE=16pt]Puzzle With Objects That Manipulate Other Objects[/SIZE]​

[SIZE=12pt]Introduction[/SIZE]

[SIZE=12pt]Hello, I was working on my commercial project when I created a basic yet complicated puzzle that I wanted to share with you guys. Basically, the puzzle involves objects that manipulate other objects with variables and conditionals. Let’s say you are trapped in a room and there are 6 orbs around you. The objective is to make all the red orbs blue. Sounds easy enough until oh crap! Not only did the orb I select change color but the one across the room changed as well. Once you manage to figure out how to change all the orbs to blue a door across the room opens up freeing the trapped player.[/SIZE]

[SIZE=12pt]This sounds a bit complicate to pull off for new users and it is but if you follow along with this guide, not only will you be able to pull off a similar puzzle like this but you will get a good understanding on how variables and conditionals work.[/SIZE]

[SIZE=12pt]P.S. The Demo at the bottom does not look like my commercial game just so we are clear =).[/SIZE]

[SIZE=12pt]DEMO: [/SIZE][SIZE=12pt]https://drive.google.com/file/d/0B_yUaSJQKlK_T2FTanh2ZUhyUnM/edit?usp=sharing[/SIZE]

[SIZE=12pt]Click File, then download to download the entire zip folder[/SIZE]

[SIZE=12pt]What events are needed![/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]A controller (I usually create controllers if I want to manipulate an event without having to change each and every event).[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]The orb color changing system.[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]A system to check that all orbs are the correct color.[/SIZE]

[SIZE=12pt]The Controller[/SIZE]

[SIZE=12pt]I usually create controllers at the far bottom left so I know where it is. Right now, all you need to do is create an event with these parameters.[/SIZE]

[SIZE=12pt]Priority: Below Character[/SIZE]

[SIZE=12pt]Trigger: Autorun[/SIZE]

[SIZE=12pt]Contents: Erase Event[/SIZE]

[SIZE=12pt]*Will add screenshots when we add onto it.[/SIZE]

[SIZE=12pt]The Puzzle[/SIZE]

[SIZE=12pt]Now this is the most difficult part to construct as it becomes very tedious to do so what we are going to do is build a base to copy and paste from.[/SIZE]

[SIZE=12pt]Making the base[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]Create an event and make 3 pages (press the new event page twice).[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]Leave page one with its defaults. I usually leave a blank page in case I need to create an off position.[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]Page 2 Properties[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Graphic: Red orb[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Options: Stepping animations[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Priority: Same as Characters[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Trigger: Action[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]Page 3 Properties[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Condition: 1 or above. (be sure to select a variable. You can name it whatever you like but I usually put a tag and a number to keep track of what’s what. Ex. [orb] 1 (this specifics one of the 6 orbs we will make)[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Graphic: Blue orb[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Options: Stepping animations[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Priority: Same as Characters[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Trigger: Action[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]Now that a base is set up, copy the event and paste it 5 additional times and preferably in the positions in the picture.[/SIZE]

[SIZE=12pt]-          
[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]Finally, go into each event you just pasted and on the third page change the variable to a new variable so that it is unique (not used by other events). Ec. [orb] 2, [orb] 3, … , [orb] 6.[/SIZE]

[SIZE=12pt]The logic[/SIZE]

[SIZE=12pt]Now for the tricky part. There are many combinations to go about this but for the sake of this tutorial we will go with what I’ll teach you. So, let’s look at orbs 1 – 3 (refer to above image). This is what we want to happen.[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]When orb 1 is selected[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Orb 2 will change to its opposite color.[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]When orb 2 is selected[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Orbs 1 and 3 will change to their opposite color.[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]When orb 3 is selected[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Orb 2 will change it its opposite color.[/SIZE]

[SIZE=12pt]Same goes for orbs 4 – 6 on the right.[/SIZE]

[SIZE=12pt]So the question is, how can we make other orbs change to their opposite color from another object? The answer is with conditionals and variables. The conditionals will serve as the IF THEN statement and the variables will serve as our on and off switches. (This can also be done with switches rather than variables but variables are easier to manipulate in this case when you go and perform a tally (explained later)[/SIZE]

[SIZE=12pt]Creating the Orbs[/SIZE]

[SIZE=12pt]Alright, this is the part where I start holding your hand. Go to orb 1 and open up the second event sheet. The first thing you want to do is create a conditional statement that will check and change orb 2 when you select orb 1. With the “Conditional Branch” open, select “Variable” and set it to orb 2. Make it “equal to” the “constant 0”. [/SIZE]



[SIZE=12pt]This will serve as our IF THEN statement: “If [orb] 2 is equal to 0 then do this else do that.”[/SIZE]

[SIZE=12pt]Directly under the condition branch, you are going to want to control [orb] 2’s variable. By default it is 0, we are going to set it to 1. In this tutorial, 0 represents off and 1 represents on.[/SIZE]



[SIZE=12pt]Now the statement says this: “If [orb] 2 is equal to 0 then change [orb] 2 to 1 else do that.”[/SIZE]

[SIZE=12pt]Now, under the else statement you do the same thing by controlling the variables of orb 2 but this time make it 0. (psst. You can copy and paste from above and edit the 1 to a 0)![/SIZE]

[SIZE=12pt]Now the statement says this: “If [orb] 2 is equal to 0 then change [orb] 2 to 1 else if it is NOT equal to 0 (meaning it can only be one) then change it to 0.”[/SIZE]

[SIZE=12pt]Once you have created the conditional statement, you now want to control the orb you are touching [orb] 1. Under the “Branch End” statement use the control variables command to set [orb] 1 to equal 1 (the on position).[/SIZE]

[SIZE=12pt]If all that was too much for you, refer to this screenshot or the demo.[/SIZE]



[SIZE=12pt]Now that page two is built, we need to build page 3 to do the exact opposite (OH NOOO!!!!!) don’t worry, it’s actually not that bad! Just copy the contents from page two and paste it to page 3! Then change all of the variables commands to their opposites (make 1s 0s and vice versa) DO NOT TOUCH THE CONDITIONAL STATEMENT![/SIZE]



[SIZE=12pt]This process is the same for orbs 1, 3, 4, and 6, because orbs 2 and 5 control 2 other orbs, they are a bit different. Instead of one conditional statement they have two (one for each orb). Just be sure that the variable that controls the orb you’re working with stays at the bottom.[/SIZE]



[SIZE=12pt]Making the Puzzle Harder[/SIZE]

[SIZE=12pt]When you playtest the game you will notice that all the orbs are red and the orbs you select will change the orbs they handle. But because all the orbs are red and the layout is pretty basic, this doesn’t make for a challenging puzzle. SO LET’S GET DIRTY AND MESS WITH THE PLAYER! Remember that controller we placed at the bottom left of the screen? Open that up! Then, above the “Erase Event” use the Control Variables and set orbs 2, 4, 6 to 1 so the next time you play test half of the orbs are red and half the orbs are blue.[/SIZE]

[SIZE=12pt]But why stop there? The pattern to controlling the orbs can become obvious so let’s change the pattern a bit. Let’s make orb 6 also control orb 3 and throw the player off their game. Just like orbs 2 and 5, all you have to do is add a conditional statement to control the orb. (I’m not going to explain it again, refer to the demo if you’re having trouble).[/SIZE]

[SIZE=12pt]Be careful when doing this. You can make the puzzle have no solution at all.[/SIZE]

[SIZE=12pt]Make An Event That Does Something When The Player Solves The Puzzle.[/SIZE]

[SIZE=12pt]This part is simple and mostly involves copy and pasting. We are going to start layering conditionals to check that all of the orbs are blue.[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]Create a new event to act as the door. Select on page one. All you need to do is set the graphic for the door you want to use.[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]Create a new event page.[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]Page 2 properties:[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Condition: Variable [orb] score is 6 or above (for the confused we created a new variable).[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Priority: Same as Characters[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Trigger: Action[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Contents:[/SIZE]

[SIZE=12pt]§  [/SIZE][SIZE=12pt]Sound: (door opening, duh).[/SIZE]

[SIZE=12pt]§  [/SIZE][SIZE=12pt]Set Move Route: to show open door animation if you want to (see screenshot)[/SIZE]

[SIZE=12pt]§  [/SIZE][SIZE=12pt]Control Self Switch: A = ON[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]Create a new event page[/SIZE]

[SIZE=12pt]-          [/SIZE][SIZE=12pt]Page 3 properties[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Condition: orb score is 6 or more AND self-switch A is on.[/SIZE]

[SIZE=12pt]o   [/SIZE][SIZE=12pt]Contents: Whatever you want this door to do (transfer player I bet).[/SIZE]



[SIZE=12pt]Ugh! Fatigue kicking in…[/SIZE]

[SIZE=12pt]Now, for a system to check the orbs. Open orb 1 on page 2. At the bottom, create a conditional statement that checks the variable for ORB 1 is == to 1. Then under that create another conditional statement that checks ORB 2 is == to 1. Then keep repeating the process until you get to orb 6. Under the conditional branch for orb 6, I used the key sound to play a click to let the player know they solved the puzzle and to stop what they’re doing to go open the door. Then under that you are going to want to control the variable orb score and set it to 6. Take your newly created scripts and paste them at the bottom of page 3 of orb 1. Then rinse and repeat for the rest of the orbs. (Don’t kill yourself, just copy and paste from orb 1).[/SIZE]

[SIZE=12pt]Page 2 of orb one should look something like this.[/SIZE]



[SIZE=12pt]Now when you go unlock the door, you can leave the room.[/SIZE]

[SIZE=12pt]Well, I hope this tutorial wasn’t as painful for you to read like it was for me to write it xD. Let me know what you guys think and if this helped you in any way![/SIZE]

[SIZE=12pt]DEMO: [/SIZE][SIZE=12pt]https://drive.google.com/file/d/0B_yUaSJQKlK_T2FTanh2ZUhyUnM/edit?usp=sharing[/SIZE]

[SIZE=12pt]Click File, then download to download the entire zip folder[/SIZE]
 

Latest Threads

Latest Profile Posts

Hey everyone, we know that the edit bar is missing. We're working on it. You can talk about it in the announcement here: https://forums.rpgmakerweb.com/index.php?threads/forum-errors-missing-edit-bar-etc.132715/
So, explain why we can no longer use BBC code or smilies in our posts? This sparks much sadness...
Are we now stuck with WYSIWYG ? I cannot revert back my posts to good old raw text ?
I'm wondering if I may be putting too many things into one map. A story, within a story, within a story . . . it's fun, but I can't shake the feeling that it may be better to scrap some of it, and use it for another map. I'm not sure what to do.

Forum statistics

Threads
107,789
Messages
1,032,214
Members
139,939
Latest member
Mineformer
Top