Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> Party Switcher/Changer
gsorby
post Jan 1 2010, 02:52 PM
Post #1


Level 2
Group Icon

Group: Member
Posts: 28
Type: Developer
RM Skill: Advanced




Party Switcher/Changer V 1.1

Version
1.1

Author
Prexus (For the actual script, and I have full permission from Prexus to post it here)
GSorby (for the few edits and additions)

Release Date
1/1/2010


Exclusive Script at Rpgmakervx.net


Introduction
Creates a scene to rearrange your party. There are a variety of things to do in this system. You can remove and add characters from being available in the Reserves (non-party members), lock characters so you can't add or remove them, and make characters "Unavailable", which does about the same thing as Locking. The reasoning behind having two things like this is for representation purposes. A character who isn't in your party, but is temporarily unavailable COULD show up as being "Locked" (lock icon) but I didn't feel it looked as good as being "Unavailable" (greyed out.) But a character who IS in your party, but can't be removed, obviously wouldn't make sense as being Unavailable.

You can also see the statistics of the character, as well as the face graphic, in a small window to the right of the Party/Reserves.

What's the difference?
GSorby's edit of the script

Prexus' default script



Script
Party Switcher/Changer
CODE
#===============================================================================
# ● [VX] ◦ Party Manager/Switcher ◦
#-------------------------------------------------------------------------------
# ◦ By Prexus
# ◦ Edit by GSorby [george_sorby@hotmail.co.uk]
# ◦ RPG Revolution
# ◦ Released on: 27/12/2009
# ◦ Version: 1.1
#-------------------------------------------------------------------------------
# This is a Party Manager/Switcher which allows the player to switch current
# party member with ones that are on standby. You can also make a Party Member
# unavailible or locked. There is also a function so that you can show and hide
# party members in the manager.
#===============================================================================
#  To open the party manager, use the code below:
#
#  $scene = Scene_Party.new
#-------------------------------------------------------------------------------
#  To make an actor visible in the Party Window, use the code below:
#
#  $data_actors[ID].found = true                
#-------------------------------------------------------------------------------  
#  To make an actor unavailable (Grayed out)/unmoveable, use the code below:
#  
#  $data_actors[ID].unavailable = true            
#-------------------------------------------------------------------------------
#  To lock the leader, use the code below:                                  
#                                                                              
#  $game_party.members[0].actor.required = true              
#-------------------------------------------------------------------------------
#  To unlock the leader, use the code below:
#
#  $game_party.members[0].actor.required = false
#-------------------------------------------------------------------------------
#  To remove an actor from your reserves, use the code below:
#  
#  $data_actors[ID].found = false    
#===============================================================================
# Credits to Prexus for the main script.
# Credits to GSorby for the edit of the script.
# *Don't edit anything past this point unless you know what you're doing.*
#===============================================================================

module RPG
  class Actor
    def setup
      @found = false
      @unavailable = false
      @required = false
    end
    attr_accessor :found
    attr_accessor :unavailable
    attr_accessor :required
  end
end

class Game_Actors
  attr_reader :data
  alias prex_party_g_actors_initialize initialize
  def initialize
    prex_party_g_actors_initialize
    $data_actors.each do |actor|
      actor.setup if actor
      @data[actor.id] = Game_Actor.new(actor.id) if actor
    end
  end
end

class Scene_File < Scene_Base
  alias prex_party_s_file_write_save_data write_save_data
  alias prex_party_s_file_read_save_data read_save_data
  def write_save_data(file)
    prex_party_s_file_write_save_data(file)
    Marshal.dump($data_actors, file)
  end
  def read_save_data(file)
    prex_party_s_file_read_save_data(file)
    $data_actors = Marshal.load(file)
  end
end

class Scene_Title < Scene_Base
  alias prex_party_s_title_command_new_game command_new_game
  def command_new_game
    prex_party_s_title_command_new_game
    $game_party.members.each {|s| s.actor.found = true if s}
  end
end

class Window_Base < Window
  def draw_item_name(item, x, y, enabled = true, width = 172)
    if item != nil
      draw_icon(item.icon_index, x, y, enabled)
      self.contents.font.color = normal_color
      self.contents.font.color.alpha = enabled ? 255 : 128
      self.contents.draw_text(x + 24, y, width, WLH, item.name)
    end
  end
end

