RMMV Is there a way for changing a function already implemented saving its original content?

JessIchigoShadow

Villager
Member
Joined
Sep 20, 2021
Messages
8
Reaction score
3
First Language
Italiano
Primarily Uses
RMMV
For example, I want to call the item window but with only the "items" section. Is there a way to save the Window_CommandList.prototype.makeCommandList function and changing it? Like, I want to have the items only when I specifically call for that type of scene but otherwise the standard one
 

Jragyn

JABS codemonkey
Veteran
Joined
Aug 14, 2012
Messages
292
Reaction score
227
First Language
English
Primarily Uses
RMMZ
Though the entirety of the post isn't necessarily relevant to what you ask for, the general idea of "aliasing a function", which is what I believe you're asking for, is described in one of the top posts in this section of the forum. For your convenience, here's a link:
The main post itself is where the information exists, around step 3 or something.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,812
Reaction score
9,117
First Language
Indonesian
Primarily Uses
RMVXA
Yes, you can change the function on the fly for a specific object only you created, for example
Code:
const cmdWindow = new Window_CommandList()
cmdWindow.makeCommandList = function() {
   // ...
}
 

JessIchigoShadow

Villager
Member
Joined
Sep 20, 2021
Messages
8
Reaction score
3
First Language
Italiano
Primarily Uses
RMMV
Yes, you can change the function on the fly for a specific object only you created, for example
Code:
const cmdWindow = new Window_CommandList()
cmdWindow.makeCommandList = function() {
   // ...
}
Nice!
But now I have a new problem :rswt
I implemented a new Scene calling the cmdWindow, and when I call it with SceneManager.push(Negozio) //the name of the new Scene, nothing appears on the screen, the protagonist can't move and it returns an error only when you load the game in the console, "Cannot read property term of undefined"
 
Last edited:

Jragyn

JABS codemonkey
Veteran
Joined
Aug 14, 2012
Messages
292
Reaction score
227
First Language
English
Primarily Uses
RMMZ
Nice!
But now I have a new problem :rswt
I implemented a new Scene calling the cmdWindow, and when I call it with SceneManager.push(Negozio) //the name of the new Scene, nothing appears on the screen, the protagonist can't move and it returns an error only when you load the game in the console, "Cannot read property term of undefined"
It would be difficult to troubleshoot further without actually seeing the surrounding code and all that, as what is provided above is a rough example of the pattern, not necessarily what you specifically should probably be doing.
 

Latest Threads

Latest Posts

Latest Profile Posts

I officially declare today "test play day." I'm going to waste the whole day playing video games, which isn't a shock to anybody, but hopefully today I'll play my own and figure out what still needs fixin's.
Empty Bottles and Health Extenders are now a thing.
Also the Sling-Shot does damage to enemies now, but not a lot and you won't get gold from killing them that way.
ScreenShot_5_26_2022_11_36_32.png
added a Panic gauge to battle. it fills up according to your actions. each character has a different passive that activates once the gauge is full. also once full, a countdown starts and after each action taken, the gauges decreases. with each character, the decrease is different.
Genuinely considering making a thread informing people how to Google.

Forum statistics

Threads
122,164
Messages
1,146,959
Members
160,434
Latest member
SirBigSad
Top