じ☆ve冰风 发表于 2026-8-3 12:19:40

Maxhero's Party Manager

Maxhero's Party Manager


Intro

This is my first script reformulated to RPG Maker VX Ace years later.Learn how to configure in "How to use" part.


Screenshots

Spoiler
http://i.imgur.com/NoUW2pu.png




Spoiler
http://i.imgur.com/CmSmSjK.png




Spoiler
http://i.imgur.com/hpIFuKI.png




Spoiler
http://i.imgur.com/P4FTYRX.png




How to use


[*]   Edit @REM_BLOCK to set the Party-Fixed Characters
[*]   Edit @AVALIABLE_ACTORS to set the Avaliable characters by default
[*]   Edit @TEXTS to setup the Menu texts
[*]   To enable actors in game use the command:
PartyManager.enable_actor(id)

[*]   To disable actors in game use the command:
                Code:       
PartyManager.disable_actor(id)


[*]   To lock a character in party use the command:
                Code:       
PartyManager.lock(id)


[*]   To unlock a character in party use the command:
                Code:       
PartyManager.unlock(id)

      replace "id" by the actor id in database


[*]   To start the PartyManager with add mode, create a event calling the Script:
                Code:       
SceneManager.call(Scene_PartyManager,:add)


[*]   To start the PartyManager with remove mode, create a event calling the Script:
                Code:       
SceneManager.call(Scene_PartyManager,:remove)


Script

Spoiler: Maxhero's Party Manager                Ruby:       
#===============================================================================
# Maxhero's Party Editor
#-------------------------------------------------------------------------------
=begin Terms of Use:
—If use don't forget to quote my name in credits.
—You're free to modify and redistribute this script keeping this Header.
Instructios:
—Edit @REM_BLOCK to set the Party-Fixed Characters
—To enable actors in game use the command:   
PartyManager.enable_actor(id)
—To disable actors in game use the command:   
PartyManager.disable_actor(id)
—To lock a character in party use the command:   
PartyManager.lock(id)
—To unlock a character in party use the command:   
PartyManager.unlock(id)   
replace "id" by the actor id in database
—To start the PartyManager with add mode, create a event calling the Script:   
SceneManager.call(Scene_PartyManager,:add)
—To start the PartyManager with remove mode, create a event calling the Script:   
SceneManager.call(Scene_PartyManager,:remove)
=end
#===============================================================================
module PartyManager
    extend self
    @REM_BLOCK      =
    @AVALIABLE_ACTORS =
    @TEXTS            = [    "Which character you want to add?",
                                          "Which character you want to remove?",
                                          "You have all the avaliable characters.",
                                          "There is no character to remove."]
    def blocked_actors
      return @REM_BLOCK
    end
    def avaliable_actors
      return @AVALIABLE_ACTORS
    end
    def enable_actor(id)
      @AVALIABLE_ACTORS << id
    end
    def disable_actor(id)
      @AVALIABLE_ACTORS.delete(id)
    end
    def lock(id)
      @REM_BLOCK << id
    end
    def unlock(id)
      @REM_BLOCK.delete(id)
    end
    def have_all_avaliable_chars_text
      return @TEXTS
    end
    def no_char_to_remove
      return @TEXTS
    end
    def add_help
      return @TEXTS
    end
    def remove_help
      return @TEXTS
    end
    def load_blocked_actors(array)
      @REM_BLOCK = array
    end
    def load_avaliable_actors(array)
      @AVALIABLE_ACTORS = array
    end
end
#===============================================================================
# DataManager Mod
#===============================================================================
module DataManager
    class << self
      alias maxpm_msv make_save_contents
      alias maxpm_esv extract_save_contents
      def make_save_contents   
      contents = maxpm_msv   
      contents[:blocked_actors] = PartyManager.blocked_actors   
      contents[:avaliable_actors] = PartyManager.blocked_actors   
      contents
      end
      def extract_save_contents(contents)   
      maxpm_esv(contents)   
      PartyManager.load_blocked_actors(contents[:blocked_actors])   
      PartyManager.load_avaliable_actors(contents[:avaliable_actors])
      end
    end
end
#===============================================================================
# SceneManager Mod
#===============================================================================
module SceneManager
    def self.call(scene_class, args=nil)
      @stack.push(@scene)
      @scene = scene_class.new(*args)
    end
end
#===============================================================================
# Character Information Window
#===============================================================================
class Window_Char_Info < Window_Base
    def initialize
      super(160, 0, Graphics.width-160, Graphics.height)
      self.contents = Bitmap.new(width - 32, height - 32)
      refresh
    end
    def refresh
      self.contents.clear
    end
    def draw_char_info(actor_id)
      draw_actor_name($game_actors, 0, 0)
      draw_actor_level($game_actors, 0, 40)
      draw_actor_class($game_actors, 0, 20)
      draw_actor_face($game_actors, 0, 60)
      draw_actor_hp($game_actors, 0, 156)
      draw_actor_mp($game_actors, 0, 176)
      draw_actor_param($game_actors, 0, 196, 0)
      draw_actor_param($game_actors, 0, 216, 1)
      draw_actor_param($game_actors, 0, 236, 2)
      draw_actor_param($game_actors, 0, 256, 3)
      draw_actor_param($game_actors, 0, 276, 4)
      draw_actor_param($game_actors, 0, 296, 5)
      draw_actor_param($game_actors, self.width/2,196,6)
      draw_actor_param($game_actors, self.width/2,216,7)
      draw_equipments(170, 0, $game_actors)
    end
    def draw_equipments(x, y, actor)
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 120, 32, Vocab.equip)
      for i in 0..4   
            draw_item_name(actor.equips, x + 16, y + 32 * (i + 1))
      end
    end