class Scene_Party < Scene_Base
  def start
    super
    create_menu_background
    create_windows
  end
  def create_windows
    @member_window = Window_CurrentMember.new
    @party_window = Window_CurrentParty.new
    @party_window.active = true
    @selectable_window = Window_SelectMember.new
  end
  def update_windows
    @member_window.update
    @party_window.update
    @selectable_window.update
    if @party_window.active
      @member_window.set_member(@party_window.member)
    elsif @selectable_window.active
      @member_window.set_member(@selectable_window.member)
    end
  end
  def terminate
    super
    @member_window.dispose
    @party_window.dispose
    @selectable_window.dispose
  end
  def update
    super
    update_windows
    update_input
  end
  def update_input
    if Input.trigger?(Input::A)
      if @member_window.mode == 1
        @member_window.set_mode(0)
      elsif @member_window.mode == 0
        @member_window.set_mode(1)
      end
    end
    if @party_window.active
      if Input.trigger?(Input::B)
        Sound.play_cancel
        $scene = Scene_Menu.new
      elsif Input.trigger?(Input::C)
        member = @party_window.member
        if member != nil
          if member.actor.unavailable or member.actor.required
            Sound.play_buzzer
            return
          end
        end
        Sound.play_decision
        @party_window.active = false
        @selectable_window.active = true
        @selectable_window.index = 0
      end
    elsif @selectable_window.active
      if Input.trigger?(Input::B)
        Sound.play_cancel
        @selectable_window.index = -1
        @selectable_window.active = false
        @party_window.active = true
      elsif Input.trigger?(Input::C)
        member = @selectable_window.member
        if member != nil
          if member.actor.unavailable
            Sound.play_buzzer
            return
          end
        end
        Sound.play_decision
        $game_party.remove_actor(@party_window.member.id) if @party_window.member != nil
        $game_party.add_actor(@selectable_window.member.id) if @selectable_window.member != nil
        @selectable_window.refresh
        @party_window.refresh
        @selectable_window.index = -1
        @selectable_window.active = false
        @party_window.active = true
      end
    end
  end
end

class Window_CurrentMember < Window_Base
  attr_reader :mode
  def initialize(member = nil, mode = 0)
    super(284, 47, 242, 306)
    create_contents
    @member = member
    @mode = 0
    refresh
  end
  def member
    return @member
  end
  def set_member(member)
    old_member = @member
    @member = member
    refresh if old_member != @member
  end
  def set_mode(mode)
    @mode = mode if [0, 1].include?(mode)
    refresh
  end
  def refresh
    self.contents.clear
    return unless @member
    x, y = 0, 0
    self.draw_actor_face(@member, x, y, 96)
    self.draw_actor_name(@member, x + 102, y)
    self.draw_actor_class(@member, x + 102, y + WLH)
    self.draw_actor_level(@member, x + 102, y + WLH*2)
    case @mode
    when 0
      self.draw_icon(0, self.contents.width - 24, y + WLH*2)
      self.draw_actor_hp(@member, x, y + WLH*5, 160)
      self.draw_actor_mp(@member, x, y + WLH*6, 160)
      self.draw_actor_parameter(@member, x, y + WLH*7, 0)
      self.draw_actor_parameter(@member, x, y + WLH*8, 1)
      self.draw_actor_parameter(@member, x, y + WLH*9, 2)
      self.draw_actor_parameter(@member, x, y + WLH*10, 3)
    when 1
      self.draw_icon(143, self.contents.width - 24, y + WLH*2)
      self.contents.draw_text(x, y + WLH*2, self.contents.width - 12, WLH, 'Stat', 2)
      for i in 0...@member.equips.size
        item = @member.equips[i]
        self.draw_item_name(item, x, y + WLH*(3+i), true, self.contents.width - 24)
      end
    end
  end
end

class Window_CurrentParty < Window_Selectable
  def initialize
    super(18, 60, 256, 64)
    @item_max = 4
    @column_max = @item_max
    create_contents
    self.index = 0
    refresh
  end
  def member
    return $game_party.members[self.index]
  end
  def refresh
    for i in 0...@item_max
      rect = item_rect(i)
      self.contents.clear_rect(rect)
    end
    for i in 0...$game_party.members.size
      rect = item_rect(i)
      bitmap = Cache.character($game_party.members[i].character_name)
      sign = $game_party.members[i].character_name[/^[\!\$]./]
      if sign != nil and sign.include?('$')
        cw = bitmap.width / 3
        ch = bitmap.height / 4
      else
        cw = bitmap.width / 12
        ch = bitmap.height / 8
      end
      n = $game_party.members[i].character_index
      src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
      if $game_party.members[i].actor.unavailable
        self.contents.blt(rect.x, rect.y, bitmap, src_rect, 128)
      else
        self.contents.blt(rect.x, rect.y, bitmap, src_rect, 255)
      end
      if $game_party.members[i].actor.required
        lock_bitmap = Cache.system("Locked")
        self.contents.blt(rect.x + rect.width - lock_bitmap.width,
                          rect.y + rect.height - lock_bitmap.height,
                          lock_bitmap, lock_bitmap.rect)
      end
    end
  end
  def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.width = (contents.width + @spacing) / @column_max - @spacing
    rect.height = 32
    rect.x = index % @column_max * (rect.width + @spacing)
    rect.y = index / @column_max * 32
    return rect
  end
