This is something I whipped up in about 45 minutes earlier this morning that I thought I'd share with you guys, especially those of you who want to learn to put internal variables to use.
A little background: I wanted to be a little free-form in party design options because it fits my game well. I'm making an ersatz Jurassic Park parody called "RPG Maker Park 3D." The story is all the creatures that RPG Maker users put in their games have to come from somewhere, so someone created an island where the creatures evolve from slimes into the various RPG Maker monsters.
You play as a park guide in training. You accept to take clients on guided tours of the park to find the "essences" of the creatures they need for their game. You do this by talking to a clerk who informs you that so-and-so "class" (warrior, mage, etc.) has shown up and wants you to guide them. You then go to where they are and they join your party.
Still with me? Okay, here's the meat of the example. NOTE: I am by no means an expert programmer, and I'm sure there are much more efficient ways of doing this. 50 commands per event mode is limiting, and so any way you can reduce this is great.
HOW TO CREATE A RANDOM PARTY MEMBER SELECTION SYSTEM
FIRST -- since you can't name variables in your game for reference, keep a pencil and paper handy, or a computer with notepad or something open nearby. These are the variables you want to keep track of for reference.
These are INTERNAL variables for your main character. Write this down for your reference.
Internal Variable 1 -- People in Party
0 = no one in party
1 = one person in party
2 = two people in party
3 = three people in party
4 = four people in party (RM3's maximum for a party, by the way)
Internal Variable 2 -- Class Selector
0 = Warrior
1 = Knight
2 = Mage
3 = Thief
Got that? Now onto the game.
First, create your main character and class for him/her.
Then, for this example, make four different classes -- Warrior, Knight, Mage, Thief. You don't have to make their skills and such, just get the names in. Then create characters for them named the same as their class, and make sure they have two modes. In Mode 1, set their display to OFF in the mode editor. In Mode 2, set their display to ON (should be on by default) and create whatever you want to allow them to join you, but somewhere in there when they join, throw in an Increase Internal Variable - Main Character - Internal Variable 1, set it to 1. Then put in a Modify Mode and have it set them back to Mode 1 so they disappear as if they joined you.
Finally, create a character that will be the party clerk. He doesn't need a class. Take note of the use of condition statements within condition statements, also known as "nesting." Here is his event code for Mode 1:
-----
01: Val-Conditional Branch -- Main Character -- Two Options -- Internal Variable 1 -- Option 1: Value = 4 -- Option 2: Value <= 3
02: Option 1 Start
03: Message Display -- Sorry, your party is full.
04: Option 1 End
05: Option 2 Start
06: Q/A Branch -- Hi! You looking for a client to guide?
07: Yes Start
08: Increase Internal Variable -- Main Character -- Internal Variable 2 -- Increase by 1
09: Val-Conditional Branch -- Main Character -- Internal Variable 2 -- Two Options -- Option 1: Value >=4 -- Option 2: Value < 3
10: Option 1 Start
11: Modify Internal Variable -- Main Character -- Internal Variable 2 -- Modify Internal Variable 2 to 0
12: Option 1 End
13: Option 2 Start
14: Option 2 End
15: End Branch
16: Val-Conditional Branch -- Main Character -- Internal Variable 2 -- Four Options -- Option 1: Value = 0 -- Option 2: Value = 1 -- Option 3: Value = 2 -- Option 4: Value = 3
17: Option 1 Start
18: Message Display -- A Warrior is outside looking for a job. Go talk to him.
19: Modify Mode -- Warrior -- Mode 2
20: Option 1 End
21: Option 2 Start
22: Message Display -- A Knight is outside looking for a job. Go talk to him.
23: Modify Mode -- Knight -- Mode 2
24: Option 2 End
25: Option 3 Start
26: Message Display -- A Mage is outside looking for a job. Go talk to him.
27: Modify Mode -- Mage -- Mode 2
28: Option 3 End
29: Option 4 Start
30: Message Display -- A Thief is outside looking for a job. Go talk to him.
31: Modify Mode -- Thief -- Mode 2
32: Option 4 End
33: End Branch
34: Yes End
35: No Start
36: Message Display -- All right. I'll be here if you change your mind.
37: No End
38: End Branch
39: Option 2 End
40: End Branch
-----
Whew! That's a lot of commands. Now, here's what's happening in the code:
Line 1 checks the main character's internal variable 1, party size, to see if he has too many party members. If he's at 4, the event ends and tells him to come back when he has less than 4 people in the party (BTW, the 4-member limit INCLUDES the main character -- just wanted to point that out).
If the main character DOES have less than three members in his party, it goes to the Q/A Branch on line 6. I give the player the option, even if he has the room, to not accept a new member. If you answer no, the event ends.
If the main character DOES have less than three members in his party AND he answers YES to the question, here's what happens:
On Line 8, I increase the main character's internal variable 2, class selector by 1. What the heck does this do? Well, RM3 has no true command to give you a random number, so for the purposes of this tutorial, each time you want to add a new person, this variable increases by 1, so each time you want to add a new person, the event will cycle through the four classes and give you a new person each time.
"BUT WAIT!" those of you paying attention pipe up. "If you talk to him more than four times, that variable will increase to 4! We don't have five different classes!" Right you are, which is why we use lines 9 through 14. Here, if internal variable 2 is equal to 4, it RESETS IT to 0 using a Modify Internal Variable command, thus allowing you to cycle through the classes again. You'll notice there's nothing being checked between lines 13 and 14, and that's fine. If you leave something like that in RM3 blank, it'll just continue on to the next set of commands, which is what we want.
Lines 16 through 34 are the meat of the class selector. Depending on what your main character's internal variable 2 (class selector) is, it matches it up with the corresponding class and, using Modify Mode on each of those characters, will turn on their Mode 2, allowing them to appear outside so you can talk to them.
The rest of the code is just closing the branches you opened earlier in the event.
PUTTING THE EVENT IN THE GAME
Set up a town with at least one building, or ANYTHING that will make you change an area. You don't have to do this, but I did just to show clearly that it happens. Put the Warrior, Knight, Mage, and Thief characters outside the building. Make a new building, this will be where the Party Clerk character does his thing. Inside that room, create the Party Clerk character.
NOW TEST IT!
If you did everything correctly, here's what happens:
When you first walk outside the Party Clerk's building, you shouldn't see the four class characters. That's because they're all on Mode 1 with their display off.
Going inside the building and talking to the clerk, his first response will be to allow you to add someone to the party. That's because you obviously have room. Each time you talk to him, he should start at Knight, then Mage, then Thief, then Warrior (if you keep talking to him, I'm not sure what happens after that -- probably nothing).
Go back outside and huzzah, there are your characters waiting to be talked to and let into your party! Now, if you remember, waaay back in the beginning, I said this about setting up the party members:
In Mode 2, set their display to ON (should be on by default) and create whatever you want to allow them to join you, but somewhere in there when they join, throw in an Increase Internal Variable - Main Character - Internal Variable 1, set it to 1.
Each time you add a person to the party, your main character's interal variable 1 get increased by 1. This is what the party clerk checks immediately when you first talk to him to decide if you can even have more people in your party.
------
Wow, that was a lot of typing. Again, this code is really basic and is an unfinished concept. There's a lot you could add to spiff this up or maybe not make it so cumbersome, I'm sure. This is not what I'll be using in my game, but it'll be based on it. I hope it helps and gives you some ideas as to how to use your variables and condition statements if you're clueless about them.
:falls over dead:
A little background: I wanted to be a little free-form in party design options because it fits my game well. I'm making an ersatz Jurassic Park parody called "RPG Maker Park 3D." The story is all the creatures that RPG Maker users put in their games have to come from somewhere, so someone created an island where the creatures evolve from slimes into the various RPG Maker monsters.
You play as a park guide in training. You accept to take clients on guided tours of the park to find the "essences" of the creatures they need for their game. You do this by talking to a clerk who informs you that so-and-so "class" (warrior, mage, etc.) has shown up and wants you to guide them. You then go to where they are and they join your party.
Still with me? Okay, here's the meat of the example. NOTE: I am by no means an expert programmer, and I'm sure there are much more efficient ways of doing this. 50 commands per event mode is limiting, and so any way you can reduce this is great.
HOW TO CREATE A RANDOM PARTY MEMBER SELECTION SYSTEM
FIRST -- since you can't name variables in your game for reference, keep a pencil and paper handy, or a computer with notepad or something open nearby. These are the variables you want to keep track of for reference.
These are INTERNAL variables for your main character. Write this down for your reference.
Internal Variable 1 -- People in Party
0 = no one in party
1 = one person in party
2 = two people in party
3 = three people in party
4 = four people in party (RM3's maximum for a party, by the way)
Internal Variable 2 -- Class Selector
0 = Warrior
1 = Knight
2 = Mage
3 = Thief
Got that? Now onto the game.
First, create your main character and class for him/her.
Then, for this example, make four different classes -- Warrior, Knight, Mage, Thief. You don't have to make their skills and such, just get the names in. Then create characters for them named the same as their class, and make sure they have two modes. In Mode 1, set their display to OFF in the mode editor. In Mode 2, set their display to ON (should be on by default) and create whatever you want to allow them to join you, but somewhere in there when they join, throw in an Increase Internal Variable - Main Character - Internal Variable 1, set it to 1. Then put in a Modify Mode and have it set them back to Mode 1 so they disappear as if they joined you.
Finally, create a character that will be the party clerk. He doesn't need a class. Take note of the use of condition statements within condition statements, also known as "nesting." Here is his event code for Mode 1:
-----
01: Val-Conditional Branch -- Main Character -- Two Options -- Internal Variable 1 -- Option 1: Value = 4 -- Option 2: Value <= 3
02: Option 1 Start
03: Message Display -- Sorry, your party is full.
04: Option 1 End
05: Option 2 Start
06: Q/A Branch -- Hi! You looking for a client to guide?
07: Yes Start
08: Increase Internal Variable -- Main Character -- Internal Variable 2 -- Increase by 1
09: Val-Conditional Branch -- Main Character -- Internal Variable 2 -- Two Options -- Option 1: Value >=4 -- Option 2: Value < 3
10: Option 1 Start
11: Modify Internal Variable -- Main Character -- Internal Variable 2 -- Modify Internal Variable 2 to 0
12: Option 1 End
13: Option 2 Start
14: Option 2 End
15: End Branch
16: Val-Conditional Branch -- Main Character -- Internal Variable 2 -- Four Options -- Option 1: Value = 0 -- Option 2: Value = 1 -- Option 3: Value = 2 -- Option 4: Value = 3
17: Option 1 Start
18: Message Display -- A Warrior is outside looking for a job. Go talk to him.
19: Modify Mode -- Warrior -- Mode 2
20: Option 1 End
21: Option 2 Start
22: Message Display -- A Knight is outside looking for a job. Go talk to him.
23: Modify Mode -- Knight -- Mode 2
24: Option 2 End
25: Option 3 Start
26: Message Display -- A Mage is outside looking for a job. Go talk to him.
27: Modify Mode -- Mage -- Mode 2
28: Option 3 End
29: Option 4 Start
30: Message Display -- A Thief is outside looking for a job. Go talk to him.
31: Modify Mode -- Thief -- Mode 2
32: Option 4 End
33: End Branch
34: Yes End
35: No Start
36: Message Display -- All right. I'll be here if you change your mind.
37: No End
38: End Branch
39: Option 2 End
40: End Branch
-----
Whew! That's a lot of commands. Now, here's what's happening in the code:
Line 1 checks the main character's internal variable 1, party size, to see if he has too many party members. If he's at 4, the event ends and tells him to come back when he has less than 4 people in the party (BTW, the 4-member limit INCLUDES the main character -- just wanted to point that out).
If the main character DOES have less than three members in his party, it goes to the Q/A Branch on line 6. I give the player the option, even if he has the room, to not accept a new member. If you answer no, the event ends.
If the main character DOES have less than three members in his party AND he answers YES to the question, here's what happens:
On Line 8, I increase the main character's internal variable 2, class selector by 1. What the heck does this do? Well, RM3 has no true command to give you a random number, so for the purposes of this tutorial, each time you want to add a new person, this variable increases by 1, so each time you want to add a new person, the event will cycle through the four classes and give you a new person each time.
"BUT WAIT!" those of you paying attention pipe up. "If you talk to him more than four times, that variable will increase to 4! We don't have five different classes!" Right you are, which is why we use lines 9 through 14. Here, if internal variable 2 is equal to 4, it RESETS IT to 0 using a Modify Internal Variable command, thus allowing you to cycle through the classes again. You'll notice there's nothing being checked between lines 13 and 14, and that's fine. If you leave something like that in RM3 blank, it'll just continue on to the next set of commands, which is what we want.
Lines 16 through 34 are the meat of the class selector. Depending on what your main character's internal variable 2 (class selector) is, it matches it up with the corresponding class and, using Modify Mode on each of those characters, will turn on their Mode 2, allowing them to appear outside so you can talk to them.
The rest of the code is just closing the branches you opened earlier in the event.
PUTTING THE EVENT IN THE GAME
Set up a town with at least one building, or ANYTHING that will make you change an area. You don't have to do this, but I did just to show clearly that it happens. Put the Warrior, Knight, Mage, and Thief characters outside the building. Make a new building, this will be where the Party Clerk character does his thing. Inside that room, create the Party Clerk character.
NOW TEST IT!
If you did everything correctly, here's what happens:
When you first walk outside the Party Clerk's building, you shouldn't see the four class characters. That's because they're all on Mode 1 with their display off.
Going inside the building and talking to the clerk, his first response will be to allow you to add someone to the party. That's because you obviously have room. Each time you talk to him, he should start at Knight, then Mage, then Thief, then Warrior (if you keep talking to him, I'm not sure what happens after that -- probably nothing).
Go back outside and huzzah, there are your characters waiting to be talked to and let into your party! Now, if you remember, waaay back in the beginning, I said this about setting up the party members:
In Mode 2, set their display to ON (should be on by default) and create whatever you want to allow them to join you, but somewhere in there when they join, throw in an Increase Internal Variable - Main Character - Internal Variable 1, set it to 1.
Each time you add a person to the party, your main character's interal variable 1 get increased by 1. This is what the party clerk checks immediately when you first talk to him to decide if you can even have more people in your party.
------
Wow, that was a lot of typing. Again, this code is really basic and is an unfinished concept. There's a lot you could add to spiff this up or maybe not make it so cumbersome, I'm sure. This is not what I'll be using in my game, but it'll be based on it. I hope it helps and gives you some ideas as to how to use your variables and condition statements if you're clueless about them.
:falls over dead:
