MV Battle sprites face a specific way!

Yo! im looking for a plugin that makes the battle sprites always face the middle. No matter who is where in the party there battle sprite would always flip towards the middle.
I dont think theres much more to say its prettty straight forward i think but if theres a plugin i can do this with or a plugin that does exactly this then please tell me cause i really need this 😔
Heres an example:
1681791742127.png
bump
How are you positioning the battlers? With the included ActorPositions plugin, or something else?

This has options for different formations and appears to do the facing automatically.
How are you positioning the battlers? With the included ActorPositions plugin, or something else?

This has options for different formations and appears to do the facing automatically.
This is greate the only problem is that so far that ive looked i cant reporition the battlers to for example be at the bottom of the screen while in for example pincer mode, ill trie ask there but if you have alternatives that would be greate

And im using Fogomax sv battler position extended to reposition my battlers but MPP seems to override that
Bump!
Bump.
Speaking for myself, I haven't had anything else to say because your last post said you were using a specific plugin to determine the actor position; but it didn't include a link to the plugin, and Googling the name you typed doesn't come up with a place to obtain said plugin.

We can't modify code that we can't see.
Speaking for myself, I haven't had anything else to say because your last post said you were using a specific plugin to determine the actor position; but it didn't include a link to the plugin, and Googling the name you typed doesn't come up with a place to obtain said plugin.

We can't modify code that we can't see.
Ahah my apolegies
THIS is the plugin i use
Continuing this from another thread:
Spoiler: plugin code
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc Mirror actor battlers who are in the right-hand half of the screen.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/106255/
 * @help Free to use and/or modify for any project, no credit required.
 */
void (function(alias) {
    Sprite_Actor.prototype.updateMain = function() {
        alias.apply(this, arguments);
        if (this._homeX > Graphics.boxWidth / 2 && this.scale.x > 0)
            this.scale.x *= -1;
    };
})(Sprite_Actor.prototype.updateMain);
However, there are probably better ways to do it and I don't know how that would behave with stuff like YEP Action Sequences. 😴
This works perfectly! the only and literally only problem im having is the fact that there facing the wrong ways when positions have bin changed? soooo actor 1 when on the left side faces to the left while there supposed to flip away from there
Ah, so it flips if they go to the right, but doesn't "unflip" if they go back to the left? This might work better (untested):
Spoiler: plugin code v2
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc v2 - mirror actor battlers when they are in the right-hand half of the screen.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/156765/
 * @help Free to use and/or modify for any project, no credit required.
 */
void (function(alias) {
'use strict';
  Sprite_Actor.prototype.updateMain = function() {
    alias.apply(this, arguments);
    const isOnRight = this._homeX > Graphics.boxWidth / 2;
    if (isOnRight === !this._flippedX) {
      this.scale.x *= -1;
      this._flippedX = !this._flippedX;
    }
  };
})(Sprite_Actor.prototype.updateMain);
Otherwise it may help if you show screenshot(s) of your Plugin Manager so we can see all plugins you're using. (I know you linked the actor position one, but you may be using other relevant plugins.)
JavaScript:
Code:
/*:
 * @target MV MZ
 * @plugindesc v2 - mirror actor battlers when they are in the right-hand half of the screen.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/156765/
 * @help Free to use and/or modify for any project, no credit required.
 */
void (function(alias) {
'use strict';
  Sprite_Actor.prototype.updateMain = function() {
    alias.apply(this, arguments);
    const isOnRight = this._homeX > Graphics.boxWidth / 2;
    if (isOnRight === !this._flippedX) {
      this.scale.x *= -1;
      this._flippedX = !this._flippedX;
    }
  };
})(Sprite_Actor.prototype.updateMain);
Okay so i tried it out but this time it changed nothing at all but this time it completely overrides the Fogomax plugin! the actors are facing the right way at the moment but i cannot check to see if it would stay that way if there X positions would be different (see image)
1682952970772.png

As for the plugins im using in this test project would be: Sprite_Actor is the plugin you just gave me
1682953077194.png

Now if id have to give a more detailed description it would be that the all actors are facing the right way i just need to be able to change there x and y positions or that actor 1 and 2 switch places with actor 3 and 4 but still facing the right way! so actor 1 and 2 on the "Left side" facing the right end of the screen and actor 3 and 4 on the right side of the screen facing the left side
Whoops, my mistake. They should actually be flipped when they're on the left. My suggestion does completely the opposite. Third time lucky? 😅
Spoiler: plugin code v3
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc v3 - mirror actor battlers when they are in the left-hand half of the screen.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/156765/
 * @help Free to use and/or modify for any project, no credit required.
 */
