rafaeljbi

Trying to make progress everyday
Member
Joined
Apr 28, 2021
Messages
3
Reaction score
0
First Language
Portuguese
Primarily Uses
RMMZ
Sorry about my ignorance, but I need to disable the feature of auto-pause / auto-freeze on RPG Maker MZ.

You know when the game is running on MZ and you click outside the window, the game stops running, right?

There are two reasons for that, after some trials, It seems that this is the main problem for black screen when converting HTML5 into android / APK.

The second reason is that in one of my projects I need the sounds to be followed regardless the selected window.
I have an event that a character starts speaking, but if you click outside the window by accident, the dialogue is no longer synced...

So, if anyone can help me out on that, I'd very much appreciate it.

I'm new at the forum, but not that as an RPG Maker user...

Thanks in advance.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,209
Reaction score
15,549
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Requests. Thank you.



as this will need a plugin to achieve.
 

rafaeljbi

Trying to make progress everyday
Member
Joined
Apr 28, 2021
Messages
3
Reaction score
0
First Language
Portuguese
Primarily Uses
RMMZ
Sorry. But it is there a plugin to "fix" it or is there an option on RMVZ (native) to do so?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,367
Reaction score
8,775
First Language
German
Primarily Uses
RMMV
unlikely (yet) for the first question and no for the second.

what you propose is not as simple as you think it is, and someone will have to spent some time to write a plugin that does the changes.
 

Dev_With_Coffee

Veteran
Veteran
Joined
Jul 20, 2020
Messages
966
Reaction score
470
First Language
PT-BR
Primarily Uses
RM2k3
I found this line in more than one place on rmmz_core.js:
Code:
window.addEventListener("blur", this._onLostFocus.bind(this));

The next tests I did were using Game.exe and the Firefox browser.

I checked using window.onblur from the console (F12), it returned null.

I made a basic Plugin just that this event didn't happen, it didn't work, I tried to remove it manually, it didn't work either.

I also tried to remove with Javascript:
Code:
window.removeEventListener
Unsuccessfully...

Finally, I created a new "index.html" with pure code written from scratch, where it showed just one random number being changed every second.
I put a function to stop the execution for the "blur" event and removed the event by command line and it worked.

It concludes that the event that freezes the game cannot really be this, but it's also nothing in the DLLs.

My suggestion, it is better to find a plugin that pauses all types of sound in the game.
Leaving the game screen while it is running on Android can cause several problems depending on the version of this operating system, because each one had its own version of WebView and not everyone received an update.
 

rafaeljbi

Trying to make progress everyday
Member
Joined
Apr 28, 2021
Messages
3
Reaction score
0
First Language
Portuguese
Primarily Uses
RMMZ
I thank you very much for the kindness and dedicated time. I wish I could enjoy MZ at full, but MV is more and more becoming a more viable option... it is kind of a frustration, though...

I tested a conversion to APK by using a simple software. MV files work just fine, but for MZ it return a black screen with sound only...

If only there was an easier way to convert MZ to Android it would help a lot. The music part I will figure something out by adding more and more events to the chats...
 

Dev_With_Coffee

Veteran
Veteran
Joined
Jul 20, 2020
Messages
966
Reaction score
470
First Language
PT-BR
Primarily Uses
RM2k3
I created a Plugin that pauses BGM and BGS when leaving the screen and when it focuses back on the game screen, both continue where they left off (Memorizing through the POS of the WebAudio API).
The problem is that I am still finishing so that this also works correctly with ME and SE.

I have no deadline to complete, as I am working all week and the weekend too.
I also cannot guarantee that I will succeed.

In fact, the sound of the MV is very similar to that of the MZ.

A game made by the MV on Android may be that the audio plays even though it leaves the screen, which will make it very strange, I even created a Plugin that does the same effect as the MZ if it leaves the window, to make the audio plugin compatible.

Perhaps there is already a PLUGIN that does this process in MZ.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,986
Reaction score
2,304
First Language
EN
Primarily Uses
RMMZ
I think the attached plugin should do it~
JavaScript:
/*:
 * @target MZ
 * @plugindesc The game will remain active even if it loses focus.
 * @author Caethyril
 * @help Free to use and modify!
 */

// Override! Always return true (default: false if game doc is not in focus).
SceneManager.isGameActive = function() { return true; };
(Credit is appreciated but not necessary: this is a very simple plugin.)
 

Attachments

  • noUnfocusPause.js
    286 bytes · Views: 14

Latest Threads

Latest Profile Posts

7DcJlIG.png


Made a lot of progress on the tileset for the more sumptuous interior areas for the priory
I keep thinking up of new changes or improvements... Edit: Forgot to add the image Gimpwork.JPG
Hello, my nickname is Rigomor, but I am also known as Mopsikus. I work on RPG Maker games, and are currently working on a game called Peony of War.

Forum statistics

Threads
117,299
Messages
1,106,293
Members
153,480
Latest member
Varlen
Top