👋 No worries there! An alias/patch approach like I described simply adds extra code to run before and/or after what it already does. It doesn't matter what the method does before patching: it gets invoked as part of the new method definition.
Put another way, these two code snippets function identically:
JavaScript:
(function(alias) { // IIFE argument (i.e. local variable) is named "alias"
Window_ShopBuy.prototype.select = function(index) { // override method
alias.apply(this, arguments); // invoke stored method
// your code here
};
})(Window_ShopBuy.prototype.select); // pass current "select" method in as an IIFE argument
JavaScript:
(function() { // IIFE to hide _Window_ShopBuy_select from the global scope
var _Window_ShopBuy_select = Window_ShopBuy.prototype.select; // store current "select" method
Window_ShopBuy.prototype.select = function(index) { // override method
_Window_ShopBuy_select.apply(this, arguments); // invoke stored method
// your code here
};
})();
Overriding and/or storing methods is a big part of why plugin load order matters so much.
Just for interest, I think the code you quoted says something like this:
- If the party is in battle and Charge Turn Battle mode is active, then:
- Clear the charge counters for all party members.
- Then run the
select method of Window_Selectable, as it was immediately before Yanfly's CTB plugin loaded.
I'm unsure why Yanfly didn't store/invoke the
Window_ShopBuy version of that method (probably just an oversight); regardless, it doesn't seem to directly conflict with anything on the shop scene.