void (function(alias) {
'use strict';
  Sprite_Actor.prototype.updateMain = function() {
    alias.apply(this, arguments);
    const isOnLeft = this._homeX < Graphics.boxWidth / 2;
    if (isOnLeft === !this._flippedX) {
      this.scale.x *= -1;
      this._flippedX = !this._flippedX;
    }
  };
})(Sprite_Actor.prototype.updateMain);

About the positions: Cae_BattleStepY has actor home X/Y formulae in its parameters: that's overriding the positions. The default value for the X parameter is reverse order by mistake and I haven't got around to fixing that. Here are a couple of alternatives I outlined for someone else:
  • For fixed positions I'd suggest something like this:
    Code:
    [408, 100, 600, 100, 600][index]
    This will return 408 for the party leader (index 0), 100 for the next actor (index 1), 600 for the next (index 2), etc.

  • Default x-position formula in reverse order (swap index for $gameParty.battleMembers().length - 1 - index and simplify):
    Code:
    Graphics.boxWidth / 2 + 96 * (index + 0.5 - $gameParty.battleMembers().length / 2)
    ...I don't know why I originally had them ordered right-to-left. 😅
If you prefer the Fogomax plugin's setup, try loading it after BattleStepY. You can click+drag to rearrange the load order, just remember to save your project to apply changes before testing. 👋
Whoops, my mistake. They should actually be flipped when they're on the left. My suggestion does completely the opposite. Third time lucky? 😅
Yes! this one works perfectly! and knowing about the loading order i managed to fix the fogomax plugin aswel! thank you youve bin a huge help! i appreciate it
Yes! this one works perfectly! and knowing about the loading order i managed to fix the fogomax plugin aswel! thank you youve bin a huge help! i appreciate it
AAAAAAAAAAAAACtoully, after putting it in my other game the official one i noticed that the battelers flip back after the first "turn" im checking to see wich plugin seems to cause that problem since i dont have that in the other testing game
So it apears to be Yanfly's battle engine core
Ah, yeah, I'd guess it's related to the action sequence stuff. I had a quick look at the code of YEP Battle Engine Core and I'd guess it's related to the spriteFaceForward/spriteFaceBackward methods. This might work?
Spoiler: plugin code v4 - YEP BEC compatibility
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc v4 - mirror actor battlers when they are in the left-hand half of the screen.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/156765/
 * @orderAfter YEP_BattleEngineCore
 * @help If using YEP_BattleEngineCore, load this plugin after Yanfly's.
 * 
 * Free to use and/or modify for any project, no credit required.
 */
void (function() {
'use strict';

  /**
   * @param {Sprite_Actor} sprite reference actor sprite.
   * @returns {boolean} `true` iff this plugin should flip `sprite`.
   */
  const shouldActorBeFlipped = function(sprite) {
    const faceFront = !sprite._faceBack;
    const isOnLeft  = sprite._homeX < Graphics.boxWidth / 2;
    return faceFront === isOnLeft;
  };

  // Flip sprites when appropriate.
  void (function() {
    const alias = Sprite_Actor.prototype.updateMain;
    Sprite_Actor.prototype.updateMain = function() {
      alias.apply(this, arguments);
      if (shouldActorBeFlipped(this) === !this._flippedX) {
        this.scale.x *= -1;
        this._flippedX = !this._flippedX;
      }
    };
  })();

  // YEP Battle Engine Core compatibility.
  void (function() { if (!Imported.YEP_BattleEngineCore) return;
    const alias_f = Game_Battler.prototype.spriteFaceForward;
    Game_Battler.prototype.spriteFaceForward = function() {
      alias_f.apply(this, arguments);
      delete this.battler()._faceBack;
    };
    const alias_b = Game_Battler.prototype.spriteFaceBackward;
    Game_Battler.prototype.spriteFaceBackward = function() {
      alias_b.apply(this, arguments);
      this.battler()._faceBack = true;
    };
  })();

})();
Ah, yeah, I'd guess it's related to the action sequence stuff. I had a quick look at the code of YEP Battle Engine Core and I'd guess it's related to the spriteFaceForward/spriteFaceBackward methods. This might work?
Spoiler: plugin code v4 - YEP BEC compatibility
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc v4 - mirror actor battlers when they are in the left-hand half of the screen.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/156765/
 * @orderAfter YEP_BattleEngineCore
 * @help If using YEP_BattleEngineCore, load this plugin after Yanfly's.
 *
 * Free to use and/or modify for any project, no credit required.
 */
