Status
Not open for further replies.

Puppet Knight

Knight on a Crossbar
Regular
Joined
Aug 3, 2022
Messages
644
Reaction score
770
First Language
English
Primarily Uses
RMMZ
Good evening all,

As always I've got a fun, random, and hyper specific ask!

Does anyone know if there is a way to change the orientation (effectively flipping) the portrait images based on the Actors position in the party. I am using Main Menu Core VisuStella's Portait Mode

For example:

Actor 3 (Left): Is in the first Party position (leader)
Actor 1 (Right): in the second party position

1685323748998.png

What I want is for Actor 1's (and any actor that ends up in the second party position) image to flip horizontally.


SOLVED:

Thanks to @Arthran + some added plugin commands for user friendliness



Bonus points if we can change the positioning of the name for party member 2 as well haha.
 

Attachments

  • Art_PortraitFlip.js
    5.3 KB · Views: 0
Last edited:

HuLijin

Villager
Member
Joined
Oct 26, 2015
Messages
17
Reaction score
8
First Language
French
Primarily Uses
RMMZ
I did something dirty for my own game.
I wanted to change the portrait orientation of the first actor only. Similar to what you want to achieve but with one character only.

My game has two characters only. In the database i created two dummy actors, with default values and a portrait file in the comment section.

Setup of my database

001 : actor1
002 : actor2
003 : some other stuff
004 : dummy for actor1
005 : dummy for actor2
006+ : some other stuff

Then, i modified the VS eval code with my setup in mind

JavaScript:
// Declare Constants
    const actor = arguments[0];
    const rect = arguments[1];
    const first = (rect.x < rect.width);

    // Make Constants
    const lineHeight = subject.lineHeight();
    const gaugeLineHeight = subject.gaugeLineHeight();
    const totalHeight = (lineHeight * 4.5) + (gaugeLineHeight * ($dataSystem.optDisplayTp ? 3 : 2));

    // Draw Actor Graphic
    const gw = rect.width;
    const gh = rect.height;
    const gx = rect.x;
    const gy = rect.y;
    if (first) {
        const dummyActor = $gameActors.actor(actor.actorId()+3);
        subject.drawItemActorMenuImage(dummyActor, gx, gy, gw, gh);
    } else {
        subject.drawItemActorMenuImage(actor, gx, gy, gw, gh);
    }

I added code at line 4 and lines 16-19 and line 21.

Line 17 is where my setup is used: the dummy actors ID are basically the actors ID + 3.
So, if you have a different setup (for example 001 actor1 ; 002 dummy for actor1 ; 003 actor2 ; 004 dummy for actor2...) you need to change the number.

It works for me. Maybe someone else will give a better answer.

Edit: correct numbering
 
Last edited:

Arthran

Regular
Regular
Joined
Jun 25, 2021
Messages
1,099
Reaction score
1,600
First Language
English
Primarily Uses
RMMZ
If I understood you correctly, the plugin I have attached should accomplish what you're trying to do (in terms of flipping the portrait). Just make sure it is lower than Main Menu Core in your plugin manager.

I wasn't sure if you only want to flip the portrait of the second party member, or if that was just an example (i.e. maybe you actually want to flip every even numbered party member or something). I just went ahead and made it only apply to the 2nd party member, but if you want to set some additional conditions, just find and edit this function in the plugin:
JavaScript:
Game_Actor.prototype.shouldFlipMenuImage = function() {
    return this === $gameParty.members()[1];
};
Make it return true for any actor that should be flipped.

This is just for the flipping of the portrait--it doesn't include moving the name. To move the name, you would have to edit the settings of your Main Menu Core plugin. In particular, you'd probably want to go to List Style Settings -> JS: Portrait, and find this part:
JavaScript:
// Draw Actor Name
this.drawText(actor.name(), sx, sy, sw, 'center');

You have presumably already edited it, so yours might look a little different. I would guess that something like this is maybe sorta what you're going for:
JavaScript:
// Draw Actor Name
if (actor.shouldFlipMenuImage()) {
    this.drawText(actor.name(), sx, sy, sw, 'right');
} else {
    this.drawText(actor.name(), sx, sy, sw, 'left');
}
 

Attachments

  • Art_PortraitFlip.js
    3.2 KB · Views: 2

Puppet Knight

