Help - Search - Members - Calendar
Full Version: Maxhero's Party Manager
RPG RPG Revolution Forums > Scripting > Script Tutorials > RGSS2
maxhero
Well, Hello I'm Maxhero an Brazilian maker, and now i'm posting my script of party management. happy.gif
Instructions:
to call add character window use:
QUOTE
$scene = Scene_Party_Menu.new("Add")

to call remove character window use:
QUOTE
$scene = Scene_Party_Menu.new("Remove")

ScreenShots:
Screenshots




Script:
Script
CODE
#===============================================================================
# Maxhero Party Manager
#-------------------------------------------------------------------------------
#
#===============================================================================
module Maxhero
  module Party_Manager
    TEXTS = [
    "Which character you want to add?",
    "You have the limit of characters in party",
    "Which character you want to remove?"
    ]
    BLOCKED_ACTORS    = [1]
    INCLUDED_ACTORS = [2,3,4,5,6,7,8]
  end
end
class Game_Actors
  alias index [] unless $@
  def []( x )
    x = x.id if x.is_a?(Game_Actor)
    return index( x )
  end
end
#===============================================================================
# **Window_Party_Manager
#===============================================================================
class Window_Party_Manager < Window_Base
  #-----------------------------------------------------------------------------
  # *Initialize
  #  x:        X of the Window
  #  y:        Y of the Window
  #  width:    Width of Window
  #  height:   Height pf Window
  #-----------------------------------------------------------------------------
  def initialize(x,y,width,height)
    super(x,y,width,height)
    self.contents = Bitmap.new(width - 32,height - 32)
  end
  #-----------------------------------------------------------------------------
  # *draw_info
  #  actor_id: the id of the actor to draw the contents
  #-----------------------------------------------------------------------------
  def draw_info(actor_id)
    draw_actor_name     ($game_actors[actor_id]     ,0,   0)
    draw_actor_level    ($game_actors[actor_id]     ,0,  40)
    draw_actor_class    ($game_actors[actor_id]     ,0,  20)
    draw_actor_face     ($game_actors[actor_id]     ,0,  60)
    draw_actor_hp       ($game_actors[actor_id]     ,0, 156)
    draw_equipments     ($game_actors[actor_id],   135,   0)
    draw_actor_mp       ($game_actors[actor_id]     ,0, 176)
    draw_actor_parameter($game_actors[actor_id]     ,0, 196, 0)
    draw_actor_parameter($game_actors[actor_id]     ,0, 216, 1)
    draw_actor_parameter($game_actors[actor_id]     ,0, 236, 2)
    draw_actor_parameter($game_actors[actor_id]     ,0, 256, 3)
  end
  #-----------------------------------------------------------------------------
  # *draw_equipaments
  #  x:          x where draw the actor equipaments
  #  y:          y where draw the actor equipaments
  #  actor:      actor which has the item
  #-----------------------------------------------------------------------------
  def draw_equipments(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 120, WLH, Vocab::equip)
    (0..4).each{|i|draw_item_name(actor.equips[i], x + 16, y + WLH * (i + 1))}
  end
  #-----------------------------------------------------------------------------
  # *update
  #-----------------------------------------------------------------------------
  def update
    super
  end
