MZ Unison Skill Plugin

So I wanted to create some skills in my game that involved having 2 characters use both of their actions that turn to perform a skill together. At first it seemed like something simple to add, but to my knowledge, there's nothing in my plugin list that allows this. (For reference, I have been using VisuStella for the most part. Specifically, I have also been using the OTB Battle System plugin of theirs)

I have a video demonstrating the idea from an old project of mine in RPG Maker VX Ace, where I somehow easily found exactly what I needed.

So far, I do have some JS Code that would allow the game to check if Actor's A and B are in the current party, along with ensuring both spend the appropriate amount of resources for the skill, but that's basically it.
From what I've gathered + learned, I don't really know a way to fully implement this skill into the game with simple JS Notetags, though I have asked a few friends to help me see if it's possible.

Until then though, would anyone here know any plugins at all that would help accomplish this idea, or anything at all, I'd greatly appreciate it.

(Also if I've posted this to the wrong forum, I apologize)

Here's the video showcasing the idea that I mentioned. The first half covers the unified TP Bar used for the idea, which I've already implemented. Now I'm focusing purely on adding in the "requires 2 specific party members" thing now oof.

Hey,

I can't make any guarantees, but since in the OTB all battlers act immediately, there is a chance this would work there (I did not test anything):

To check whether all required actors are available you could try to add this to the skills note:
(Requires VisuStellas Skills&States Core)
Spoiler
JavaScript:
<JS Skill Enable>
  // Replace 3, 4 with the IDs of the participants
  let requiredActors = [3, 4].map(id => $gameActors.actor(id));
  // Make sure all participants can still act
  // (= unrestricted by states and either be the user or still be in the action queue)
  enabled = requiredActors.every(actor => {
    if (actor.isRestricted()) { return false; }
    if (!$gameParty.inBattle()) { return true; }
    if (actor === user) { return true; }
    return BattleManager._actionBattlers.includes(actor);
  });
</JS Skill Enable>
(In case this seems to work, make sure the skill is also properly disabled if some of the required actors already finished their turn)

To make sure all participating actors are losing their action (hopefully visible in OTBs turn order) when the skill is used, you could also add this to the note:
Spoiler
JavaScript:
<JS Pre-Start Action>
  // Also replace the actor IDs here:
  let requiredActors = [3, 4].map(id => $gameActors.actor(id));
  // ---
  requiredActors.reverse().forEach(actor => {
    let index = BattleManager._actionBattlers.indexOf(actor);
    if (index >= 0) {
      // Move all participants to the front of the queue:
      BattleManager._actionBattlers.copyWithin(1, 0, index);
      BattleManager._actionBattlers[0] = actor;
      // And clear their action:
      actor.clearActions();
    }
  });
</JS Pre-Start Action>
There is a chance that the moving part works, but the other actors can still input an action.
If that is the case, an easy solution might be to make a new State that lasts 0 turns and stuns the target until the end of their action, and replace the line
actor.clearActions();
with
actor.addState(27); (replace 27 with the ID of your stun state)

Edit: Small Fix
Hey,

I can't make any guarantees, but since in the OTB all battlers act immediately, there is a chance this would work there (I did not test anything):

To check whether all required actors are available you could try to add this to the skills note:
(Requires VisuStellas Skills&States Core)
Spoiler
JavaScript:
<JS Skill Enable>
  // Replace 3, 4 with the IDs of the participants
  let requiredActors = [3, 4].map($gameActors.actor);
  // Make sure all participants can still act
  // (= unrestricted by states and either be the user or still be in the action queue)
  enabled = requiredActors.every(actor => {
    if (actor.isRestricted()) { return false; }
    if (!$gameParty.inBattle()) { return true; }
    if (actor === user) { return true; }
    return BattleManager._actionBattlers.includes(actor);
  });
</JS Skill Enable>
(In case this seems to work, make sure the skill is also properly disabled if some of the required actors already finished their turn)

To make sure all participating actors are losing their action (hopefully visible in OTBs turn order) when the skill is used, you could also add this to the note:
Spoiler
JavaScript:
<JS Pre-Start Action>
  // Also replace the actor IDs here:
  let requiredActors = [3, 4].map($gameActors.actor);
  // ---
  requiredActors.reverse().forEach(actor => {
    let index = BattleManager._actionBattlers.indexOf(actor);
    if (index >= 0) {
      // Move all participants to the front of the queue:
      BattleManager._actionBattlers.copyWithin(1, 0, index);
      BattleManager._actionBattlers[0] = actor;
      // And clear their action:
      actor.clearActions();
    }
  });
</JS Pre-Start Action>
There is a chance that the moving part works, but the other actors can still input an action.
If that is the case, an easy solution might be to make a new State that lasts 0 turns and stuns the target until the end of their action, and replace the line
actor.clearActions();
with
actor.addState(27); (replace 27 with the ID of your stun state)
Just woke up and tried the code out.

It didn't really work though. Whenever I would pull the skill up, I would get this error in the console here:
Oh, apparently I did make an error in the first lines of both notes.
Fixed that one, still cannot really test anything since I do not have access to the OTB.

Original thread: https://forums.rpgmakerweb.com/threads/unison-skill-plugin.175980/