Replace actor faceset in event messages based on switches and variables

nanakra

Villager
Member
Joined
Feb 5, 2015
Messages
8
Reaction score
2
First Language
English
Primarily Uses
RMVXA
Hi Everyone,

I have kind of a complex script request here, or at least it's complex to me.

I'm an RGSS3 / Ruby novice. I know enough to understand what I'm looking at and can cobble things together for the most part (still learning), but what I'm looking for is a bit beyond me at my experience level.

With this script, I'm looking for the ability to swap an actors faceset, for event text messages, based upon a switch or variable. The main character, Actor1 "Claire", is able to purchase and change her outfit and hair, and I have custom made facesets for this. Current permutations are three outfits with hair up or down options, but the system should be extensible enough that this isn't a hard limit.

What I'm trying to solve for is the need for hundreds of conditional checks or event pages in order to show the correct face. I'd like the script to do all the conditional checks for me and automatically swap the faceset to the correct one so that I can just write the event once and avoid all the duplication and complexity.

The facesets I'm using have 31 different emotions and are arranged the same for every permutation. So that face index 1 is the same across all the facesets. The script should maintain the face index, but not care about the length of the faceset. It should also allow for as many facesets as well as switches or variables to check against as needed.

To summarize in an example:

The face template would be "1-Claire-Intro.png" then various permutations would be "1-Claire-RedDress-NR.png" for red dress and hair down, and "1-Claire-RedDress.png" for red dress and hair up.

I would use "1-Claire-Intro.png" in the events for all Actor1 message boxes. (This is so I don't have to do any conditional checks in the event itself.)

If Actor1 is in Outfit1 (Variable1=1) and Ribbon (switch1=On), replace template face with the graphic for "1-Claire-RedDress.png", but if (Switch1=Off) replace with "1-Claire-RedDress-NR.png" instead.

Or, with all switches, If Actor1 is in Outfit1 (Switch1=On) and Ribbon (switch2=On), replace template face with the graphic for "1-Claire-RedDress.png", but if (Switch2=Off) replace with "1-Claire-RedDress-NR.png" instead.

In both examples, if Actor 1 has her hair down and is wearing a red dress, messages should show her face with the red dress and hair down instead of her base faces.

I'm currently using the following message control scripts, so this script would have to be compatible with them: Yanfly Engine Ace - Ace Core Engine v1.09, Yanfly Engine Ace - Ace Message System v1.05, Modern Algebra ATS: Formatting 1.1.5, Hime's Message Skip, Galv's Messages Without Wait 1.1, Hime's Message Face Control, Hime's Large Choices, Hime's Choice Options, and Yanfly Engine Ace - Gab Window v1.00

I can provide a sample project with these scripts and the requisite graphics for testing if needed.

Let me know if any of this does or does not make sense or if you have any questions.

Thanks!
 

ZirconStorms

Veteran
Veteran
Joined
Dec 22, 2014
Messages
359
Reaction score
111
First Language
English
Primarily Uses
RMVXA
You'd have to go and edit def new_page, add this after contents.clear and before draw_face($game_message.face_name, $game_message.face_index, 0, 0)

Code:
if $game_message.face_name == "1-Claire-Intro"
      case $game_variables[1]
       when 1
        $game_message.face_name = $game_switches[1] ? "1-Claire-RedDress" : "1-Claire-RedDress-NR"
       when 2
         $game_message.face_name = $game_switches[2] ? "file if switch is on" : "file if switch is off"
       else
       end
end
Basically what this does is check if the message face you used in the event command corresponds to the first file name in brackets. Do not type file extensions!

I used your variable + switch method. It updates once a new message box pops up, idk if it'll update if you have any sort of face change in between messages. Also, if you want to do this for multiple characters, you can just copy the method, and do different "if $game_message.face_name" checks for different files.

too lazy to check if it's compatible with the scripts you listed lol. Link to the stuff you want it to be compatible with next time.

Credit ZS / ZirconStorms if you use this.
 

nanakra

Villager
Member
Joined
Feb 5, 2015
Messages
8
Reaction score
2
First Language
English
Primarily Uses
RMVXA
Just tested that out and works perfectly with no conflicts with the scripts I'm using.
I thought it would be much more complex than that, but I haven't gotten to case statements in the tutorial I've been following on youtube.
I would like to pull it out as it's own separate script as an aliased method, but I think that's something I can cobble together on my own.
Thanks again!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,018
Messages
1,018,358
Members
137,803
Latest member
andrewcole
Top