Default Fade In / Fade Out Event - Which .js to alter?

Thanks to the tips you all have given me, I'm having a blast messing with the .js files to alter a lot of the default event actions in MV!


One thing I can't figure out, though: Which .js file do I change - and what do I change within it - if I want to lengthen the default time (number of frames, I'm guessing) for the "Fadeout Screen" and "Fadein Screen" actions? Just want to slow it down a bit.


Thanks in advance, as always!
What you need is in rpg_scenes.js, in the Scene_Base class. There are a number of fade-related functions.


I would like, however, to point out how much of a very bad idea it is to mess with the classes themselves. It is much better to make a basic plugin and edit that. You can just override that function that does what you need from there.
What you need is in rpg_scenes.js, in the Scene_Base class. There are a number of fade-related functions.


I would like, however, to point out how much of a very bad idea it is to mess with the classes themselves. It is much better to make a basic plugin and edit that. You can just override that function that does what you need from there.



Thanks, Taarna...! As somebody new to this, can you give me any insight as to why it's a bad idea to mess with the classes? Is it potentially risky just to change a variable here or there, as I'm doing, or are you saying that I shouldn't mess extensively with them?


Because don't worry; I wouldn't even know how to do that. 🙂
You shouldn't change the underlying base code at all. Especially if you can't be 100% certain what you changed. Additionally, your project will never be updateable to later versions of MV, as they may include updates to the base code, which would overwrite your changes.


What you'll need is a basic plugin and then copy and paste the function you want to change. Mess around in that, and if you break something, no big deal. Remove the plugin, or comment out the code that caused issues.


Here is a really basic plugin framework:


//=============================================================================
// MyPluginName.js
//=============================================================================

/*:
* @plugindesc Put your plugin's description here.
* @author Put your name/nickname/handle here
*
* @help Plugin help goes here, if your plugin has plugin commands. Otherwise just inform the user that the plugin does not have commands.
*/

(function() {
// Do not remove above

// Your code goes here. Feel free to just copy a whole method from the base code into here and tinker. Plugin code will take priority over base code and
// override the original method.

// Do not remove below
}) ();


It should be noted that this doesn't allow anything fancy like letting other plugins detect if yours is included in running code. I have not learned how to do this yet.
You shouldn't change the underlying base code at all. Especially if you can't be 100% certain what you changed. Additionally, your project will never be updateable to later versions of MV, as they may include updates to the base code, which would overwrite your changes.


What you'll need is a basic plugin and then copy and paste the function you want to change. Mess around in that, and if you break something, no big deal. Remove the plugin, or comment out the code that caused issues.


Here is a really basic plugin framework:



//=============================================================================
// MyPluginName.js
//=============================================================================

/*:
* @plugindesc Put your plugin's description here.
* @author Put your name/nickname/handle here
*
* @help Plugin help goes here, if your plugin has plugin commands. Otherwise just inform the user that the plugin does not have commands.
*/

(function() {
// Do not remove above

// Your code goes here. Feel free to just copy a whole method from the base code into here and tinker. Plugin code will take priority over base code and
// override the original method.

// Do not remove below
}) ();


It should be noted that this doesn't allow anything fancy like letting other plugins detect if yours is included in running code. I have not learned how to do this yet.



Awesome, I'll give it a shot! Thanks very much for your help!
What you need is in rpg_scenes.js, in the Scene_Base class. There are a number of fade-related functions.


I would like, however, to point out how much of a very bad idea it is to mess with the classes themselves. It is much better to make a basic plugin and edit that. You can just override that function that does what you need from there.



Hey taarna,


OK! I've been giving making a small plugin to handle this a shot. So far, though, no luck. I've taken everything from rpg_scenes.js that looks like it should control it, but changing the variables doesn't seem to help. Can you give me a hand? This is the plugin so far:


//=============================================================================
// WZO_DefaultFadeSpeed.js
//=============================================================================

/*:
* @plugindesc A quick and easy way to control the default speed of the 'Fadeout Screen' and 'Fadein Screen' commands in the Event Editor. Crucial for dramatic pacing...!
* @author willoneill
*
* @help Should be self-explanatory?
*/

(function() {
// Do not remove above

Scene_Base.prototype.startFadeIn = function(duration, white) {
this.createFadeSprite(white);
this._fadeSign = 1;
this._fadeDuration = duration || 30;
this._fadeSprite.opacity = 255;
};

Scene_Base.prototype.startFadeOut = function(duration, white) {
this.createFadeSprite(white);
this._fadeSign = -1;
this._fadeDuration = duration || 30;
this._fadeSprite.opacity = 0;
};

// Do not remove below
}) ();


Am I not changing the right thing? Or is the syntax off somehow? I've put the values back to default, but I had changed that '30' duration to a way higher number (320) and nothing happened.


Let me know, thanks!
Try putting this in and altering the time:


Scene_Base.prototype.fadeSpeed = function() {
return 24;
};


If not that, then you'll need help from someone more knowledgeable than I.


Edit: Not sure if the stuff you have in there will make a change, given that it ultimately refers to the above.

Original thread: https://forums.rpgmakerweb.com/threads/default-fade-in-fade-out-event-which-js-to-alter.64736/