Sweetmayham

VLTRA MAYHEM, You havnt seen anything yet...
Regular
Joined
Feb 13, 2022
Messages
82
Reaction score
28
First Language
Dutch
Primarily Uses
RMMV
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 :kaosigh:
Heres an example:
1681791742127.png
 

Sweetmayham

VLTRA MAYHEM, You havnt seen anything yet...
Regular
Joined
Feb 13, 2022
Messages
82
Reaction score
28
First Language
Dutch
Primarily Uses
RMMV

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,037
Reaction score
8,966
First Language
English
Primarily Uses
RMMV
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.
 

Sweetmayham

VLTRA MAYHEM, You havnt seen anything yet...
Regular
Joined
Feb 13, 2022
Messages
82
Reaction score
28
First Language
Dutch
Primarily Uses
RMMV
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
 

Sweetmayham

VLTRA MAYHEM, You havnt seen anything yet...
Regular
Joined
Feb 13, 2022
Messages
82
Reaction score
28
First Language
Dutch
Primarily Uses
RMMV

Sweetmayham

VLTRA MAYHEM, You havnt seen anything yet...
Regular
Joined
Feb 13, 2022
Messages
82
Reaction score
28
First Language
Dutch
Primarily Uses
RMMV

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,037
Reaction score
8,966
First Language
English
Primarily Uses
RMMV
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.
 

Sweetmayham

VLTRA MAYHEM, You havnt seen anything yet...
Regular
Joined
Feb 13, 2022
Messages
82
Reaction score
28
First Language
Dutch
Primarily Uses
RMMV
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
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,021
Reaction score
4,351
First Language
EN
Primarily Uses
RMMZ
Continuing this from another thread:
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. :kaoslp:
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):
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.)
 

Sweetmayham

VLTRA MAYHEM, You havnt seen anything yet...
Regular
Joined
Feb 13, 2022
Messages
82
Reaction score
28
First Language
Dutch
Primarily Uses
RMMV
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
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,021
Reaction score
4,351
First Language
EN
Primarily Uses
RMMZ
Whoops, my mistake. They should actually be flipped when they're on the left. My suggestion does completely the opposite. Third time lucky? :kaoswt:
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. :kaoswt2:
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. :kaohi:
 

Sweetmayham

VLTRA MAYHEM, You havnt seen anything yet...
Regular
Joined
Feb 13, 2022
Messages
82
Reaction score
28
First Language
Dutch
Primarily Uses
RMMV
Whoops, my mistake. They should actually be flipped when they're on the left. My suggestion does completely the opposite. Third time lucky? :kaoswt:
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
 

Sweetmayham

VLTRA MAYHEM, You havnt seen anything yet...
Regular
Joined
Feb 13, 2022
Messages
82
Reaction score
28
First Language
Dutch
Primarily Uses
RMMV
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
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,021
Reaction score
4,351
First Language
EN
Primarily Uses
RMMZ
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?
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;
    };
  })();

})();
 

Sweetmayham

VLTRA MAYHEM, You havnt seen anything yet...
Regular
Joined
Feb 13, 2022
Messages
82
Reaction score
28
First Language
Dutch
Primarily Uses
RMMV
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?
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?
 
Last edited:

Sweetmayham

VLTRA MAYHEM, You havnt seen anything yet...
Regular
Joined
Feb 13, 2022
Messages
82
Reaction score
28
First Language
Dutch
Primarily Uses
RMMV
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
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,037
Reaction score
8,966
First Language
English
Primarily Uses
RMMV
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?
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,021
Reaction score
4,351
First Language
EN
Primarily Uses
RMMZ
Sorry, my mistake. Yanfly's plugin makes them face forward/backward based on their current X scale, so it basically counters my suggestion. :kaoslp:

I actually set up a test project this time, and this seems to work for me based on a quick test:
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);
    };
  })();

})();
 

Sweetmayham

VLTRA MAYHEM, You havnt seen anything yet...
Regular
Joined
Feb 13, 2022
Messages
82
Reaction score
28
First Language
Dutch
Primarily Uses
RMMV
Sorry, my mistake. Yanfly's plugin makes them face forward/backward based on their current X scale, so it basically counters my suggestion. :kaoslp:

I actually set up a test project this time, and this seems to work for me based on a quick test:
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! :D:rock-right:
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,021
Reaction score
4,351
First Language
EN
Primarily Uses
RMMZ
Woo! Got there in the end~ :kaophew:
 

Latest Threads

Latest Posts

Latest Profile Posts

Im watching Depp vs Heard and keep thinking: "Wouldnt it be fun if her middle name was Lisa? Then she'd be Amber L. Heard. Sounds like Amber Alert."

Then I found out her middle name is Laura.
Yeaah, pallarax mapping

mTQFUv1QrOI.jpg
ScreenShot_9_26_2023_0_27_57.png
working on the house you explore in the beginning of my game. it's the first major area... part exploration, part battles. just need to script events and setup the on screen enemies.
I'm having way too much fun with these character designs

Forum statistics

Threads
134,799
Messages
1,250,775
Members
177,601
Latest member
semenbolt
Top