More efficient way to go about having to constantly check 64 different switches?

CalebHatesYou

Villager
Member
Joined
Oct 11, 2018
Messages
13
Reaction score
0
First Language
English
Primarily Uses
RMVXA
ok so i'm at the point in my game where I want to allow the player to customize the hairstyles and clothing of each party members. Each party member will have 8 different hairstyles and 8 different outfits, meaning I will be making 64 portraits for each party member (8 hairstyles X 8 outfits = 64 combinations). This now means that during cutscenes when adding dialogue and character portraits next to said dialogue, I will have to have a long list of "If switch H1 C1 is on, then ___ Otherwise if Switch H1 C2 is on ___ Otherwise..." and so on. in order to have the correct portrait show up next to the characters dialogue.

Does anyone know if there would be a better and easier way to go about this?
 

Cormorant42

Veteran
Veteran
Joined
Sep 17, 2019
Messages
33
Reaction score
15
First Language
English
Primarily Uses
RMMV
Lol, sorry, I didn't even see! I'm 75% sure there must be some equivalent for VX Ace
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,081
Reaction score
1,038
First Language
Spanish
Primarily Uses
RMVXA
make each switch a bit in a binary number and apply an AND logic.

take the lot of switches: 0010101001101010 = 10858
if you want to check switch 6: 0000000000100000 => 32
if 10858 AND 32 == 1, switch 6 is ON.

for all switches, take X AND 2^64 == 1.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,009
Reaction score
7,019
First Language
German
Primarily Uses
RMMV
there are several scripts that add messaging options to the engine, including to use faces based on actors instead of fixed faces. In this case the ATS series from modern algebra is probably better than the more commonly used yanfly message system, as it contains more options for the use of faces.
 

CalebHatesYou

Villager
Member
Joined
Oct 11, 2018
Messages
13
Reaction score
0
First Language
English
Primarily Uses
RMVXA
make each switch a bit in a binary number and apply an AND logic.

take the lot of switches: 0010101001101010 = 10858
if you want to check switch 6: 0000000000100000 => 32
if 10858 AND 32 == 1, switch 6 is ON.

for all switches, take X AND 2^64 == 1.
I appreciate the information but I honestly have no idea what any of this even means. I am not well versed in rpg maker scripting.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,081
Reaction score
1,038
First Language
Spanish
Primarily Uses
RMVXA
I appreciate the information but I honestly have no idea what any of this even means. I am not well versed in rpg maker scripting.
it'll probably require a plugin, but that's how to handle a lot of binary values at once: each switch is binary, it can only be on or off.
if you take the whole set of 64 switches as a binary number, each bit has a numeric value when converted to decimal.
and, by comparing decimal and reverting back to binary you can isolate one or many bits, which in turn give you the switches.
 

CraneSoft

Filthy Degenerate
Veteran
Joined
Apr 16, 2016
Messages
142
Reaction score
151
First Language
English
Primarily Uses
RMVXA
Have one common event for each party member that does the conditional check, then just call the equivalent common event every time before a dialogue is the easiest way. Also for this situation it would be better to just use variables instead of switches so you only need 16 variables instead of 64.
 

CalebHatesYou

Villager
Member
Joined
Oct 11, 2018
Messages
13
Reaction score
0
First Language
English
Primarily Uses
RMVXA
there are several scripts that add messaging options to the engine, including to use faces based on actors instead of fixed faces. In this case the ATS series from modern algebra is probably better than the more commonly used yanfly message system, as it contains more options for the use of faces.
Just got the face script now and it seems like it will be very helpful to my situation. I just have a question that maybe you can help me with.

Is there a way to pick the index number on an actor's current faceset in this command
"\af[n] - set face to the face of the actor with ID n in the database."

Like you can in this command?
"\f{"filename":n} - set face to the one in "filename" at index n."

If there is a way to do this then my problems will be solved
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,009
Reaction score
7,019
First Language
German
Primarily Uses
RMMV
sorry - I never used ATS myself, I just once made a point to check every script on the master script list to learn what it can do.

However, are you telling me that you not only have composite faces but also different expressions that you need to switch of an index that way? Bevcause if you have only one face per actor after all the switches, you won't need the face index at all.
If you have different expressions and need to select them, then I would suggest using string operations to handle filenames in the second option.

If neither fits, you need to post examples of what exactly you do with your faces.
 

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

Latest Threads

Latest Profile Posts

Stream will be live shortly with some pixel art! Feel free to drop by!

Can't believe I forgot to put an image of my drawing pad! It looks kinda like this, maybe I'll get a better pic tomorrow...
Backup tip: If you don't want to back up your whole project every day, at least back up everything *except* your Image and Audio folders, which you can do weekly/as needed/etc.
The final version of our game is already available both in English and Spanish! ^___^
Can't believe this day has finally come... T_T
Im so happy that Dead By Daylight is getting a Silent Hill chapter! Cant wait to play as pyramid head

Forum statistics

Threads
97,813
Messages
947,144
Members
129,033
Latest member
jace00
Top