void (function() {
'use strict';

  /**
   * @param {Sprite_Actor} sprite reference actor sprite.
   * @returns {boolean} `true` iff this plugin should flip `sprite`.
   */
  const shouldActorBeFlipped = function(sprite) {
    const faceFront = !sprite._faceBack;
    const isOnLeft  = sprite._homeX < Graphics.boxWidth / 2;
    return faceFront === isOnLeft;
  };

  // Flip sprites when appropriate.
  void (function() {
    const alias = Sprite_Actor.prototype.updateMain;
    Sprite_Actor.prototype.updateMain = function() {
      alias.apply(this, arguments);
      if (shouldActorBeFlipped(this) === !this._flippedX) {
        this.scale.x *= -1;
        this._flippedX = !this._flippedX;
      }
    };
  })();

  // YEP Battle Engine Core compatibility.
  void (function() { if (!Imported.YEP_BattleEngineCore) return;
    const alias_f = Game_Battler.prototype.spriteFaceForward;
    Game_Battler.prototype.spriteFaceForward = function() {
      alias_f.apply(this, arguments);
      delete this.battler()._faceBack;
    };
    const alias_b = Game_Battler.prototype.spriteFaceBackward;
    Game_Battler.prototype.spriteFaceBackward = function() {
      alias_b.apply(this, arguments);
      this.battler()._faceBack = true;
    };
  })();

})();
this dosnt seem to work at all, like its not changing anything?
this dosnt seem to know anything as far as im seeing

this dosnt seem to work at all, like its not changing anything?
Also just took the time to turn on and off every single plugin i had and your plugin only dosnt work if i turn on Yep Battle engine core so im certain that thats the main problem here
Also just took the time to turn on and off every single plugin i had and your plugin only dosnt work if i turn on Yep Battle engine core so im certain that thats the main problem here
She wrote that code specifically to accommodate the Battle Engine Core. It's possible there's a mistake, but are you sure you have her snippet correctly positioned beneath Yanfly's in your plugin manager?
Sorry, my mistake. Yanfly's plugin makes them face forward/backward based on their current X scale, so it basically counters my suggestion. 😴

I actually set up a test project this time, and this seems to work for me based on a quick test:
Spoiler: v5 plugin code - YEP BEC only
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc v5 - mirror actor battlers when they are in the left-hand half of the screen.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/156765/
 * @orderAfter YEP_BattleEngineCore
 * @help Should be loaded after YEP_BattleEngineCore.
 * 
 * Free to use and/or modify for any project, no credit required.
 */
void (function() {
'use strict';

  // Require YEP Battle Engine Core.
  if (!Imported.YEP_BattleEngineCore)
    throw new Error(
      "This plugin should be loaded after YEP_BattleEngineCore.\nPress F12 for details."
    );

  // Anti-mirror when on left.
  void (function() {
    const alias = Game_Battler.prototype.setMirror;
    Game_Actor.prototype.setMirror = function(value) {
      alias.call(this, value !== this.battler()._homeX < Graphics.boxWidth / 2);
    };
  })();

  // Face "forward" on battle start.
  void (function() {
    const alias = Game_Battler.prototype.onBattleStart;
    Game_Actor.prototype.onBattleStart = function() {
      this.spriteFaceForward();
      alias.apply(this, arguments);
    };
  })();

})();
Sorry, my mistake. Yanfly's plugin makes them face forward/backward based on their current X scale, so it basically counters my suggestion. 😴

I actually set up a test project this time, and this seems to work for me based on a quick test:
Spoiler: v5 plugin code - YEP BEC only
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc v5 - mirror actor battlers when they are in the left-hand half of the screen.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/156765/
 * @orderAfter YEP_BattleEngineCore
 * @help Should be loaded after YEP_BattleEngineCore.
 *
 * Free to use and/or modify for any project, no credit required.
 */
void (function() {
'use strict';

  // Require YEP Battle Engine Core.
  if (!Imported.YEP_BattleEngineCore)
    throw new Error(
      "This plugin should be loaded after YEP_BattleEngineCore.\nPress F12 for details."
    );

  // Anti-mirror when on left.
  void (function() {
    const alias = Game_Battler.prototype.setMirror;
    Game_Actor.prototype.setMirror = function(value) {
      alias.call(this, value !== this.battler()._homeX < Graphics.boxWidth / 2);
    };
  })();

  // Face "forward" on battle start.
  void (function() {
    const alias = Game_Battler.prototype.onBattleStart;
    Game_Actor.prototype.onBattleStart = function() {
      this.spriteFaceForward();
      alias.apply(this, arguments);
    };
  })();

})();
YES! this seems to do the job! thank you very much for your help this is greate! 😀🤘
Woo! Got there in the end~ 😮‍💨

Original thread: https://forums.rpgmakerweb.com/threads/battle-sprites-face-a-specific-way.156765/