HOW TO CREATE A CHEST AND USING VARIABLES WITH CHESTS

How to make chests and replacing chests with variables.

  • RedWillB
  • 12/08/2016 03:07 AM
  • 3678 views
========How to make a treasure chest===============================================



Note: If you already know how to make a chest go to the next part of the tutorial labeled "Chests with variables" (Just Ctrl+f that shit).


Now, for you beginners out there. Let's start making a chest, and I'm going to use switches, as well. Okay. First, set up a map for the test chest and create the chest event in the "Event layer."
I set my chest up in a dank room.



Okay, now, while in the "event editor" for the chest, give it a snazzy name of sorts. I called my chest "CHEST." Okay, now, while in this Editor you'll first wanna set the chest movement. The "move event" button can be found on the second page of the "event command" menu.



After doing such set a message for it. My message is "The object within has been obtained." If you aren't sure where the message command is, it's on the first page, all the way at the top left.



Now, you need to set the item that you want the chest to give; I gave them exactly 54 stimulants. Wait, no. 43 stimulants. To find the "item management" button, go to the first page, and look six buttons up from the bottom, on the left side of the chart.



And, finally, you need to set a switch. I also named my first switch "CHEST" because I have a lack of creativity. You just need to set your switch to on, and then, you good.
To find the "switch operations," it is also on the first page found four above the "items management" button.



Okay, once you've completed the first page of your chest you need to create a new page. But, before I explain that, I'll show you what my chest layout looked like:



On this new page, you'll only set 3 things. A new movement, a message explaining that the chest is empty, and then another movement. But you don't even have to set that. You could leave it blank or even just say that it's empty. It's completely up to you. But, this is how I set up my chest.



You can now test your chest. This is how my chest turned out:



After I open it for the first time:



The items it gave me:



And, the second time I examined it:



And that's how you properly create a chest. I hope my tutorial helped you and the people here trying to use variables for chests. I wish you all well on your video game making.




===========Chests with Variables======================================================


To start, you will need RPG Maker 2003 and the will to make your game a little more challenging -- if you consider certain chests "mysteriously" becoming empty if another chest (that's found later in the dungeon) is opened -- to play.
For this tutorial, I am going to be using the variable "0001," and I'll name it "chests" (Because it's easy to understand and stuff). Now, set up a chest or three on a random map.



I chose to set up 3 of them so that you'll understand better how this will work in the result.
Now, set up your first chest with a branch path set to "Variable 0001: Chests" being "equal to or greater than 1," and check the "else" handler like so:



Now that that's done go into the "else handler" and add the item you want the chest to have and do all of the general chest stuff. But, you also need to add a variable operation along with that generic chest stuff. It doesn't matter where you put it as long as it's somewhere in the "else handler" for the variable is greater than or equal to one branch.
Here is how the Variable operations should look:



After you finish that, set up how you wish for the actual branch to react once the chest has been opened. This is how my first chest looked:



Now, if you test it out, chest one should work:





If it doesn't say two different things, and possibly gives you an item if you programmed it to do such, then, you probably screwed up somewhere in the coding.

==========Chest II=================================================================
After we learn about chest II, you can use this for chest III, as well. You just have to slightly change up the coding of it (obviously). Anyways, for chest II, you need to add a conditional branch, but make it "equal to or greater than 2," as well as adding the "else handler."



After completing that you must now add another conditional branch into the "else handler." This conditional branch must say "if 0001: chests is less than 1." You need to have an "else handler" for this branch, as well, like so:



Once you've completed that, create the chest with all of your generic chest capabilities, and copy and paste it into the "else handler" of the second branch found in the first branch's "else handler." Go back to the second branch and put the variable operation "set 0001: chest set equal to 2."



And in the "else handler" for the second branching path which can be located in the first branching path's "else handler" set the variable operation to say "0001: chests add 1."



After completing that, set up the rest of your chest. This is how my chest II looked:



And once completed, go to your game and test out the two chests. If it worked, after opening the second chest, the first chest should show up as being empty instead of having anything inside of it. If your chests do not work this way, you may want to retry and, and just follow exactly what I did.
Here's how it looked for me:







Finally, a few pointers on creating this. Every new chest, the branch will go up by one number. So, the branch path for chest C would be "if 0001: Chests is equal to or greater than 3" along with adding the "else handler."



Next, the second branching path will also go up one digit saying "If 0001: Chests is less than 2."



And the two variable operations that you need will also go up 1. So, the first variable operation inside of the second branching path would say "0001: chests set equal to 3." And the second one will say "0001: chests add 1."





And that's all you really have to do with this. You could implement this into minigames or as a hard mode if you want it to feel more like a challenge and still use the switch operations for the easier modes or anything of the sort.
And if you really want someone to get a certain chest, you don't have to do this. Set the chest for the exact item, if the item is rare, or even set it with a switch. That's completely up to you and how you code. You could even just sit all of the chests in one room and let them all work on a branch, and then set a switch for the door. That's completely up to you.