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.

Party Leader Remover

(I know that Missingno and J.D. Slasha are gonna get on my case about not making my post ridiculously long, but it's a really simple request. I'll try and be as specific as possible, though.)

The game I'm making, without going too far into detail, features 225 playable characters. In order to switch between these characters, you must examine an object that corresponds to them. You can only play as one character at a time, so when you switch to another character, the character already in your party is automatically removed.

Or at least I'd like it to be that way. Given the options that rmxp provides, I'd have to write an event code to remove 225 characters for each object. So what I'm asking for is...

A script that, without having to be called upon, makes the maximum number of party members one. A script that automatically removes the current party member when the "Add Party Member" command is used.

I'm using other scripts too, and some of them are picky about what they're compatible with. So I'm apologizing ahead of time for any errors the scripts may present.

(And I don't know whether saying this is considered "ethical" here anymore, but...)

Please and thank you!
 
I can't say I totally understand what your are asking for but try this :

Code:
class Interpreter
  def addnremove(keepno, initialize)
    for i in 1..225
      # If actor is valid
      if $game_actors[i] != nil
      # If selected Actor
      if keepno == i
        if initialize == true
          $game_actors[i.setup(i)]
        end
        $game_party.add_actor(i)
      else #If not selected actor
        $game_party.remove_actor(i)
      end
    end
    end
  end
end

Add this anywhere above main. To use it, Call Script and type "addnremove(keepno, initialize)" where "keepno" is the ID of the actor you want to keep and "initialize" whether the actor should be initialized or not (type true or false)

Example : For Cyrus : addnremove(3, false)

Not sure if it works, but if it does, great.
 
Okay, I tried it, but I got an error. The message says:

NoMethodError occured while running script.
undefined method 'keepno' for #<Interpreter:0x16498a8>


Here's the event code so far:

@>Show choices: Fight this character., Switch to this character., Cancel.
  :  When [Fight this chracter.]
    @>
  :  When [Switch to this character.]
    @>Script: keepno(15, false)
    @>
  :  When [Cancel.]
    @>
  :  Branch End
@>

Perhaps I'm doing something wrong. If not, would you like me to send you the other script I'm using, so you can configure how to write another script that's compatible with it?

EDIT: Nevermind, I just realized what I did wrong. It works perfectly now. Thanks!
 
With this you won't have to use a script command. Everytime you add an actor, it will remove the current actor.
initialize is already handled in the default scripts. Just make sure you start the party with one actor.
(or it will remove the 'last' actor in the party)

Code:
class Game_Party
  alias autoremove_add_actor add_actor
  def add_actor(actor_id)
    @actors.pop
    autoremove_add_actor(actor_id)
  end
end

Be Well
 

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