Gw Temp

Menu

Tutorial - 'CMS Tutorial, Part 3' by Rast

An item about RPGMaker 2000 posted on

Blurb

Part 3 of a very long tutorial by Rast, detailing how to design and make your custom menu systems.

Body

1) Overall design, getting to/from your menu, and cycle-based submenu design
2) Basic cursor loops and static menus
3) Distributed control and chara displays (you are here)
4) Manual dereferencing, picture displays, and composite displays
5) Showing lists, dynamic menus, and scrollable cursor loops

Rarf! This is the much-delayed part III of my CMS tutorial. In this theory-heavy tutorial, we shall go over the concept of distributed control, and we'll learn how to create dynamic displays using chara sets.

Distributed Control

Distributed control is breaking large tasks among several events that call each other instead of rolling it all into one big event. This makes several things in the design of your menu much easier, which we'll go over now.

Common events that interface with map events

Your CMS will have to flip back and forth between many maps via common events. In order to keep your script simple, it's usually a lot easier to have the common event do nothing but load the screen, let it do it's thing, and then take us back to the previous screen when it's done.

You can do this easily by having your common event teleport to the new map and then directly call the screen reset event. You could do this with an autostart, but your scripts will flow better and be less glitch-prone if you just call the map setup event directly.

Creating a single event to do common tasks

This is the big one. You can use this concept to create events that do something that you need done in multiple places. Say, for example, that you need an event to scroll your custom item list (we'll go over scrolling in a later episode, just bear with me). Now, you need to be able to scroll your item list up, down, paged up, and paged down. Now, instead of doing almost the same thing four times, you can just create a single event that scrolls the item list by an amount given in a variable. Now, when you need to scroll the item list, you just set the variable and call the event. Also, if you need to change the way the item list scrolls, you only have to update one event.

Also, if you decide later you need to be able to scroll the item list from somewhere else, all you have to do is call the event instead of doing all that work again. This is important - it makes updating your scripts later much, much easier. Because of this, I recommend you encapsulate all major (and even minor, it's up to you) functions into this type of called event. By doing this, you seperate your script into discrete chunks which can be assembled and plugged into other things any way you like. Like I said, this makes updating your script much, much easier.

Using template-based chara displays

Your chara displays, if you use my method which we'll go over shortly, are template based. You fill a variable with what you want to display and you call the event. This makes all those custom numbers and symbols that you'll have to deal with a breeze.

Setting up larger nearly identical displays

Suppose you're setting up a screen to show overall stats of your party, such as HP, MP, status, their face, etc, for four characters. You could do this by creating four completely different displays which all check a different slot in your party and set it up accordingly.

Or you could do it the easy way by creating your display out of templated events, and creating a single 'controller' event which works off of a pointer to slot in your party. It would get the character to set up from the pointer and set up the templated events accordingly. Now to set up the additional displays, you just copy and paste the events you just made, update the calls and the pointer, and you're done. To show your display, you just call the four controller events. Wasn't that a lot easier?

Keeping your script understandable

This is another biggie. I highly suggest that you put big blocks of script that do something specific into their own event and call it, even if you're not planning on using it as a building block of a larger script as outlined earlier. This is for two reasons.

The first reason that big, big blocks of code can take a while to come up in the editor, especially if they contain intricate forks or deeply nested cycles. Also, the runtime engine will sometimes choke on huge blocks of script, just because they're big. Splitting up your bigger scripts avoids these problems.

The second reason is that huge, huge event pages are very hard to come back and edit later, even if you're followed all the design steps outlined earlier. By splitting up your events logically, they are a LOT easier to edit later.

Chara displays

A chara display is an event that uses chara to display something. We'll use a template-based approach for this, this allows us to create a display anywhere we need it by simply copying and pasting the template event into the appropriate places. These are most useful for number displays, although you can also use them for faces, custom symbols, anything, really.

Step 1 - Figure out exactly what you need to display

What is your display going to show? A number? A face? A symbol? Figure out exactly what you want your display to show, and how it will show it. For example, for numbers, I've found that groups of 2 digits per event works great.

After you've figured that out, make a list of all the graphics you'll need for your display. This can be as simple as the numbers 0-99 and 00 for the number example above, or a more comprehensive symbol list. After you've got that, proceed on to the next step.

Step 2 - Create your charsets

Using your image editor and the list you just made, create as many charsets as you need of tile-sized chara for your template. We'll be using the "Move Event->Change Graphic" command in order to set up the event, so make sure to set up all the animation frames of each facing the same since we can't show a single animation frame with this command. This will limit you to having 32 symbols per charset, so you'll probably have to use more than one. When you're done creating your charset, import them in RPGMaker and go on to the next step.

Step 3 - Design your template

On a sheet of paper or in a text file, write down how your template will work. Your template needs to do these things in order to work:

1) It has to expect a variable to be holding a value telling it what to display
2) It then processes the event into something it can use (such as reducing it to a number between 0 and 99 for the number display we keep referencing)
3) It then forks through each possible value of that variable, and uses the Move Event command to set itself the correct graphic.
4) Repeat these steps for each event page.

Your event will have multiple pages if it can be called in multiple ways (for example, the number display would have 2 pages, one for the 1's and 10's digits, and another for the 100s and 1000s digits. Each would be a little different and used together they could display a number with up to four digits).

Step 4 - Make your template

Using the design you just made, create your template.

If the list of things you need to show is large, you should use nested forks to dereference it. For example, if you're making a number display, have it see if the value is higher or lower than 50. If it's higher, see if it's higher or lower than 75. If it's lower, see if it's higher than lower than 25. Continue in this manner until you nail down the actual value. This minimizes the number of forks that RPGMaker has to process and can greatly speed up the display and update of your screens if the number of templated events on them is large.

Step 5 - Implement your template

Now you should have a fully functional template event. To use it, just copy and paste it where you need it. Have another event set up the variable it dereferences, and then call it (being sure to call the appropriate page, if applicable).

In Conclusion...

Distributed control and templated events are cornerstones of most any CMS. They may be a little confusing at first, but with a little practice you'll see how much easier they make things.