end

class Window_SelectMember < Window_Selectable
  def initialize
    super(18, 144, 256, 192)
    calculate_actors
    @item_max = @actors.size + 1
    @column_max = 4
    self.index = -1
    self.active = false
    refresh
  end
  def calculate_actors
    @actors = []
    for a in $game_actors.data
      @actors << a if a != nil and a.actor.found and !$game_party.members.include?(a)
    end
  end
  def member
    return @actors[self.index]
  end
  def refresh
    self.contents.clear
    calculate_actors
    @item_max = @actors.size + 1
    for i in 0...@actors.size
      rect = item_rect(i)
      bitmap = Cache.character(@actors[i].character_name)
      sign = @actors[i].character_name[/^[\!\$]./]
      if sign != nil and sign.include?('$')
        cw = bitmap.width / 3
        ch = bitmap.height / 4
      else
        cw = bitmap.width / 12
        ch = bitmap.height / 8
      end
      n = @actors[i].character_index
      src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
      if @actors[i].actor.unavailable
        self.contents.blt(rect.x, rect.y, bitmap, src_rect, 128)
      else
        self.contents.blt(rect.x, rect.y, bitmap, src_rect, 255)
      end
      if @actors[i].actor.required
        lock_bitmap = Cache.system("Locked")
        self.contents.blt(rect.x + rect.width - lock_bitmap.width,
                          rect.y + rect.height - lock_bitmap.height,
                          lock_bitmap, lock_bitmap.rect)
      end
    end
  end
  def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.width = (contents.width + @spacing) / @column_max - @spacing
    rect.height = 32
    rect.x = index % @column_max * (rect.width + @spacing)
    rect.y = index / @column_max * 32
    return rect
  end
end


Compatibility
Only works on VX.

Screenshot

Screenshots
GSorby's edit of the script:

Prexus' default script:


DEMO

Latest Norton 360 Scanned = OK.

Installation

Below Scenes and above main, in the material section.
Copy the "Locked.png" file from the Graphics\System\ directory into your own project, or create your own.
Locked.png


The initial starting party is automatically made available in your Reserves/Party. However, when adding a party member using the regular Event command, it doesn't automatically add the character to your Reserves. The reason being for temporary characters and such.



Terms and Conditions
Credit Prexus for the script and credit GSorby for the edits.

Credits
Prexus: For his amazing Party Switcher script.
Reason for edit: Fixed HTML garbage -Kread


__________________________
Go to the top of the page
 
+Quote Post
   
 
Start new topic
Replies
luigi400000
post Sep 27 2011, 05:03 PM
Post #2


Level 2
Group Icon

Group: Member
Posts: 27
Type: Mapper
RM Skill: Intermediate




And.................. Crash, what did I do to make it crash? I put the script in the right place.
It only seems to crash when I try to lock actors 1, 2, and 3 as well as adding actors 5 and 10 to the roster, uh, help?

Here's the crash report thing.



Sorry about double posting.

EDIT: AH HA! Ok, so it crashes when I try to add actor 3! So I took off
"$game_party.members[3].actor.required = true"
It worked, but then only actor 2 and 3 are locked, but not 1, this confuses me because i took off actor 3's script thing. Someone know whats going on here?

This post has been edited by luigi400000: Sep 28 2011, 09:44 AM
Go to the top of the page
 
+Quote Post
   

