Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Reserve Party Members

Rya

Member

What My Script Does

I am working on a Custom Menu System, and one of the elements of it, is that all potential party members are shown in the menu. The player can switch around the battle party through the "Party" option.

What the Problem Is


The problem that I am having is that I'm not sure how to set it up so that the player can check the status, equipment, and skills of them all (Large Party Script would probably help), and be able to pick the members for battle. I want it to work as well, that they are forced to have certain people in their party at certain times.

I am sure this can be done with switches, but I'm not entirely sure how. I've checked out some tutorials, and have been given little aid there.

The last problem being that I am making this script myself (or trying to), for a commercial game. Any help would be welcomed.
 
First: Nice request, so you get a nice response. It's apprechiated!


I understand this as you know the basics, and that's about it. Well, lemme tell you what you gotta do roughly then:

First, you don't need a 'large party script'... you need a number changed that limits the amount of players that can be added to your party - the MenuStatus window will automatically list all members in the party, regardless if it has more than intended by the default scripts. You'd need to adjust that window though if you don't want to scroll.

Then, for your party member changer, you sure won't use switches, or I'll personally beat ya with a banana. ;) Instead, you will (hopefully) use one array that stores active character's IDs. Check out (or simply copy) one of the default methods that switch from the main Scene_Menu command window (defined in the class as @command_window) to Window_MenuStatus (should be @status_window, though I'm not sure about that right now) and modifiy it according to your needs: copy it for the party command index, and instead of switching to another scene on Input::C, what you do is something like this:
Code:
if @actor_array.include?(@status_window.index)

  @actor_array -= @status_window.index

  @status_window.refresh

else

  @actor_array += @status_window.index

  @actor_array.sort

  @status_window.refresh

end
@status_window.index being an array, you can safely use this to modify your active character's entry. You'll also realize it's an on-off-switch functionality i did there, which makes it really easy for the player to operate. Of course, you gotta include some kind of identifier into your Window_MenuStatus so they can see what they did or not (for example graying out the avatar or something).
Note that this only works if you got all through-the-game-available actors from the start on. I assume that is not the case for you, but since you're here to learn, I don't wanna give ya too much pre-made code, but rather an idea how to approach it. You should be able to figure the necessary modifications ut by yourself after some looking through the scripts and probably with previous experience you have already, and learn a lot about rm**'s way to handle game data on the way.

Now for your exclusion of removing (and probably adding) some characters at some point of time: Simply extend the conditional branch you just created with a few additional conditionals, asking for another array that stores locked characters... let's name it @actor_blacklist for this example. Store actors in there which status cannot be changed for easyness (you could create one which can't be removed and one which can't be add, but that's unnecessary... this is a little more complicated for you to work with, but more effective for the interpreter as well). You can figure the necessary branch out by yourself, I'm sure.

Last menu-relevant part: When do you determine which characters are locked and which aren't? Personally, I'd use a method within Game_Party for that, so that you can just call $game_party.lock_actor(id) from your event commands outside the script editor. Now let's take a look at what needs to be in there...
Obviously, you gotta add that character to the blacklist array, so that's what you do first. But you also need something else very important: Removing or adding the character from/to the party. Because if you don't do that, the character might be stuck on just the wrong side, depending on if the player has him/her selected or not - meaning there's the possibility you'll never find it out during testing. But yeah, let's just fix it from the begin with by removing/adding the character from/to the party in the process. I'll do that in a way you should easily be able to figure out without too much hints.
Your whole method for this would look somewhat like this:
Code:
class Game_Party

  def lock_actor(id, direction=0)

    $game_party.remove_actor(id) if direction == 0 # note to use remove_member for RMVX

    $game_party.add_actor(id) if direction == 1 # note to use add_member for RMVX

    @actor_blacklist += id

  end

end
You'll probably noticed I used a class-relative variable both times. You need attribute accessors to transfer them between classes, so that's probably a bit more complicated than the rest - easy when you know it though, so better check out a more comprehensive tutorial about this.


Obviously, just having the variable with the active members in the party isn't doing you to much good unless you actually ask for it somewhere. I assume you updated Window_MenuStatus with that, so you see which character's you've added and which not. What you definatel need is battle scenes, though.
RMXPs default scripts handle battlers in a way that they add them to a @battlers array as part of phase_1... I dunno about VX, since I long started doing custom battlesystems before it came out, but either way, you're on your own there, since I can't look it up for your right now ^^" Keep in mind though: If you manage to do it yourself, you'll like your script just the better! :D (okay, lame excuse, but I can't help it, so... ^^)


Feel free to ask any questions you got, and please post what you have for troubleshooting ^^ And good going.
 

Rya

Member

BlueScope, this has been most helpful! Thank you. I will have to fiddle with everything, and see what I can work out, and what I can't. If I have any problems, I will definitely let you know. I know some of RGSS by simply looking at it, and confirming what I learned through tutorials. But what I'm looking for is difficult to depict, when there are several different methods used for different reasons.

Once again, thank you. :)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top