end
#===============================================================================
# **Scene_Party_Menu
#===============================================================================
class Scene_Party_Menu < Scene_Base
  include Maxhero::Party_Manager
  #-----------------------------------------------------------------------------
  # *Initialize
  # type: if "Add" go to Add Window Character, if "Remove" go to Remove Char Win
  #-----------------------------------------------------------------------------
  def initialize(type)
    @type = type
  end
  #-----------------------------------------------------------------------------
  # *start
  #-----------------------------------------------------------------------------
  def start
    @WPM  = Window_Party_Manager.new(160,000,544-160,416-(24+32))
    @WC   = Window_Command.new(160,include_add_chars)
    @WH   = Window_Help.new
    @WH.y = 416-(24+32)
    @WH.set_text(TEXTS[0]) if add_mode?
    @WH.set_text(TEXTS[2]) if remove_mode?
    create_menu_background
    @WPM.draw_info(INCLUDED_ACTORS[@WC.index])        if add_mode?
    @WPM.draw_info($game_party.members[@WC.index].id) if remove_mode?
  end
  #-----------------------------------------------------------------------------
  # *update
  #-----------------------------------------------------------------------------
  def update
    @WPM.update
    @WC.update
    if Input.trigger?(Input::C)
      Sound.play_decision
      party = $game_party
      if add_mode?
        if party.members.size < 4
          $game_party.add_actor(INCLUDED_ACTORS[@WC.index])
        else
          print TEXTS[1]
        end
      end
      if remove_mode?
        $game_party.remove_actor(@actors[@WC.index].id)
      end
      $scene = Scene_Map.new
    end      
      @WPM.contents.clear
      @WPM.draw_info(INCLUDED_ACTORS[@WC.index])     if add_mode?
      if remove_mode?
        @WPM.draw_info(@actors[@WC.index].id)
      end
    if Input.trigger?(Input::B)
      return_scene
    end
  end
  #-----------------------------------------------------------------------------
  # *terminate
  #-----------------------------------------------------------------------------
  def terminate
    dispose_menu_background
    @WPM.dispose
    @WC.dispose
    @WH.dispose
  end
  #-----------------------------------------------------------------------------
  # *Add Mode?
  #-----------------------------------------------------------------------------
  def add_mode?
    return true if @type == "Add"
    return false
  end
  #-----------------------------------------------------------------------------
  # *Remove Mode?
  #-----------------------------------------------------------------------------
  def remove_mode?
    return true if @type == "Remove"
    return false
  end
  #-----------------------------------------------------------------------------
  # *return_scene
  #-----------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Map.new
  end
  #-----------------------------------------------------------------------------
  # *include_add_chars
  #-----------------------------------------------------------------------------
  def include_add_chars
    array   = []
    party   = $game_party.members
    INCLUDED_ACTORS.each{|i| array << $game_actors[i].name}   if add_mode?
    if remove_mode?
      commands = []
      @actors = []
      $game_party.members.each do |actor|
        if !actor.nil? && $game_party.members.size > 1 &&
          !BLOCKED_ACTORS.include?(actor.id)
          @actors << actor
          array << actor.name
        end
      end
      array << "" if array.empty?
    end
    return array
  end
end

DEMO:
Download
Brazy
hey wassup... quick question: throughout the game, when adding & removing party members, will their levels squired be the same???
Lockheart
Is it possible in this script to include new characters to be added to the list over the course of the game?

For Example, say Vera and Elmer aren't available off the bat of the game but could be added later in the game, is this already possible?
maxhero
QUOTE (Brazy @ Sep 13 2011, 09:04 AM) *
hey wassup... quick question: throughout the game, when adding & removing party members, will their levels squired be the same???

I not tested it...
But I Think when remove and add before back with same level...

QUOTE (Lockheart @ Sep 13 2011, 12:47 PM) *
Is it possible in this script to include new characters to be added to the list over the course of the game?

For Example, say Vera and Elmer aren't available off the bat of the game but could be added later in the game, is this already possible?

well, I Will Create This function..
rural_monk
Real Nice! I can't wait to see some future functions like those mentioned by lockheart! smile.gif
darquez1
where do the QUOTE go?
nevious
it would be very nice to see this script more advanced i think it could very well have amazing aplications in numerious games. good job maxhero, cant wait to see more for this.
SloaTheDemon
i was curious if u could make it where at some points you can't choose characters not bc there not added or anything but u just can choose them bc u guy are splitting up into two or three groups or something. Best way i can think to explain it
munkis
Can this script change the party leader?

@sloan: Do you mean locking certain party members in place, and multiple parties?
SloaTheDemon
not quite i mean like on final fantasy 8 they would have two parties and u couldn't choose a certain character bc of such and such and stuff and it's Sloa lol
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.