Maxhero's Party Manager

● ARCHIVED · READ-ONLY
Started by maxhero 6 posts View original ↗
  1. 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
    NoUW2pu.png
    Spoiler
    CmSmSjK.png
    Spoiler
    hpIFuKI.png
    Spoiler
    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

    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        = [1]
        @AVALIABLE_ACTORS = [2,3,4,5,6,7,8,9]
        @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[2]
        end
        def no_char_to_remove  
            return @TEXTS[3]
        end
        def add_help  
            return @TEXTS[0]
        end
        def remove_help  
            return @TEXTS[1]
        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[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_actor_mp($game_actors[actor_id], 0, 176)  
            draw_actor_param($game_actors[actor_id], 0, 196, 0)  
            draw_actor_param($game_actors[actor_id], 0, 216, 1)  
            draw_actor_param($game_actors[actor_id], 0, 236, 2)  
            draw_actor_param($game_actors[actor_id], 0, 256, 3)  
            draw_actor_param($game_actors[actor_id], 0, 276, 4)  
            draw_actor_param($game_actors[actor_id], 0, 296, 5)  
            draw_actor_param($game_actors[actor_id], self.width/2,196,6)  
            draw_actor_param($game_actors[actor_id], self.width/2,216,7)  
            draw_equipments(170, 0, $game_actors[actor_id])
        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[i], 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[i]      
                    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[i]      
                    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.
  2. This is a system like Chrono Triggers add/drop characters! I often wondered if this was possible to achieve in RPG maker, good work on the script it may come in handy in a future project!
  3. I've moved this thread to RGSS3 Scripts. Please be sure to post your threads in the correct forum next time. Thank you.
  4. Shaz said:
    I've moved this thread to RGSS3 Scripts. Please be sure to post your threads in the correct forum next time. Thank you.
    Thank you, and sorry for the inconvenience

    CorneredCosmos said:
    This is a system like Chrono Triggers add/drop characters! I often wondered if this was possible to achieve in RPG maker, good work on the script it may come in handy in a future project!
    Thank you
  5. Script format fixed
    Maxhero - 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        = [1] 
        @AVALIABLE_ACTORS = [2,3,4,5,6,7,8,9] 
        @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[2] 
        end 
        def no_char_to_remove   
            return @TEXTS[3] 
        end 
        def add_help   
            return @TEXTS[0] 
        end 
        def remove_help   
            return @TEXTS[1] 
        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[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_actor_mp($game_actors[actor_id], 0, 176)   
            draw_actor_param($game_actors[actor_id], 0, 196, 0)   
            draw_actor_param($game_actors[actor_id], 0, 216, 1)   
            draw_actor_param($game_actors[actor_id], 0, 236, 2)   
            draw_actor_param($game_actors[actor_id], 0, 256, 3)   
            draw_actor_param($game_actors[actor_id], 0, 276, 4)   
            draw_actor_param($game_actors[actor_id], 0, 296, 5)   
            draw_actor_param($game_actors[actor_id], self.width/2,196,6)   
            draw_actor_param($game_actors[actor_id], self.width/2,216,7)   
            draw_equipments(170, 0, $game_actors[actor_id]) 
        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[i], 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[i]       
                    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[i]       
                    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
  6. I updated the original post with the script formatted properly.