RMMV Script call for managing timer interruptions so that map changes don't pause the countdown

BreakerZero

Veteran
Veteran
Joined
Jul 8, 2018
Messages
1,092
Reaction score
477
First Language
English (USA)
Primarily Uses
RMMV
I was wondering for the purpose of my timed events as to what the script calls would require so that things like dark power effects, escape sequences etc. continue counting down without interruption when changing maps. Any ideas?
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,490
Reaction score
2,632
First Language
EN
Primarily Uses
RMMZ
Parallel events stop/reset when changing maps. For a long timer, I suggest using a variable to count down in smaller increments, e.g.
  • Start 2-minute timer:

    ◆Comment:Initialise timer: : : 2 mins = 120 seconds : : => 120 * 5 = 600 ticks ◆Control Variables:#0001 time A = 600 ◆Control Switches:#0001 timer A active = ON
  • Parallel event to handle that timer (bound to switch 1):

    ◆If:time A > 0 ◆Control Variables:#0001 time A -= 1 ◆ :Else ◆Text:None, None, Window, Bottom : :Time's up! ◆Control Switches:#0001 timer A active = OFF ◆ :End ◆Comment:Tick/update 5 times per second. ◆Wait:12 frames
This way, when the Parallel event gets interrupted, the maximum time loss is 11 frames. Or is it 12, I'm kinda sleepy. The thing is: it's not, like, the whole 2 minutes.
 

BreakerZero

Veteran
Veteran
Joined
Jul 8, 2018
Messages
1,092
Reaction score
477
First Language
English (USA)
Primarily Uses
RMMV
Which also explains the pause in the sequence of my implosion now that you mention it. With that in mind, are there any lines of code in the main scripts that deal with parallel events when moving between maps?
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,490
Reaction score
2,632
First Language
EN
Primarily Uses
RMMZ
Event commands are handled through an event interpreter instance (Game_Interpreter). Most events run through the main interpreter, defined on $gameMap, which persists from one map to the next. However, a Parallel event runs through an interpreter that is defined on itself.

When changing from one map to another, all events from the previous map (including common events) are cleared. For Parallel events, this means their interpreters are also cleared, which makes them stop immediately.

When arriving on a new map, events are set up via the Game_Map.prototype.setupEvents method. Parallel common events events are stored in the map's _commonEvents array, specifically lines 5553~5555 (rpg_objects.js):
JavaScript:
    this._commonEvents = this.parallelCommonEvents().map(function(commonEvent) {
        return new Game_CommonEvent(commonEvent.id);
    });
It might be safe to move that part to Game_Map.prototype.initialize to avoid the reset on map change? I haven't looked into it in depth, though; that might cause problems. :kaoswt:
 

Latest Threads

Latest Posts

Latest Profile Posts

hmmm. an art of mine was removed from reddit, for a reason not even listed.
Going to try my luck with Rust programming language. C++ is just way too gosh darn frustrating.

Forum statistics

Threads
121,887
Messages
1,144,918
Members
160,140
Latest member
LagusaDumDum
Top