Knight on a Crossbar
Regular
Joined
Aug 3, 2022
Messages
644
Reaction score
770
First Language
English
Primarily Uses
RMMZ
If I understood you correctly, the plugin I have attached should accomplish what you're trying to do (in terms of flipping the portrait). Just make sure it is lower than Main Menu Core in your plugin manager.
This is clean:
1685377386301.png
1685377444521.png

Thanks as always @Arthran

Appreciate the addin @HuLijin ! Went with Arts solution half out of laziness lol.


@Arthran

Would it be possible to also have the box that houses the name and HP and such flip as well?

To Clarify, I don't want them mirrored, just the relative XY position switched

Also (last ask) a version of my party set up is where there are 4 Active members, so the option to decide which party positions get flipped (maybe as a plugin parameter) would be neat as well, but not a major need.

something like

@param Flipped Members
@desc a comma separated string of Party member positions
@string
@Default 2,4

Thanks again. All good if no updates gonna happen. I can try to figure it out tomorrow elsewise.
@Default



Also, anyway of having this also impact Save Core.
 
Last edited:

Arthran

Regular
Regular
Joined
Jun 25, 2021
Messages
1,099
Reaction score
1,600
First Language
English
Primarily Uses
RMMZ
Would it be possible to also have the box that houses the name and HP and such flip as well?

To Clarify, I don't want them mirrored, just the relative XY position switched
It is possible, but it's not something that I can include in the plugin, due to how VisuStella's plugins work. You'll have to manually edit the JavaScript through the plugin parameters of Main Menu Core, as I described in my previous post.

I already gave an example of how to move the name to the other side of the box. The gauges will follow the same basic concept:
JavaScript:
if (actor.shouldFlipMenuImage()) {
    // code for drawing the gauges on flipped members
} else {
    // code for drawing the gauges on non-flipped members
}

If you need help with this part, please show me the code that you currently have in there, and explain exactly where you want the gauges to be.

Also (last ask) a version of my party set up is where there are 4 Active members, so the option to decide which party positions get flipped (maybe as a plugin parameter) would be neat as well, but not a major need.
Try the new version I've attached to this post. Make sure to refresh it in your plugin manager first (right click on the plugin and click "Refresh").

Also, anyway of having this also impact Save Core.
It's probably doable, but that would require me to install, configure, and learn about Save Core before I could start to tackle the problem. I don't have the time/desire to do that right now, but if you remind me about it again in a couple weeks, maybe I'll have time to take a look at it then.

*edit* Forgot to attach the plugin.
 

Attachments

  • Art_PortraitFlip.js
    3.5 KB · Views: 2

Puppet Knight

Knight on a Crossbar
Regular
Joined
Aug 3, 2022
Messages
644
Reaction score
770
First Language
English
Primarily Uses
RMMZ
This looks great Art!

I'll take a crack at adding in the gauge flips on my own.

In the mean time for anyone that may stumble across the need to Flip Party Member Portraits in the Main Menu Core (see what I did there).

I've gone ahead and added in plugin commands to Arts original plugin ^_^

See attached. Will also update the original request with the updated plugin
 

Attachments

  • Art_PortraitFlip.js
    5.3 KB · Views: 0

Ms Littlefish

Time Traveling Victorian Vampire
Global Mod
Joined
Jan 15, 2014
Messages
8,093
Reaction score
11,742
First Language
English
Primarily Uses
RMMV
This thread is being closed due to being solved. If you would like to reopened, report it to let us know. Thank you!
 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

Me: "Who the heck would play a game with no stakes, no enemies, and all you do is raise and breed bees?"
Later after playing it. - "Holy crap, I didn't know it was 1:30. Where'd my time go?"
The site is being slow and funky again. IS SOMEONE CRAFTING POEMS?!
So yeah, @TRIDIUM @TESTOSTERONE, I wuz like, "What do they mean by borderline and boundaries?"

And then, y'all know this girl?

actress1.png

alice_bikini.png

The clothes? They're just a, um, quick edit. :kaoswt:
I've uploaded the opening cutscene from my game to my channel. It basically introduces us to the first three characters, and what their relationships are:
Cosmic Inferno: Opening dialogue
I don't want to start a panic...but everyone, check the color of your milk!
IMG_20231002_082329.jpg

Forum statistics

Threads
135,021
Messages
1,253,018
Members
177,951
Latest member
DarkKing
Top