[Tutorial] How to Avoid Using Conditional Branches by Using Event Pages

In this tutorial you’ll learn how to script changing NPC behavior over time. For example, having a particular character say one thing before you defeat a boss, and having them say something different afterward. You might be tempted to use Conditional Branches to do this, but you really shouldn’t, there’s an easier way. What we’re going to use is a variation of the system we used to prevent refilling chests.

Suppose you want to make a character say one thing before you fight a boss and a second thing afterward. The first page of the event would look like this:pages-tutorial-1

The second page of the event will look like this:RPG Maker VX Ace Screenshot

Notice in the top right corner under “Conditions” that this page will only activate if switch 001 is on. If the game has a choice between activating a page that has a condition and activating a page that does not have a condition, it will always activate the page that has a condition if it can. So, in this case, if switch 001 is off, it will execute page 1, and if switch 001 is off, it will execute page 2.

Now, suppose you wanted this person to have a third possible line of dialogue after you’ve beaten a later boss. To do that, you would make a third page that would look like this:RPG Maker VX Ace Screenshot

An important thing to remember about this is that, if there are two pages that each require one switch, and both switches are on, the game will run the page that requires the higher numbered switch. So, if page 2 requires switch 001, and page 3 requires switch 002, and both switches are on, then page 3, and only page 3, will be executed.

Now, suppose you wanted an NPC to simply vanish after a particular event had happened. You might be tempted like I was to use “Erase Event” to do this, but if you do, the event will be right back where it was when you return to the area. Instead, to make an event disappear, you make an event page that either has no contents or can’t be activated, and has no graphic associated with it.

To continue with the event we were talking about before, suppose you wanted this NPC to disappear after you defeated a later boss. Then, page 3 would look like this:RPG Maker VX Ace screenshot

Notice a few differences. First, since the event has no graphic, there will not appear to be anything on that square. Second, since I changed the trigger to “Event Touch”, it should not be triggered by anything. Finally, since the event has no contents, it should not do anything even if it were somehow triggered.

The last thing I’ll teach you is how to make an NPC teleport away right before your eyes. If we wanted this character to vanish when we talk to him after defeating the second boss, that would require two pages. Page 3 would look like this:RPG Maker VX Ace screenshot

Page 4 will look like this:RPG Maker VX Ace screenshot

This way, when you talk to the NPC after defeating the boss, they will say a line, an animation will play, and a switch will be flipped. As soon as that switch is flipped, page 4 will take over and the character will no longer be visible. This will cause the character to quietly disappear while the animation plays and be gone when it finishes.
This tutorial should give you enough information to make NPCs change their behavior or appearance without having to use conditional branches. Good luck with your games and have a nice day.

Regards,

Science Viking

Advertisements