Status
Not open for further replies.

ArbalestSD

Villager
Member
Joined
Jun 15, 2020
Messages
28
Reaction score
5
First Language
English
Primarily Uses
RMMV
I once again come to you with what is probably a pretty obvious mistake, but I can't figure it out. So when I start my game normally (new game) everything works just fine. What I want to do is modify:
JavaScript:
Scene_Map.prototype.isReady

So I add the following code:

JavaScript:
_DynamicCharacterSprite__Scene_Map_prototype_isReady = Scene_Map.prototype.isReady;
Scene_Map.prototype.isReady = function(){
    _DynamicCharacterSprite__Scene_Map_prototype_isReady.call(this);
}

As far as I can tell this code should literally do nothing. Right now it should just intercept the normal call for 'Scene_Map.prototype.isReady' and then call the actual function 'Scene_Map.prototype.isReady' and looking at the debugger, that is what is happening.
However, my game won't start anymore. If I start a new game with the only change being that added bit of code the game will get stuck in an indefinite loading screen.
1638216522457.png
What is going on here? Why does it do that and how do I prevent it from getting stuck in an infinite loop?
 

eomereolsson

Veteran
Veteran
Joined
Sep 29, 2021
Messages
154
Reaction score
129
First Language
German
Primarily Uses
RMMV
Your code will work if you change it to the following:
JavaScript:
_DynamicCharacterSprite__Scene_Map_prototype_isReady = Scene_Map.prototype.isReady;
Scene_Map.prototype.isReady = function(){
    return _DynamicCharacterSprite__Scene_Map_prototype_isReady.call(this);
}

The original isReady-function returns if the scene is ready - apparently this is used to determine how when it is no longer necessary to show the 'now loading' - screen. You intercept that with your own function. And while you do call the original, you don't pass on the value it returns. That currently just vanishes into the void.

Of course the return statement will cause the function to end. So if you want to execute some code after the call to the original function you need to do something like this:
JavaScript:
_DynamicCharacterSprite__Scene_Map_prototype_isReady = Scene_Map.prototype.isReady;
Scene_Map.prototype.isReady = function(){
    var result = _DynamicCharacterSprite__Scene_Map_prototype_isReady.call(this);
    //your custom code goes here
    return result;
}
 

Shaz

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

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

I think Kipling said it best.

If you can make one heap of all your winnings
And risk it on one turn of pitch-and-toss,
And lose, and start again at your beginnings
⁠And never breathe a word about your loss,
(...)
Yours is the Earth and everything that's in it,
⁠And—which is more—you'll be a Man, my son!


Do you feel like your modern cities are too clean? I made some dumpsters and trash variations. Visit my MZ resource thread (link in signature).
Doing clean-up on tall-ified sprites, filling in pixel by pixel where the stretching warped the image, feels incredibly tedious but also highly rewarding when one zooms out and the sprite looks even better than before.

Forum statistics

Threads
118,578
Messages
1,117,102
Members
155,638
Latest member
DSLC
Top