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

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
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.
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() {
   // ...
}
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 😅
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"
Nice!
But now I have a new problem 😅
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.

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-for-changing-a-function-already-implemented-saving-its-original-content.144222/