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

willoneill

Veteran
Veteran
Joined
Dec 30, 2012
Messages
53
Reaction score
12
First Language
English
Primarily Uses
N/A
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!
 

taarna23

Marshmallow Princess
Global Mod
Joined
Jul 20, 2012
Messages
2,433
Reaction score
5,228
First Language
English
Primarily Uses
RMMZ
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.
 

willoneill

Veteran
Veteran
Joined
Dec 30, 2012
Messages
53
Reaction score
12
First Language
English
Primarily Uses
N/A
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. :)
 

taarna23

Marshmallow Princess
Global Mod
Joined
Jul 20, 2012
Messages
2,433
Reaction score
5,228
First Language
English
Primarily Uses
RMMZ
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.
 

willoneill

Veteran
Veteran
Joined
Dec 30, 2012
Messages
53
Reaction score
12
First Language
English
Primarily Uses
N/A
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!
 

willoneill

Veteran
Veteran
Joined
Dec 30, 2012
Messages
53
Reaction score
12
First Language
English
Primarily Uses
N/A
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!
 

taarna23

Marshmallow Princess
Global Mod
Joined
Jul 20, 2012
Messages
2,433
Reaction score
5,228
First Language
English
Primarily Uses
RMMZ
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.
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

If you still don't subscribe our Polish channel please consider it :)
1.png
Who wants to see my review of the worst star wars movie? This movie has all the excitement of being on Jury Duty of the most boring case ever about trade negotiations.
A lot to learn to make a game. Can I handle it?
I've been working on status effects since last thursday, and today I finished the core mechanic of Zombie, Teleport, Curse and Recall. Zombie and Curse are lacking a few things to make them complete atm. Teleport though is the "HAHA" spell for some of my mobs, but can "NOPE" at them with Recall.
I'm weird as there are a few game franchises I'll watch and read about, but have no interest in playing.

Forum statistics

Threads
115,165
Messages
1,087,748
Members
149,707
Latest member
hardrockmessi12
Top