"Aliasing" is a technique that allows you to add your own code to an existing function without completely overwriting it. In JavaScript, the correct term is actually "monkey-patching", but people often refer to it as "aliasing" in the RPG Maker community. It allows you to make your own modifications/additions to the core scripts, while still maintaining compatibility with other plugins and future core script updates. Sometimes you have no choice but to completely overwrite a function, but it's ideal to try to alias when possible. The general structure for aliasing
Window_ActorCommand.prototype.setup would be something like this:
JavaScript:
// Save the original function into a new variable
const Art_Window_ActorCommand_setup = Window_ActorCommand.prototype.setup;
// Re-define the function
Window_ActorCommand.prototype.setup = function(actor) {
/* Put your own code here if you want */
// Call the original function that we had saved into a new variable
Art_Window_ActorCommand_setup.call(this, actor);
/* Put your own code here if you want */
};
Without more information, it's kinda hard to tell you exactly what to do, but here is an example that might get you on the right track. Put this into a .js file and add it to your project through the plugin manager:
JavaScript:
const Art_Window_ActorCommand_setup = Window_ActorCommand.prototype.setup;
Window_ActorCommand.prototype.setup = function(actor) {
if (actor) {
this.repositionWindow(actor);
}
Art_Window_ActorCommand_setup.call(this, actor);
};
Window_ActorCommand.prototype.repositionWindow = function(actor) {
const startingX = 100;
const actorSpacing = 150;
const ww = 192;
const wh = SceneManager._scene.windowAreaHeight();
const wx = startingX + actorSpacing * actor.index();
const wy = 331;
this.move(wx, wy, ww, wh);
};
I changed the
ww and
wh values that you had, because they would have yielded a crazily-wide window that is only tall enough to fit one line, and I wasn't sure if that was intentional or not. But obviously, feel free to change them to suit your needs. You will almost definitely need to change
startingX and
actorSpacing, since I just chose random values there.
startingX is the x value that would put your window above the very first actor.
actorSpacing is the horizontal distance that the window needs to travel to be above the next actor--in other words, the space between each actor. This code assumes that you have equal space between each actor, btw.