end
#===============================================================================
# Window_PMHelp
#===============================================================================
class Window_PMHelp < Window_Base
    attr_accessor :host
    def initialize(hostage)
      super(0, 0, Graphics.width, 48)
      @host = hostage
    end
    def set_text(text)
      if text != @text   
            @text = text   
            refresh
      end
    end
    def clear
      set_text("")
    end
    def set_item(item)
      set_text(item ? item.description : "")
end
def refresh
      contents.clear
      draw_text_ex(4, 0, @text)
    end
    def update
      super
      if Input.trigger?(:B)
            @host.return_to_map
      end
    end
end
#===============================================================================
# Window_PMCommand
#===============================================================================
class Window_PMCommand < Window_Command
attr_accessor :current_actor,:behavior,:backsignal,:host
    def initialize(hostage)
      super(0, 32)
      @host       = hostage
      @behavior   = @host.behavior
      @backsignal = false
      party = []
      $game_party.members.each{|item| party << item.id}
      case @behavior
      when :add   
            @actor_list = (PartyManager.avaliable_actors - party)
      when :remove   
            @actor_list = (party - PartyManager.blocked_actors)
      end
      update_placement
      self.openness = 0
      open
    end
    def window_width
      return 160
    end
    def update_placement
      self.height = (self.y+self.height) > Graphics.height ? (line_height*14)+10 : line_height*(@actor_list.size+1)
      self.x = (Graphics.width - width) / 2
      self.y = (Graphics.height * 1.6 - height) / 2
    end
    def update
      super
      @current_actor = @actor_list[@index]
      if Input.trigger?(:B)
            @host.return_to_map
      end
    end
    def common_handler
      @behavior == :add ? $game_party.add_actor(@current_actor) : $game_party.remove_actor(@current_actor)
    end
    def make_command_list
      #set_handler(symbol, method)
      case @behavior
      when :add   
            for i in @actor_list      
                actor = $game_actors      
                add_command(actor.name, actor.name.to_sym) unless actor.nil?      
                set_handler(actor.name.to_sym, Proc.new{@host.decision})   
            end
      when :remove   
            for i in @actor_list      
                actor = $game_actors      
                add_command(actor.name, actor.name.to_sym)      
                set_handler(actor.name.to_sym, Proc.new{@host.decision})   
            end
      end
    end
end
#===============================================================================
# Scene_PartyManager
#===============================================================================
class Scene_PartyManager < Scene_MenuBase
    attr_accessor :behavior
    def initialize(behavior)
      @behavior = behavior
    end
      def start
      super
      @L = verification
      unless @L   
            case @behavior   
            when :add;    create_add   
            when :remove; create_remove   
            end
      else   
            create_warn
      end
    end
    def verification
      party = $game_party.members.collect{|item| item.id}
      x = (party - PartyManager.blocked_actors).empty?
      y = (PartyManager.avaliable_actors - party).empty?
      return true if (@behavior == :remove && x)
      return true if (@behavior == :add    && y)
      return false
    end
    def create_add
      @help_win = Window_Help.new
      @com_win= Window_PMCommand.new(self)
      @com_win.make_command_list
      @help_win.set_text(PartyManager.add_help)
      create_info_window
    end
    def create_remove
      @help_win = Window_Help.new
      @com_win= Window_PMCommand.new(self)
      @com_win.make_command_list
      @help_win.set_text(PartyManager.remove_help)
      create_info_window
    end
    def decision
      @com_win.common_handler
      SceneManager.goto(Scene_Map)
    end
    def create_info_window
      @info_win          = Window_Char_Info.new
      @info_win.height   = Graphics.height-@help_win.height
      @info_win.y      = @help_win.height
      @com_win.x         = 0
      @com_win.y         = @help_win.height
    end
    def create_warn
      @help_win   = Window_PMHelp.new(self)
      @help_win.y = (Graphics.height/2)-(@help_win.height/2)
      @help_win.opacity = 0
      case @behavior
            when :add;    @help_win.set_text(PartyManager.have_all_avaliable_chars_text)
            when :remove; @help_win.set_text(PartyManager.no_char_to_remove)
      end
    end
    def update_warn
      @help_win.refresh
      @help_win.update
    end
    def return_to_map;SceneManager.goto(Scene_Map);end
    def update_main
      @com_win.refresh
      Input.update
      @com_win.update
      Input.update
      @info_win.refresh
      @info_win.draw_char_info(@com_win.current_actor)
    end
    def update
      super
      @L ? update_warn : update_main
    end
    def terminate
      super
      unless @L   
            @com_win.dispose   
            @info_win.dispose
      end
      @help_win.dispose
      dispose_background
    end
end

If you will use this script, please, quote "maxhero" in your project credits
Thanks to Kyo Panda for helping me in earlier versions of this script.
Thanks to Roninator2 for formatting the script.


本贴来自国际rpgmaker官方论坛作者:maxhero处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/maxheros-party-manager.29354/
页: [1]
查看完整版本: Maxhero&#039;s Party Manager