How can I make the game wait?

myenemy

Veteran
Veteran
Joined
Jan 17, 2014
Messages
67
Reaction score
30
First Language
Spanish
Primarily Uses
RMMV
I'm trying to make a plugin that requires the editor's wait command twice, one of them for a customized animation, Game_Interpreter.prototype.command230, that calls Game_Interpreter.prototype.wait. I read on that spreadsheet I could just use $gameInterpreter.wait(), but $gameInterpreter does not exist. I found out it's actually $gameMap._interpreter.
I tried to make in my plugin script:
Code:
var interpreter=new Game_Interpreter();
interpreter.wait(200);
Code:
var interpreter=new Game_Interpreter();
interpreter.command230(200);
Since the plugin is most likely triggered in (default) (side) battle, but I also tried from $gameMap._interpreter , and nothing happened. I also tried to combine them with "waitMode" function with the "animation" parameter, and all the combinations with those, even straight in console, with no plugins on, and it does nothing, not even show some error.
I also tried playing with the parameters in new Game_Interpreter();
I'm out of ideas on what to try, I know the native JS ones would freeze the game completely, so how can I emulate the "Wait" command from the editor in a plugin?
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,115
Reaction score
1,525
First Language
EN
Primarily Uses
RMMZ
To pause the map's main interpreter for 200 frames:
Code:
$gameMap._interpreter.wait(200);
Note this won't affect parallel events (they each have their own interpreter). It adds 200 to the wait counter, which gets -1 per frame. When the wait counter reaches zero, the interpreter moves onto the next command in its list.

Since this is in Learning JS I'll add that command230 takes no inputs (source rpg_objects.js):
Code:
// Wait
Game_Interpreter.prototype.command230 = function() {
    this.wait(this._params[0]);
    return true;
};
 

myenemy

Veteran
Veteran
Joined
Jan 17, 2014
Messages
67
Reaction score
30
First Language
Spanish
Primarily Uses
RMMV
To pause the map's main interpreter for 200 frames:
Code:
$gameMap._interpreter.wait(200);
Note this won't affect parallel events (they each have their own interpreter). It adds 200 to the wait counter, which gets -1 per frame. When the wait counter reaches zero, the interpreter moves onto the next command in its list.

Since this is in Learning JS I'll add that command230 takes no inputs (source rpg_objects.js):
Code:
// Wait
Game_Interpreter.prototype.command230 = function() {
    this.wait(this._params[0]);
    return true;
};
Yeah, I tried 230 out of despair of it not doing anything.

The plugin is about some notetag modified skill effects, which also have one animation. So far, the full skills and the animations work fine both inside battle and outside battle. Some of the animations include tainting the screen and the like, but I need it to wait until the end of the animation before continuing the battle (if in battle) or the movement (if on map). The only "new Game_Interpreter"s in project/js, are on Game_Event.prototype.setupPageSettings, Game_CommonEvent.prototype.refresh, Game_Map.prototype.initialize and Game_Troop.prototype.initialize.
The first one is for event runs, not for battles or skill use on map. The second one is for common events, the third is meant to be for the map, but nothing happens, and Game_Troop is pretty much the opponents in battle.
Which one should I use?
Should I add a interpreter on $gameActor instead or something? (I thought about it, but I still didn't try)
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,115
Reaction score
1,525
First Language
EN
Primarily Uses
RMMZ
Yeah, I tried 230 out of despair of it not doing anything.

The plugin is about some notetag modified skill effects, which also have one animation. So far, the full skills and the animations work fine both inside battle and outside battle. Some of the animations include tainting the screen and the like, but I need it to wait until the end of the animation before continuing the battle (if in battle) or the movement (if on map). The only "new Game_Interpreter"s in project/js, are on Game_Event.prototype.setupPageSettings, Game_CommonEvent.prototype.refresh, Game_Map.prototype.initialize and Game_Troop.prototype.initialize.
The first one is for event runs, not for battles or skill use on map. The second one is for common events, the third is meant to be for the map, but nothing happens, and Game_Troop is pretty much the opponents in battle.
Which one should I use?
Should I add a interpreter on $gameActor instead or something? (I thought about it, but I still didn't try)
First, some clarifications about the different event command interpreters:
  • There is no skill use on the map by default, only through the pause menu which is a separate scene.
  • The Game_Event and Game_CommonEvent interpreters are both purely for parallel events, as I mentioned.
  • The Game_Map interpreter is the event queue for non-parallel map events.
  • The Game_Troop interpreter handles troop events.

For your implementation: one option is a delayed callback approach, e.g. Promise (ES6) or setTimeout. This is probably the easiest method and completely bypasses the whole command interpreter thing! After all, you just need it to work, right? :kaophew:

Alternatively you could work to integrate your process more firmly with the existing procedures. While I don't think you'd gain any notable functionality doing things this way, I feel it's technically a better approach (in terms of compatibility, at least). I think it would involve making aliases of Sprite_Animation methods (sprites update each frame based on their parent object, one-way association). Maybe set a flag before starting the animation then checking that flag in an alias of the sprite's remove method? I haven't really played around much myself with sprite stuff, sorry. :kaoswt2:

Also: battles are ultimately controlled by the BattleManager, which allows the troop interpreter to run whenever there's a free moment. If you're just making some follow-up skills or something, you may be better off calling the native forceAction methods rather than working around them. :kaoslp:
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,034
Messages
1,018,446
Members
137,820
Latest member
georg09byron
Top