MZ Check to see which actor is inputting their turn during battle

Hi, folks. Been plugging away at MZ and checking the forums, but just haven't been able to figure this out.

In battle, I want to display a picture over top of the battle screen when it is a specific person's turn. When Actor A is taking their turn, (selecting an item or a skill, that sort of thing), I want to display "Picture A".

Then, when Actor B takes their turn, do the same thing, but with Picture B.

My idea was that I could create a Parallel Common Event, with conditional branches that check to see who's taking their turn.

Right now, I am trying to use a script of
Code:
BattleManager.subject.name() == 'actorA_name'

I can't get it to work, though. That specific example gives me a TypeError: cannot read property 'name' of undefined. I've tried a few different variations, but haven't been able to get anything to work yet.

I'm using plugins, but I don't believe they would be affecting this. I'm using the Aerosys UI plugins, as well as RemovePartyCommand, which just removes the party command window prior to battle.

Is it even possible to do something like this in MZ?
My idea was that I could create a Parallel Common Event, with conditional branches that check to see who's taking their turn.
First thing is that parallel common events don't run in battle. That can be changed with a plugin, but they don't run without one. Are you using a plugin that does that or is this a troop event?

BattleManager.subject.name() == 'actorA_name'
The battleManager's subject is BattleManager._subject not BattleManager.subject, but the subject isnt quite the same as the inputting actor. try BattleManager.actor() && BattleManager.actor().name() == 'actorA_name'

also

I've moved this thread to Javascript/Plugin Support. Thank you.

You probably want something like
JavaScript:
BattleManager.startActorInput = function() {
    if (this._currentActor) {
        this._currentActor.setActionState("inputting");
        this._inputting = true;
        switch (this._currentActor._actorId) {
            case actorA:
                createPictureA() //idk how to make a picture with plugins
                break;
            case actorB:
                createPictureB();
                break;
            default:
                createDefaultPic();
        }
    }
};

BattleManager.finishActorInput = function() {
    if (this._currentActor) {
        if (this.isTpb()) {
            this._currentActor.startTpbCasting();
        }
        this._currentActor.setActionState("waiting");
        deleteActorPicture(); //<--
    }
};

BattleManager.cancelActorInput = function() {
    if (this._currentActor) {
        this._currentActor.setActionState("undecided");
        deleteActorPicture(); //<--
    }
};

Can't test this tho 'cause I never learned how to make pictures with plugins.

Edit: Pictures can be made by the interpreter but idk where the game interpreter is stored.

JavaScript:
// Show Picture
Game_Interpreter.prototype.command231 = function(params) {
    const point = this.picturePoint(params);
    // prettier-ignore
    $gameScreen.showPicture(
        params[0], params[1], params[2], point.x, point.y,
        params[6], params[7], params[8], params[9]
    );
    return true;
};

// Move Picture
Game_Interpreter.prototype.command232 = function(params) {
    const point = this.picturePoint(params);
    // prettier-ignore
    $gameScreen.movePicture(
        params[0], params[2], point.x, point.y, params[6], params[7],
        params[8], params[9], params[10], params[12] || 0
    );
    if (params[11]) {
        this.wait(params[10]);
    }
    return true;
};

// Erase Picture
Game_Interpreter.prototype.command235 = function(params) {
    $gameScreen.erasePicture(params[0]);
    return true;
};
First thing is that parallel common events don't run in battle. That can be changed with a plugin, but they don't run without one. Are you using a plugin that does that or is this a troop event?


The battleManager's subject is BattleManager._subject not BattleManager.subject, but the subject isnt quite the same as the inputting actor. try BattleManager.actor() && BattleManager.actor().name() == 'actorA_name'

also Moved to: Javascript/Plugin Support
I am not using a plugin, but I suppose I should look into one so that I can try using the BattleManager code you provided; thank you for that, as well as moving the thread, my mistake.

If that doesn't work, I'll try Lowrell's suggestion, and then report back.
First thing is that parallel common events don't run in battle. That can be changed with a plugin, but they don't run without one. Are you using a plugin that does that or is this a troop event?


The battleManager's subject is BattleManager._subject not BattleManager.subject, but the subject isnt quite the same as the inputting actor. try BattleManager.actor() && BattleManager.actor().name() == 'actorA_name'

also Moved to: Javascript/Plugin Support

Coming back to this, the conditional check you provided does work as so far as not throwing an error, but I can't get it to functionally work.

How I currently have it set up, is that I have a common event with a parallel trigger. I have the event called at the beginning of the battle, via Troops. I installed a plugin that lets me run parallel events. The problem is that while the event is called, the check doesn't seem to be actually working.

I have a feeling that this is due to the common event not actually checking at the right 'times', but I'm not sure how to confirm that. Here's how I have my event set up. I've also added a screenshot of my actor names, so I can prove that they 100% match. Any further guidance would be super appreciated.


1773422662567.png

1773422689079.png

Original thread: https://forums.rpgmakerweb.com/threads/check-to-see-which-actor-is-inputting-their-turn-during-battle.182606/