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.

Game_Party (Enhanced)

Game Party (Enhanced)
written by Kain Nobel

Introduction

This isn't actually a full scene script itself, however it will belong to a Party Changer script I will be working on in a couple days for my CMS, but for now I decided to share whats currently there for any scripters who would like to use or build onto it. Like the name implies, its an enhanced version of Game_Party, nothing less, nothing more, you can read the features below. Until I build the full Party Changer script, you can use this if you plan on creating your own party change script, you could probably find it useful.

This is a scripter's script, I'm not leaving instructions, just read the syntax inside to see how it works. You can still use this script with call script events, and the add/remove actor event commands still work normally, but in itself its really not worth anything unless YOU want to create a party changing script too (which is why I'm posting it.)

Features

-Allows you to have a main and reserve party-
-Allows you to lock actors into the party-
-Allows you to enable and disable actors from being selected-

Some stuff I still need to do

I'm going to re-write how the script handles the Party Leader, because thats the only non-functional portion of the script (I removed the "Leader" portion.) You will be able to specify who the party leader is, and determine if the party leader gets killed its Game Over or you're taken to the last Inn you visited or whatever, etc.

Moreso than that, I hope to finish the real deal party changer for my CMS by Thursday, I'll be glad to share it when I finish it.

Script
Code:
#===============================================================================
# ** Game_Party
#-------------------------------------------------------------------------------
#  This class handles the party. It includes information on amount of gold
#  and items. Refer to "$game_party" for the instance of this class.
#===============================================================================
class Game_Party
  # [Attributes]----------------------------------------------------------------
  attr_accessor   :leader                    # game party's leader
  attr_accessor   :locked                    # locked actors
  attr_accessor   :reserve                   # reserve actors
  attr_accessor   :disabled                  # disabled actors
  attr_accessor   :bench                     # inactive actors
  # [Alias Methods]-------------------------------------------------------------
  alias_method :kn_cms_game_party_initialize, :initialize
  #-----------------------------------------------------------------------------
  # * Object Initialization (Aliased)
  #-----------------------------------------------------------------------------
  def initialize
    # Create reserve actor array
    @leader   = nil
    @locked   = []
    @reserve  = []
    @disabled = []
    @bench    = []
    kn_cms_game_party_initialize
  end
  #-----------------------------------------------------------------------------
  # * Add Actor Method
  #     actor_id : actor ID
  #-----------------------------------------------------------------------------
  def add_actor(actor_id)
    # Get actor
    actor = $game_actors[actor_id]
    @arg01 = @disabled.include?(actor)
    @arg02 = @actors.include?(actor)
    if @actors.size < 3
      @actors.push(actor) unless @actors.include?(actor) or @arg01
      @bench.delete(actor) if @bench.include?(actor)
    else
      @reserve.push(actor) unless @reserve.include?(actor) or @arg01 or @arg02
      @bench.delete(actor) if @bench.include?(actor)
    end
    # Refres Game Player
    $game_player.refresh
  end
  #-----------------------------------------------------------------------------
  # * Remove Actor
  #     actor_id : actor ID
  #-----------------------------------------------------------------------------
  def remove_actor(actor_id)
    # Get actor
    actor = $game_actors[actor_id]
    # Delete actor from main and reserve party
    unless @bench.include?(actor)
      @arg01 = @actors.include?(actor)
      @arg02 = @locked.include?(actor)
      @actors.delete(actor) if @arg01 and not @arg02
      @reserve.delete(actor) if @reserve.include?(actor)
      # Push actor into bench array
      @bench.push(actor) unless @bench.include?(actor)
    end
    # Refresh player
    $game_player.refresh
  end
  #-----------------------------------------------------------------------------
  # * Lock Actor
  #     actor_id : actor ID
  #-----------------------------------------------------------------------------
  def lock_actor(actor_id)
    # Get actor
    actor = $game_actors[actor_id]
    # Place actor in locked array
    unless @locked.include?(actor)
      # Put actor in party and lock actor
      @actors.push(actor) unless @actors.include?(actor)
      @locked.push(actor) unless @actors.include?(actor)
      # Remove locked member from other parties
      @reserve.delete(actor)
      @disabled.delete(actor)
      @bench.delete(actor)
    end
    # Refresh player
    $game_player.refresh
  end
  #-----------------------------------------------------------------------------
  # * Unlock Actor
  #     actor_id : actor ID
  #     boolean  : auto remove actor
  #-----------------------------------------------------------------------------
  def unlock_actor(actor_id, boolean = false)
    # Get actor
    actor = $game_actors[actor_id]
    # Remove actor from locked array (and party if boolean is true)
    if @locked.include?(actor)
      @locked.delete(actor)
      remove_actor(actor_id) if boolean == true
    end
    # Refresh Player
    $game_player.refresh
  end
  #-----------------------------------------------------------------------------
  # * Enable Actor
  #     actor_id : actor ID
  #-----------------------------------------------------------------------------
  def enable_actor(actor_id, boolean = false)
    # Get actor
    actor = $game_actors[actor_id]
    # Enable Actor
    if @disabled.include?(actor)
      unless @actors.size < 4          
        @disabled.delete(actor)
        @bench.push(actor) unless @bench.include?(actor) or boolean == true
      else
        @actors.push(actor)
      end
    end
  end
  #-----------------------------------------------------------------------------
  # * Disable Actor
  #     actor_id : actor ID
  #-----------------------------------------------------------------------------
  def disable_actor(actor_id)
    # Get actor
    actor = $game_actors[actor_id]
    # Disable Actor
    unless @disabled.include?(actor)
      # Actor is pushed into the 'disabled' array
      @disabled.push(actor)
      # Actor is deleted from respective party
      @actors.delete(actor) if @actors.include?(actor)
      @reserve.delete(actor) if @reserve.include?(actor)
      @locked.delete(actor) if @locked.include?(actor)
      @bench.delete(actor) if @bench.include?(actor)
    end
    # Refresh Player
    $game_player.refresh
  end
end

Other Notes
I simply HAD to write this, because Dargor's Party Changer script is way incompatible with my CMS. However, if you know how to implement Dargor's script into your CMS or are using the default menu, I'd suggest using his script because its pretty simple to use and is pretty cool, I tried to write this particular class to be kinda like his.
 
There's nothing really to show, because I haven't made a menu interface for it. Like I said, its just an enhanced version of Game_Party which handles party data different. If you read the description and look at the script, you should see what it does...

Again, this is more of a scripter-script, for people who want to make a party menu. I'll be making one myself, which will hopefully be up here by 10pm Thursday, but until then thats all I have, its not much but it works for what its intended for so far.

If you don't intend to make your own party script, ignore this topic until I get my full Party Changing script up.

PS: Quick update to the script, the previous version I fixed the line so that the reserve party doesn't add all the actors from the main party when using the 'add_actor' command.
 

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