Posts in this topic
- gsorby   Party Switcher/Changer   Jan 1 2010, 02:52 PM
- - Xzygon   You haven't exactly told us what you edited. A...   Jan 1 2010, 03:22 PM
|- - gsorby   QUOTE (Xzygon @ Jan 1 2010, 11:22 PM) You...   Jan 1 2010, 03:30 PM
- - Shanghai   So if all you do is change the size of a few windo...   Jan 2 2010, 12:14 AM
|- - gsorby   QUOTE (Shanghai @ Jan 2 2010, 08:14 AM) S...   Jan 2 2010, 03:11 AM
- - Xzygon   What's with the extra gauges? Those aren't...   Jan 2 2010, 12:18 AM
- - rcGingerNinja   Now now children no need to be snotty. The OP has...   Jan 2 2010, 03:40 AM
- - draken29   I want to remove a character in my reserve but how...   Jan 3 2010, 08:42 AM
|- - gsorby   QUOTE (draken29 @ Jan 3 2010, 04:42 PM) I...   Jan 3 2010, 08:45 AM
- - draken29   Thanks I'm only asking but can you post which...   Jan 3 2010, 08:53 AM
|- - gsorby   QUOTE (draken29 @ Jan 3 2010, 04:53 PM) T...   Jan 3 2010, 08:55 AM
- - draken29   ooh sorry about that i mean when you say QUOTE ...   Jan 3 2010, 09:05 AM
|- - gsorby   QUOTE (draken29 @ Jan 3 2010, 05:05 PM) o...   Jan 3 2010, 09:11 AM
- - draken29   I have founded the mistake my mistake Thanks g...   Jan 3 2010, 09:15 AM
|- - gsorby   QUOTE (draken29 @ Jan 3 2010, 05:15 PM) I...   Jan 3 2010, 09:50 AM
|- - draken29   QUOTE (gsorby @ Jan 4 2010, 12:50 AM) QUO...   Jan 3 2010, 09:55 AM
|- - gsorby   QUOTE (draken29 @ Jan 3 2010, 05:55 PM) Q...   Jan 3 2010, 09:57 AM
- - ItchMyController   can u put it on the menu? >.> i dont relly w...   Jan 5 2010, 05:24 PM
|- - gsorby   QUOTE (ItchMyController @ Jan 6 2010, 01...   Jan 6 2010, 02:18 AM
- - Xzygon   @Controller That's pretty easy to do. Just mak...   Jan 5 2010, 06:01 PM
- - romeboy109   nice   May 15 2010, 05:11 PM
- - Regashi   romeboy109, please do not spam and necropost.   May 16 2010, 03:37 AM
- - ichiruki   can you please make a shortcut when changing party...   Jun 19 2010, 03:29 AM
- - tdbnz   THat script is very good I give that script a A+++...   Jul 11 2010, 07:49 PM
- - MicCloud   I'm not very good with scripts so I came to a ...   Nov 2 2010, 02:44 PM
- - Noah123   help when i try to make an actor found, it says: ...   Nov 4 2010, 04:21 PM
|- - gsorby   QUOTE (Noah123 @ Nov 5 2010, 01:21 AM) he...   Nov 5 2010, 01:22 PM
|- - Noah123   QUOTE (gsorby @ Nov 5 2010, 02:22 PM) QUO...   Nov 5 2010, 04:32 PM
- - orcywoo6   Is there a way to make it so only one character ca...   Nov 9 2010, 01:44 AM
- - RPGMakerVX52   I was just viewing the other script ( ) and this...   Dec 28 2010, 11:05 AM
- - Adrien.   I am posting this here along with in the FF13 menu...   Jan 5 2011, 02:53 PM
|- - redm   QUOTE (Adrien. @ Jan 5 2011, 03:53 PM) I ...   Mar 9 2011, 05:37 PM
- - GwydionSilas   Hey, thanks for the script, man; I had tried to de...   Jan 13 2011, 11:39 PM
- - tuti05   Hi I have a small problem The Charsets I'm Us...   May 21 2011, 05:27 AM
- - tuti05   nvm i gave up on the whole project :/ i rather jus...   May 23 2011, 07:28 PM
- - Shadowhawke   When I try to run my game while using your script ...   Jun 3 2011, 08:19 AM
- - Kread-EX   You probably put it at a wrong place. Put it below...   Jun 3 2011, 08:41 AM
- - Uindo_Ookami   really really nice script but...is there a way so ...   Jun 13 2011, 10:29 AM
- - Kread-EX   A. The easiest way is to use Nightshade's Menu...   Jun 13 2011, 10:54 AM
- - Uindo_Ookami   ok and i use the Tankentai Side-view Battle system...   Jun 17 2011, 01:17 PM
- - dotsonface   nice edit!   Aug 12 2011, 05:42 PM
- - luigi400000   Great script! Love it, im gonna try to put it ...   Sep 27 2011, 05:03 PM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 20th May 2013 - 10:18 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker