Event Wait Command

This script introduces a new command that allows you to tell an event to stop and wait until a certain condition is met before proceeding.

RPG Maker comes with a wait command, but that is only to check whether a certain amount of frames have passed before proceeding. This custom wait command allows you to condition on things such as the value of a switch or variable, player input, or anything else that you can imagine that can be done with formulas.

The command is provided in two formats: a marked up conditional branch, or a script call so that you can choose which one you are most comfortable with.

Download

Script: download here

Installation

In the script editor, place this script below Materials and above Main

Usage

There are two ways to specify a wait command: using a conditional branch along with a comment, or using a script call.

Conditional Branch format

eventWaitCommand1

Start by creating a comment and add the following to it

<wait condition>

Then immediately after the comment, create a conditional branch. The event will understand that it should keep evaluating the condition until it is true.

This is not a normal conditional branch. Because it will continue to wait until the condition is true, the else branch will never be entered.

Script Call Format

Conditional branch supports script calls, but if you would like a compact command, you can simply use a script call command directly

wait_until(CONDITION)

Where the CONDITION is a valid formula that resolves to true or false. The event will wait until the condition is met.

Examples

To have an event wait until the player pressed the C button (Z or Return key),
use the script call

wait_until("Input.trigger?(:C)")

To wait until variable 5 has a value of 20, the conditional branch would look
like this

eventWaitCommand1

You may also like...

12 Responses

  1. Loo says:

    Is there a way you can make this plugin for MV as well? I desperately need this.

  2. KanaX says:

    Could I use a condition like “the item menu is closed”? If yes, do you know you to impliment the condition?

    • Hime says:

      Are you talking about your evented item menu? I would just store this information in a switch.
      If you’re talking about the default item menu, you need to be able to have an event run across different scenes.

  3. koldsack says:

    This script is a godsend, thx Hime. It’s interesting that this script solves the problem by an OP at http://www.rpgmakervxace.net/topic/22384-time-based-wait-instead-of-frames/page-2 the guy might be rude, but he does have a point. I’ve been discovering too that “wait by frames” is an extremely unreliable way to pass the ticker.

    While i was using your move triggering and event triggers, a wait command anywhere or via the event itself always backfires at second event contact by the player or otherwise. time sensitive based conditions always get shoved into the wrong sequence when i checked vars+switches via Galv’s debug script and hence not triggering.

    This i supposed can only happen if frames were skipped or were ticked either too fast or too slow. just an fyi.

    • Hime says:

      Time-sensitive events are somewhat tricky to implement since you’re competing with input and graphic updates, as well as the event itself. I’m not too clear how one could create “button combos” for example, where you press three keys within 5 seconds and it will satisfy a certain set of conditions.

      • koldsack says:

        Indeed. Not to mention the pc end side of things. i noticed the the glitches i mentioned are especially prevalent when my cpu is being bogged down (with torrents, youtube and etc. running in the background).

        Merry Chrismas Hime 🙂

  4. Arsist says:

    I can look at this. Although because with some methods (I forgot which), if you use wait, the player can still move around while the event is waiting, so I always Move Route-> Player-> Wait [x] frames.
    Do you remember in what situation the moving-while-event-is-waiting occurs?

    • Hime says:

      Parallel process comes to mind. The engine has it so that the player can’t move while an event is processing unless it’s a parallel process.

      • Arsist says:

        Oh, right. Thanks. So perhaps I could use this for everything except parallel processes.
        Something I don’t like is that there are no conditional move routes for events. So events, before you activate them, either stand still or move a predetermined path (or of course follow/etc). But I couldn’t think of a workaround for that if you did want to make their movement situational. I’m not quite sure about the possibility of a notetag move route script. For one thing, besides complexity, if the event had to continuously make an extra check beyond just the regular passibility check, it seems like it would make the movement skippy and not fluid.

        • Hime says:

          That’s a very generic question. You have conditional branches and move routes. That means you can choose how to move based on the conditions.

          • Arsist says:

            Oh, it wasn’t a question. I mean when the event is moving using its default move route and not using its event page list.
            However, something I would like to try is your custom page conditions, to have it so that an event’s first page will be a parallel process that defines its move route, but the following pages have a condition that the action button is being pressed or a self switch is activated (so when you activate the event with the action button, it turns on a self switch so it doesn’t return back to its move route page when you release the action button), defining what the event does if interacted with. But then again, multiple parallel processes may cause the game to lag

Leave a Reply to Arsist Cancel reply

Your email address will not be published. Required fields are marked *