Loops and Labels

in Tutorials

by Jason “Despain” Perry

Howdy! Despain here with a new tutorial for RPG Maker VX Ace. Today we’re going to be talking about a couple of event commands that will make your complicated events run a lot more smoothly, and probably save you a lot of time. I’m talking about Loops and Labels.

You can find these commands— Loop, Break Loop, Label, and Jump to Label— on page one of the event commands, under the Flow Control category.

Let’s create an easy sample event to demonstrate how to use these event commands. Imagine an NPC who doesn’t want to stop talking. We can create a conversation that the player has to break, and one of the ways to do this is with the Loop and Break Loop commands.

When you use the Loop command, you’ll nest your other commands inside the loop. Anything inside the loop will—well—loop. The cycle will continue until the loop is broken, and when you use the Break Loop command, the event will skip out of the loop before it continues processing.

In the above example, the NPC will continue asking the player the same question until the player answers “No”, in which case the loop will break and the event will finish.

You can do a similar thing with labels, but they have more uses. If you use the Label event command, you’ll notice that you can give your label any name you want. That’s the cool thing about labels—you have a lot of control over them, and you can use a lot of labels in a single event.

When you name a label, give it something useful that you will remember. In this example, we’re just going to name it “A”, but if you’re using labels in complicated events, I suggest that you give them a name that will help organize your event code.

After you’ve put a label into your event, it won’t do anything by itself. It’s pretty much invisible—but when you use a Jump to Label event command, that label matters. Whenever the event reaches a Jump to Label command, it will do just that—the event will jump ahead or backwards and pick up where the label is.

In this example, we’re using a label to create a loop that is functionally identical to the previous example.Labels don’t have to be used to create loops (that’s what the Loop command is usually for), but it’s a good way of demonstrating how they work. A lot of the time, labels can be used to jump ahead and skip parts of an event. They’re especially useful when organizing complex systems using common events.

Experiment with loops and labels and have fun with it. Push yourself to create something new. And have fun! If you run into any problems, ask for some help on the Official Forums.

Jason “despain” Perry has been using RPG Maker for over a decade, and in that time his articles, tutorials, and graphical resources have helped countless RPG Maker users on community forums. He currently runs the website finalbossblues.com, where he co-hosts an RPG Maker podcast and regularly posts new articles and tutorials.

4 comments… add one

  • Sam June 23, 2013, 9:57 pm

    Dude this toturial is really good… It is explain in a simplistic way, but gives actually a good knowledge about these things. Thanks a lot!

  • AGGER July 12, 2013, 8:25 am

    Thanks very helpfull and straight to the point!

  • John August 12, 2013, 12:56 pm

    The tutorial is great and simplistic. It is very helpful, but i do have a question.
    Can a label be used to jump into other events? (for my problem i want to jump into and event on a different map).

  • Tweaksource January 8, 2014, 2:56 am

    Nice, succcinct explanation. So basically, the Labels are used in a GoTo type of implementation. That could be downright useful!

Leave a Comment