Take Screenshot For Background

Eilwyn

Veteran
Veteran
Joined
Mar 13, 2012
Messages
182
Reaction score
35
First Language
English
Primarily Uses
RMMV
Hi All,

For my game, I'm making a custom menu made with events. To accomplish this, when the player presses the ESC button, the game will gather their MAPID and coordinates then transfer them to another map but without a fade effect... this map will be the menu.

I want it to appear as if the player is not actually changing maps. To achieve this, I'm in need of a plugin.

The plugin I'm requesting will do the following:

1. When the player presses the ESC button, the game will take a screenshot of what the player currently sees and will take it before the transfer.

2. When the player transfers to the other map, the Parallax Background displays the screenshot.

3. The screenshot image should still go into the Parallax folder and the name of the background should have an [!] before it so it doesn't move or shift as the character moves my cursor... IE: "!MenuBG.png"

I made a few mock images to display what I want:





1. This is what the player should see before pressing ESC
2. This is the map that the player transfers to after pressing ESC (The White background is a parallax bg)
3. This is what the player should see after transferring to the other map. (Keep in mind again that this background should always match what the character sees before pressing ESC)

Thanks in advance for help.
 

Attachments

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,055
Reaction score
10,309
First Language
Czech
Primarily Uses
RMMV
Which devices is your game intended for?
It's a very important question, because on android/iOS it might not be possible.
 

Eilwyn

Veteran
Veteran
Joined
Mar 13, 2012
Messages
182
Reaction score
35
First Language
English
Primarily Uses
RMMV
Just for the computer. I'm developing on Windows if that also matters.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,055
Reaction score
10,309
First Language
Czech
Primarily Uses
RMMV
Here's the plugin:

https://github.com/Poryg1/RPG-maker-MV-small-plugins

It's called POR_SnapPlugin.js
Instructions on how to use it are rather simple:
Screenshot_2.png
The loop is necessary, because it runs asynchronously, and the wait is necessary, because without it it takes much longer to finish the snap.
Just instead of the done text you'll have your transfer command.
Once I have more time, I'll figure out how to create encrypted files and send the update, because without that it would crash the game in case you encrypt it.
 
Last edited:

Eilwyn

Veteran
Veteran
Joined
Mar 13, 2012
Messages
182
Reaction score
35
First Language
English
Primarily Uses
RMMV
Here's the plugin:

https://github.com/Poryg1/RPG-maker-MV-small-plugins

It's called POR_SnapPlugin.js
Instructions on how to use it are rather simple:
View attachment 106677
The loop is necessary, because it runs asynchronously, and the wait is necessary, because without it it takes much longer to finish the snap.
Just instead of the done text you'll have your transfer command.
Once I have more time, I'll figure out how to create encrypted files and send the update, because without that it would crash the game in case you encrypt it.
Hi,

Thanks! I was asleep when you send the reply and just got up, I'm testing it right now and I'll let you know how it works out for me as soon as I test it.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,055
Reaction score
10,309
First Language
Czech
Primarily Uses
RMMV
It should work with no issues, since it doesn't conflict any plugins. I've tested it on both Canvas and WebGL mode, version 1.6.1, PIXI 4.5.4.
 

Eilwyn

Veteran
Veteran
Joined
Mar 13, 2012
Messages
182
Reaction score
35
First Language
English
Primarily Uses
RMMV
It's working fine. I had a bit of a hiccup, but that turned out to be user error on my part. (I accidentally capitalized it and wrote POR_Snap instead of POR_snap).

There is some lag though, but I wouldn't be surprised if that was more to do with my end than the plugin.

Thank you! Much appreciated!
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,055
Reaction score
10,309
First Language
Czech
Primarily Uses
RMMV
Some lag is always to be expected, because snapshots are resource heavy. However, I'll try my best to optimize it and perform some more studies, because coincidentally I've been trying to solve the issue of how to take snapshots using MV for a long time. I've found how to make it a synchronous operation for WebGL, which would greatly simplify eventing, because we'd get rid of that horrendous for loop, but still need to figure it out for Canvas mode. If I figure it out, I'll post an update to this thread.

EDIT: Updated. The website now contains a version that is fully synchronous and as such gets rid of the ugly for loop. The only thing you need now is the plugin command. Hopefully it is faster.
I would still recommend you to back up the async version just in case it's actually slower.
 
Last edited:

Eilwyn

Veteran
Veteran
Joined
Mar 13, 2012
Messages
182
Reaction score
35
First Language
English
Primarily Uses
RMMV
Hi,

I finally got around to being able to test the updated version of the plugin and there is a problem.

The plugin only takes the screenshot the first time I enter the menu, but if I exit the menu, walk my character a bit then enter the menu again, it displays the screenshot from earlier, before I moved my character.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,055
Reaction score
10,309
First Language
Czech
Primarily Uses
RMMV
Interesting. It works on my end with no issues.
How do you have your transition to menu programmed? (the part with the snapshot command and a bit of code above it if you have, preferably screenshot).
 

Eilwyn

Veteran
Veteran
Joined
Mar 13, 2012
Messages
182
Reaction score
35
First Language
English
Primarily Uses
RMMV

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,055
Reaction score
10,309
First Language
Czech
Primarily Uses
RMMV
I see nothing wrong with the event.
If you perform two transitions and check the project directory afterwards, is the parallax updated?
 

Eilwyn

Veteran
Veteran
Joined
Mar 13, 2012
Messages
182
Reaction score
35
First Language
English
Primarily Uses
RMMV
Yes, it appears it does update in the directory.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,055
Reaction score
10,309
First Language
Czech
Primarily Uses
RMMV
I found the culprit.
The cache will always load up the same image regardless of how many times it changes.
The reason why is simple. By default the browser keeps it in its own cache and eventually discards it after a while if enough files get loaded (their cache is several hundreds of MB though nowadays, so it would take a while). And MV doesn't force the image to be loaded from the hard drive.
So I've edited the plugin. It now forces the image to be reloaded everytime it's saved, just to overwrite the entry inside browser cache if there's any. You don't need to worry about the game being slowed down, it runs asynchronously, so it won't slow down your game, and if the player wants to reenter the menu, it's already in the browser cache and MV will pull it out of there.
The updated version can be found on github once again.
 
Last edited:

Eilwyn

Veteran
Veteran
Joined
Mar 13, 2012
Messages
182
Reaction score
35
First Language
English
Primarily Uses
RMMV
It works properly now, thank you! ..and sorry again that some of my replies took a while.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,055
Reaction score
10,309
First Language
Czech
Primarily Uses
RMMV
People have their own lifes and answer only when they can, it's natural that you can't answer 24/7. So no need to apoogize for that. It took me some time to construct the solution as well. :D
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Okay, that's the best I can do. Looks a little strange but..err.. it's my style, yeah, very original style..
being an extreme introvert with massive anxiety... I forget this is really, REALLY frustrating for people who are the exact opposite. still, wait this out and stay home...
I hope you all are keeping safe. <3 If you need a shoulder or an ear, I have two of both and am more than willing to listen & support you! Times are weird.
My dad, super frustrated by seclusion, asking me how I live like this. I shrug. "It helps to not like what is outside."
Apparently it's not just people who are hit by corona virus. My phone has set itself to English language on its own. Not that I'm complaining... :D

Forum statistics

Threads
95,443
Messages
929,187
Members
125,685
Latest member
imnotanepicgamer
Top