Creating a new window from the Actor Command window

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,635
Reaction score
5,116
First Language
English
Primarily Uses
RMVXA
I've created a "Status" window that shows extra information about battlers, and I want it to be accessible from the Actor Command window.  I've got the window itself working, but when I add it to the Actor Command window, even though it's accessible really weird things start to happen once the player visits the Status window.


It seems like even when the Status window is up and active, the player is still able to select and execute actor commands on the now-invisible Actor Command window (or even go back to the Party Command window and try to escape).  You can, for example, keep clicking Confirm to start a round of combat where everyone attacks.  Moving around with the cursor on the Status window can change which enemies are attacked or which actions (like Skills) are selected instead of attacks, but it seems to be done with almost no rhyme or reason.


I don't understand what I've done wrong, so I would REALLY appreciate some help from someone who knows what they're doing here. :)   Below, I've pasted the entirety of the code that is used to add the Status window to the battle scene and enable it from the Actor Command window - if you need to see any of the code for the Window itself, please say so and I'll show you by PM.



A little extra info: I figured this was because the Command windows were still somehow active, but adding .deactivate() commands into the command_status function didn't do anything, and when I put in some debug code (see green text) to write out the active windows to the console, at the time the Status Window is visited it only shows that _helpWindow, _scrollTextWindow, and _messageWindow are active.  Also, interesting, the orange text near the end of the code - which is gibberish meant to throw errors - only seems to be run once the combat actions are being executed already or the player hits Cancel multiple times (probably going farther back in the chain than the Party Command phase).  Overwriting the isOkEnabled() function for this window to always return false seems to have done absolutely nothing.


Window_ActorCommand.prototype.make_commands_with_status = Window_ActorCommand.prototype.makeCommandList;
Window_ActorCommand.prototype.makeCommandList = function() {
    this.make_commands_with_status.call(this);
    if (this._actor) {
        this.add_status_command();
    }
}


Window_ActorCommand.prototype.add_status_command = function() {
    this.addCommand('Status', 'battler_states', true);
}


Scene_Battle.prototype.command_status = function() {
    this._actorCommandWindow.hide();
    this._actorCommandWindow.deactivate();
    this._partyCommandWindow.hide();
    this._partyCommandWindow.deactivate();
    this.states_window.refresh();
    this.states_window.show();
    this.states_window.activate();
    this.states_help_window.refresh();
    this.states_help_window.show();
    // FOR TESTING
    var culprits = [this._logWindow,this._statusWindow,this._partyCommandWindow,this._actorCommandWindow,this._helpWindow,
            this._skillWindow,this._itemWindow,this._actorWindow,this._enemyWindow,this._messageWindow,this._scrollTextWindow]
    for (cul = 0; cul < culprits.length; cul++) {
        if (culprits[cul].active) {
            console.log("Window" + cul + " is active");
        }
    }
    // END TESTING

};


Scene_Battle.prototype.create_actor_command_with_status = Scene_Battle.prototype.createActorCommandWindow;
Scene_Battle.prototype.createActorCommandWindow = function() {
    this.create_actor_command_with_status.call(this);
    this._actorCommandWindow.setHandler('battler_states', this.command_status.bind(this));
};


Scene_Battle.prototype.create_all_windows_with_status = Scene_Battle.prototype.createAllWindows;
Scene_Battle.prototype.createAllWindows = function() {
    this.create_all_windows_with_status.call(this);
    this.create_states_window();
    this.create_states_help_window();
};


Scene_Battle.prototype.create_states_window = function() {
    this.states_window = new Window_Battle_States();
    this.states_window.setHandler('cancel', this.on_status_cancel.bind(this));
    this.states_window.setHandler('ok', this.on_status_ok.bind(this));
    this.addWindow(this.states_window);
    this.states_window.hide();
};


Scene_Battle.prototype.create_states_help_window = function() {
    this.states_help_window = new Window_States_Help();
    this.addWindow(this.states_help_window);
    this.states_help_window.hide();
    this.states_window.setHelpWindow(this.states_help_window);
};


Scene_Battle.prototype.on_status_cancel = function() {
    var e67 = eeras;
    this.states_window.hide();
    this.states_window.deactivate();
    this.states_help_window.hide();
    this._actorCommandWindow.activate();
    this._actorCommandWindow.show();
};


Scene_Battle.prototype.on_status_ok = function() {
    this.states_window.abatooie(eep);
}
 

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
969
Reaction score
808
First Language
English
Primarily Uses
N/A
Your problem seems to be somewhat related to the number of times and which windows you show/activate/hide/deactivate (especially since you mentioned hitting cancel multiple times, that sounds like a case of windows being hidden but still active). I'd suggest finding all the places where you show/activate/hide/deactivate windows, then double-checking to see if that window is actually active.


There are two other things (unrelated to your current problem, but may be a problem in the future): 

in this, you hide/deactivate the party command:


Scene_Battle.prototype.command_status = function() {    this._actorCommandWindow.hide();    this._actorCommandWindow.deactivate();    this._partyCommandWindow.hide();    this._partyCommandWindow.deactivate();


but you never show/activate it later on in Scene_Battle.prototype.on_status_cancel. The other thing is that you're aliasing stuff but adding the aliases to the thing itself:


Window_ActorCommand.prototype.make_commands_with_status = Window_ActorCommand.prototype.makeCommandList;Window_ActorCommand.prototype.makeCommandList = function() {    this.make_commands_with_status.call(this);    if (this._actor) {        this.add_status_command();    }}


This is more of a stylistic thing, really, but usually aliases are done somewhat like this, so as not to clog the base code:


var alias_window_actorcommand_makecommandlist = Window_ActorCommand.prototype.makeCommandList;Window_ActorCommand.prototype.makeCommandList = function() {    alias_window_actorcommand_makecommandlist.call(this);    if (this._actor) {        this.add_status_command();    }}



Edit: oh, and in Scene_Battle.prototype.create_states_window you hid the window you made but never deactivated it. That might be a problem. 
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,454
Members
137,821
Latest member
Capterson
Top