Understanding and Surpassing Event Page Limits

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

This article discusses (what I consider to be) a major limitation in the RPG Maker event system: page conditions. I will then discuss a script that allows you to work around this limitation, allowing you to build even more complex events. The contents are based on RPG Maker VX Ace but the same concepts can be applied to VX and XP.

Event overview

Here’s a general idea of what you have to work with in events

OnEventsAndPageConditions0

What we are interested in are the event pages.

Checking whether a page is active

For an event, at most one page is ever active at any time. In this example, page 1 has a graphic of a kitty, and page 2 has an empty graphic. When page 1 is active, you will see a kitty. When page 2 is active, you will not see a kitty.

A page is active if all of the page conditions have been met. So in our kitty page, there is one condition: Switch 24 must be ON. If the switch is ON, then the condition is met, and the page will be activated. If it is not met, then the engine looks at another page and checks whether it can be activated.

Pages are checked in reverse order

This is probably the most important thing you have to remember.

In our kitty event, the engine starts by checking page 2 first, and then it checks page 1. In general, it starts by checking the last page, and then works its way backwards. This means that if the last page has no conditions, then it will be activated, even if the first page has no conditions.

Do not forget the order of page checking.

Different types of page conditions

You have 6 page conditions available to work with. Here is what they look like:

OnEventsAndPageConditions1

The conditions should be self-explanatory, provided you know what they mean. But if you are confused you may leave a comment.

Page Condition Limitations

While you have 6 conditions, it is pretty limiting. Here’s a list of issues I see:

  • Only 2 switches?
  • You can’t check if a variable is less than a certain number
  • You can’t check if a variable is equal to a certain number
  • There are only 4 self-switches to choose from.

And of course, you’re given the option to check whether an item exists in the inventory, or whether an actor is in your party.

But what about everything else that you might want to use as conditions? For example:

  • Armors or Weapons in inventory?
  • Whether something is equipped?
  • Whether a state is applied (or not applied)?
  • Whether two specific actors are in the party?
  • Whether you have 5 potions and 10 hi-potions?

What about a conditional branch?

For all of the other conditions I’ve proposed, you might argue that we can just use a conditional branch for this. Indeed, the conditional branch event command does support all of them, and more. And it supports formulas, so you can basically condition on absolutely anything you can think of.

But this doesn’t work. It just isn’t the same.

A page condition is used to determine whether a page is active or not. A conditional branch is used to control the flow of the event logic when it is running.

Simple example: you have a kitty event. When “White Armor” is in your inventory,the event graphic will show a white kitty. When “Black Armor” is in your inventory, the event graphic will show a black kitty. When both armors are in your inventory, the event graphic will show a white kitty with black spots.

How do you accomplish this with a conditional branch? Can it be done?

Using the conditional branch as a page condition

The answer to the question I proposed above is, in fact, yes. It is possible to use the conditional branch as an event. The trick is to convert your conditional branch into a page condition. This is not supported by the editor, but we can accomplish this using scripts.

Custom Page Conditions

I introduce a small script called Custom Page Conditions. Insert the script, add a comment, then add a conditional branch. It looks like this:

event_PageConditions0

Just like that, you’ve added a page condition that checks whether a particular weapon is in your inventory. Need another condition? Repeat the process until you have all the conditions you need. Now we can tap into the conditional branch’s power and use all of the conditions that it supports, and if there’s something you need that it doesn’t support, use a formula in the script call.

Extending custom page commands to troops

At this point you might be thinking “well that’s cool, can I do the same for troop conditions?” After all, troop conditions are just as limited The answer is, of course, yes. Just do the same thing in the troop event editor:

event_PageConditions2

And common events?

We can extend this idea to even common events. If you recall, a common event only have one condition, and that’s a switch. But there are potentially so many other conditions that you want to use. Again, we use a conditional branch as the page condition:

event_PageConditions3

Closing

In the beginning, we looked at the event editor and the options that they provide you for page conditions, and we realized that it is quite limiting. I then showed you a script that allows you to surpass this limitation, using tools that you are already familiar with. Finally, I extended it to all of the other kinds of events that you might be working with, creating a very versatile tool set and enabling you to implement all kinds of complex logic without having to resort to additional scripts just to prevent a page from activating for trivial reasons.

Spread the Word

If you liked the post and feel that others could benefit from it, consider tweeting it or sharing it on whichever social media channels that you use. You can also follow @HimeWorks on Twitter or like my Facebook page to get the latest updates or suggest topics that you would like to read about.

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax