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?
MV Script call for managing timer interruptions so that map changes don't pause the countdown
Learning JavascriptParallel 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
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?
Event commands are handled through an event interpreter instance (
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
It might be safe to move that part to
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);
});
Game_Map.prototype.initialize to avoid the reset on map change? I haven't looked into it in depth, though; that might cause problems. 😅Original thread: https://forums.rpgmakerweb.com/threads/script-call-for-managing-timer-interruptions-so-that-map-changes-dont-pause-the-countdown.144430/