Charas-Project

Game Creation => RPG Maker => Topic started by: evmaster on January 07, 2014, 08:51:03 PM

Title: Changing ther Hero sprite graphic to another and back
Post by: evmaster on January 07, 2014, 08:51:03 PM
Okay, I have a situation. In one of my game files, I have a female hero and male hero. And they both have 4 outfits. In parts of the game, their sprite graphic is changed. And I change them back but they are not in their original outfit anymore.

I was thinking of using Variables and some Condition Branches to have them in the outfit back as the player chose them in the beginning. Is this the only method of doing that?

Also, a side question: Is it normal to use just switches, branches and variables? Or do I need to branch out more and learn a few more things about Rpg maker?
Title: Re: Changing ther Hero sprite graphic to another and back
Post by: Prpl_Mage on January 07, 2014, 11:47:28 PM
RPGm is pretty much just variables and branches, so yeah, you can get by beautifully with those.  Switches are just variables limited to 2 different values. On or Off.

Okay, so you want them to change outfit? And make sure that the game recognizes this as you play the game so that the hero sprite might change into something different and you want the game to remember what outfit you had on last?

First off all, create a common event that sets the hero sprite association. For example. Let's say that if you equip the chainmail bikini the appearance of the character changes. Make the common event a parallel process. Set the condition "HeroX have Chainmail Bikini equipped", next, have the sprite association to the right charset. Next, create an ELSE command that changes the hero back to the default outfit is the chainmail bikini is NOT equipped.

Secondly, there are 2 ways to do this one. I'll start with the tricky one.
Let's say you have 4 different outfits, and let's say they are recognized by certain equipment or the value of a variable. So in each event where the hero graphic is supposed to change back. Insert a conditional branch for each possible outfit and then some sprite associations. And in the else (as in, none of the above conditions are correct) you set the default sprite.
The better way is that you set a conditional branch first in the common event you created. And each time the hero is supposed to change into something ... situational, you turn a switch on or something. And this is what you check for in your common event. so When the switch is On, (let's call it cutscene) the common event does nothing. When your scene is over, turn oFF the switch and the hero will once again change back to the desired outfit.

Anyway, if the outfits are not equipment based simply have a variable called "heroXoutfit" and let 0, be the value checked for the normal outfit, then 1 for the first, 2 for the second etc. The trouble, however. Is when you want the battle sprites to correspond. You need to create a class for each outfit version of the character. And change the hero into this class to alter his battle appearance. Just make sure to make them into duplicates of each other and don't change stats or anything upon changing.
Title: Re: Changing ther Hero sprite graphic to another and back
Post by: evmaster on January 08, 2014, 03:59:54 PM
O_O Wasn't expecting such a long answer Prpl_Mage. Thanks a bunch!
I was thinking of using some branches and variables. The outfits are indeed, not items. And I was planning for outfits to be variables. And I'm
not concerned with the battle sprites. .....Would you recommend it to be item based, or variable based?

Edit: After rereading you post, I think I am confused.

"Anyway, if the outfits are not equipment based simply have a variable called "heroXoutfit" and let 0, be the value checked for the normal outfit, then 1 for the first, 2 for the second etc."

Are you saying make a variable, have it set 1,2,3 and 4? I don't understand what the 0 is for? I have a closet the player can click on. I then have branches to check for if the player is Male or Female. Then the player is give 4 different outfits to choose from. 3 change to another outfit, 1 is the original you start off with. I have worked with variables before, but not in this way.

Are you saying under those 4 choices, have 4 different variables with Set numbers 1,2,3 and 4?

Example: Choice 1: Casual Outfit: Single Variable Female Outfit1: Set equal 1:
Choice 2: Princess Dress: Single Variable Female Outfit2: Set equal 2:

Or do I need to have one variable and change what number it is set on? What about the player switching between the outfits?

Sorry, I don't know if I am explaining this too well. ._.

Edit2: I think the way to go about this, is to have 1 variable for Female and Male Outfit. And when changing outfits, to change the Set number according to which outfit they chose. Then later on in the game, while branching to check, branch if outfit variable is equal to 1, if else handler, then 2 and so on till number 4.

Correct me if I am wrong.
Title: Re: Changing ther Hero sprite graphic to another and back
Post by: Prpl_Mage on January 08, 2014, 05:56:27 PM
Greetings confusion!

Okay, Either way works. I would recommend variables because the only thing you need to check is the value of it.

Okay, so 0 would be "no special outfit equipped". But it could just as well be 1, or 18 or 239. It doesn't matter as long as you remember what it is.

So you have your closet. It is activated with the action key. You display your message to something like "What fancy pancy outfit should I totally wear today?" Next up you have the choice option.
If you pick choice 1 "casual outfit" you set your variable (HeroXoutfit) equal to the value you want. Let's say 1. Second choice is the "princess dress" and you set the same variable to 2. etc. You will only need 1 variable and check if the value is the one you want.
So Display message, Show options > variable operation set VAR equal to #. Where VAR is your outfit variable and # corresponds to the number of the outfit.
Once you change the variable with this event, your parallel process common event will notice that the variable is no longer 1 and change the hero sprite association.

So yes, your last edit is correct. And having one variable for each character is a good thing, otherwise your dude might end up looking like a pretty pink princess.