MV Shared MP between 2 actors

Alright, this might be really tricky to implement, so bear with me.
I'm trying to make it so that two separate actors use the same MP bar. The goal is to have two permanent party members and two switchable members, with each pair being "connected" to each other.
So, in essence:
  1. Actor in position 1 has 10 MP and is connected to actor in position 3
  2. Actor in position 3 uses a skill with the cost of 3 MP
  3. Actor in position 1 now has 7 MP
I imagine the solution would be to have one MP bar always match each other or somehow ignore one of them entirely, but I don't have a clue how to achieve that.

I'm open to any suggestions. Thanks in advance.
So what you're talking about would be a small plugin. It would need to change the change actor behavior in two ways:
When the party member changes out, check if it's one of the pairs. If so, set a variable equal to their MP.
Then, when the other actor swaps in, set their MP equal to the variable.

Since it's two specific party members, you don't need a lot of settings. Ideally I would hard code it to those two actors, specifically.

There may be existing plugins that will do this with settings, but I'm not sure, and as I said, you don't need other party system functions just for that one thing.
you can try the plugin provided here and you can adjustments to make it work with another pair

Edit: forgot that one was MP and HP. one sec...

Edit: load this last in your plugin list. if you need to change the linked actors, change both sets of the actor1 and actor 2 variables to the ids of the new actors
Spoiler
Code:
(() => {
Object.defineProperties(Game_Actor.prototype, {
    mp: { get: function() {
      var actor2 = 2
      var actor1 = 1
      if (this.actorId() === actor2){
        this.setMp($gameActors.actor(actor1).mp)
        return this._mp;
      }
      return this._mp; }, configurable: true }
  });
  var _Game_Actor_param = Game_Actor.prototype.param;
  Game_Actor.prototype.param = function(paramId){
    var actor1 = 2
    var actor2 = 1
    if (this.actorId() === actor1 && paramId === 1)
      return $gameActors.actor(actor2).param(paramId);
    return _Game_Actor_param.call(this, paramId)
  } 
})();
Alright, it's clear I failed to properly explain my intentions, so I've made a mockup:

example.png


The point is that the player can freely switch the party members in positions 3 and 4 and the code will change the MP values accordingly.

you can try the plugin provided here and you can adjustments to make it work with another pair

I tried to edit it so it changed MP based on party position, but my ineptitude reared its ugly head.

error.png
I tried to edit it so it changed MP based on party position, but my ineptitude reared its ugly head.
can you share what you did?
can you share what you did?

(() => {
Object.defineProperties(Game_Actor.prototype, {
mp: { get: function() {
var actor2 = 2
var actor1 = 1
if ($gameParty.battleMembers()[2] === actor2){
this.setMp($gameParty.battleMembers()[0].mp)
return this._mp;
}
return this._mp; }, configurable: true }
});
var _Game_Actor_param = Game_Actor.prototype.param;
Game_Actor.prototype.param = function(paramId){
var actor1 = 2
var actor2 = 1
if ($gameParty.battleMembers()[0] === actor1 && paramId === 1)
return $gameParty.battleMembers()[2].param(paramId);
return _Game_Actor_param.call(this, paramId)
}
})();
youre comparing entire battlers to a number. Thats a check that should always fail. in the version i gave, i compared the actor1/2 numbers to the battlers' ids, not the battlers themselves. in your case youll want to either check if their index within the battleMembers array matches the actor1/2 number, or change actor1/2 to be references to the member in that position and see if thismatches that.

Although, the checks turning up false shouldnt have caused a crash unless one of your other plugins get in the way somehow. Did the unedited version function?
youll want to either check if their index within the battleMembers array matches the actor1/2 number, or change actor1/2 to be references to the member in that position and see if thismatches that.

So, uh... can you give me some pointers on how I to figure that out? I'm basically programing illiterate.

>Did the unedited version function?

Sorta. Actor 1 affected the MP of actor 2 but not the other way around.
I'm trying to make a plugin that will cause any changes to the MP of one actor to also affect the MP of a different actor.
I received help and was given the following code:

(() => {
Object.defineProperties(Game_Actor.prototype, {
mp: { get: function() {
var actor2 = 2
var actor1 = 1
if (this.actorId() === actor2){
this.setMp($gameActors.actor(actor1).mp)
return this._mp;
}
return this._mp; }, configurable: true }
});
var _Game_Actor_param = Game_Actor.prototype.param;
Game_Actor.prototype.param = function(paramId){
var actor1 = 2
var actor2 = 1
if (this.actorId() === actor1 && paramId === 1)
return $gameActors.actor(actor2).param(paramId);
return _Game_Actor_param.call(this, paramId)
}
})();

While the code above worked, I'm trying to alter it so that it targets actors based on their position in the party, as opposed to their ID.
The goal is to achieve something like this:

example.png


I'm very new to programing so any help is appreciated.
instead of $gameActors.actor(id), if you want to share it,
use $gameParty.members()[0] (or $gameParty.leader()

for 2nd member use $gameParty.members()[1] and change 1 to 2
for the 3rd member, so the actor ID doesn't matter by than, just the position.

@Yuschmuhck I've merged your threads together, please don't make multiple threads for a continued problem.

instead of $gameActors.actor(id), if you want to share it,
use $gameParty.members()[0] (or $gameParty.leader()
I tried that before but it doesn't work.

image_2025-06-29_203734197.png


There's more that needs to be done (as mentioned in Robro's post) but I don't know how to do it.
I kinda missed that post, so yea, gameParty doesn't really params
as those are actors bind, gameParty is mostly battle related.

so you have to loop to see which actor is in spot of gameParty.members()[1]
which in 2, and which in 3, so they can link accordingly to the actors
and grab the params.

this might go to a different way instead of the property I guess,
more like, where the MP is being drawed for actors, and link the MP
from there which might be inside the characterBase or Game_Actor.
but it might be inside the Game_Battler too, which I don't know exactly.

I think you can safetly call the gameParty.members() there correctly.

Original thread: https://forums.rpgmakerweb.com/threads/shared-mp-between-2-actors.178518/