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
478
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,505
Reaction score
2,635
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
478
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,505
Reaction score
2,635
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

Going live for tonight's stream! Kytt isn't feeling 100% tonight so the wifestream will be tomorrow and I'll be playing Final Fantasy XIV for this one instead. Twitch
i got bronchitis ; n ;
I've been trying very hard to distance myself from my inspirations, but maybe It would be better just to accept it.
3uL5XnP.gif
For my 100th post, I wanted to thank this forums community for the generosity and respect that each of you show.

I'm always impressed when I see the 6x veterans (in number of years compared to my presence here on these forums) continue to help and support all the community members on a daily basis, the awesome artists who share their creations with so much passion...
If a person becomes voluntarily missing, does it cause the butterfly effect?

Forum statistics

Threads
121,914
Messages
1,145,182
Members
160,192
Latest member
ZeethaSkif
Top