Just the title. I'm just trying to find a way to push the base combat UI off the screen and then have whatever you're currently hovering on adjust a variable so that my HudMakerUltra setup can react to it
MZ Is there a way to adjust a variable based on which option in the action menu is being hovered over? Or how could I go about making a plugin for this?
RPG Maker MZ SupportHey there, definitely possible and in fact, I'm using it in my own game. The code is quite easy too.
JavaScript:
const CommonUtils_Window_Selectable_Select = Window_Selectable.prototype.select;
Window_Selectable.prototype.select = function (index) {
CommonUtils_Window_Selectable_Select.call(this, index);
if (index !== this._lastHoveredIndex) {
this._lastHoveredIndex = index;
$gameVariables.setValue(1, index);
}
};
Thanks man, this should really simplify customizing the combat menu.
Happy to help, and good luck.
Just keep in mind this will save ALL "selectable" hovers to the variable. That includes the choice window, enemy window, number input, and basically everything that can be "selected". If you only want to target the actor command window specifically, use
Just keep in mind this will save ALL "selectable" hovers to the variable. That includes the choice window, enemy window, number input, and basically everything that can be "selected". If you only want to target the actor command window specifically, use
Window_ActorCommand instead, since it inherits from Window_Selectable anyway.Makes sense. Following up from that, how could I adjust a variable based on what window is currently open?
Hmm, that's a bit more complex.
There is no easy way to check which window is currently open.
Basically you'll have to check which Scene is currently open (since all Windows are part of the Scene object) and then check if any of the windows on that scene are 'null' or not.
For that you need to have a thorough understanding of the source code. 😀
But it depends on your use case. What exactly are you trying to accomplish?
There is no easy way to check which window is currently open.
Basically you'll have to check which Scene is currently open (since all Windows are part of the Scene object) and then check if any of the windows on that scene are 'null' or not.
For that you need to have a thorough understanding of the source code. 😀
But it depends on your use case. What exactly are you trying to accomplish?
Hmmm, I think in battle you get the active window with like:
const S = SceneManager._scene;const windows = [S._partyCommandWindow, S._actorCommandWindow, S._skillWindow, S._itemWindow, S._actorWindow, S._enemyWindow];const activeW = windows.find((window) => window.active);Yes, this could definitely work, but it would only be battle-specific as you mentioned.
I guess if you wanted to make it scene-agnostic, you could do:
JavaScript:
const activeWindow = Object.values(SceneManager._scene).find(
(window) => window instanceof Window_Selectable && window.active
);
But that's a bit hacky. 😀
This is just for combat setup, so this is all good. Thanks for the help, people.