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,086
Reaction score
15,501
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,267
Reaction score
8,722
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
965
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
965
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,957
Reaction score
2,292
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: 13

Latest Threads

Latest Posts

Latest Profile Posts

Of course, I bought a handful of games on the Steam Black Friday sale. Will I try them? Will I complete any? Who knows...
I don't really have any neat updates today about how I screwed up programming... But if you want to observe the intensenes of me programming, then you can check out my stream :)
New Weapons.gif
No more spam from me today, I promise! Just wanted to upload this, people have been giving me feedback that my weapon sprites (which were RTP) clashed badly with my battlers for ages, so today I finally took the plunge and updated them! Really happy with how they came out :D :D
So Facebook fraudulently took money from me. They even went through my PayPal accounts to find a card that had the money on it. Thinking about deleting my Facebook account because this doesn't happen on twitter, not even close.
Today the 2nd part of the RPGMakergame "A Thief's voyage" came out.


Go show DutchPowerCreations some love.

Forum statistics

Threads
116,995
Messages
1,103,692
Members
152,894
Latest member
NinjaBunny
Top