(XP) how to change Actor window battle command?

Discussion in 'RGSSx Script Support' started by kaigames, Mar 14, 2019.

  1. kaigames

    kaigames Villager Member

    Messages:
    11
    Likes Received:
    0
    First Language:
    Portuguese.BR
    Primarily Uses:
    RMXP
    hello, currently the standard rmxp battle system has this window:

    [​IMG]

    I'm trying to modify it to my liking but as I do not understand
    nothing about scripts, I'm having problems

    I'm trying something like this: (ps: merely illustrative images XD)

    [​IMG]

    if anyone knows how to edit this part, could you teach me?. sorry for my English
    .desde já agradeço
     
    Last edited: Mar 14, 2019
    #1
  2. DerVVulfman

    DerVVulfman Resident Werewolf Veteran

    Messages:
    221
    Likes Received:
    110
    First Language:
    English
    Primarily Uses:
    RMXP
    Years ago, a team of scripters worked upon a package they dubbed the RMXP.SDK. It was an attempt to encourage better coding techniques which could let scripts run together with less conflicts while rewriting the underlying system. It was a massive undertaking, inspired, but doomed as it only spread through the western world and it wasn't spread throughout all the forums. At the same time, they continually updated it so older 'compatible' scripts would not work with newer versions. I would love to point out that the RMXP SDK's 'Scene_Base' method existed roughly a year before RPGMaker VX's own 'Scene_Base'... rip off!!!!

    Now that the history lesson is over, now for the content.

    Below is a script from the RPGMaker SDK Version 2.4. It is a separate class that handles Horizontal command windows such as the one you wish to use:
    Code:
    #==============================================================================
    # ** Window_HorizCommand
    #------------------------------------------------------------------------------
    #  This window deals with general command choices. (Horizontal)
    #==============================================================================
    
    class Window_HorizCommand < Window_Selectable
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader   :commands
      attr_accessor :c_spacing
      attr_accessor :alignment
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(width, commands, c_spacing = (width - 32) / commands.size)
        # Compute window height from command quantity
        super(0, 0, width, 64)
        @commands     = commands
        @item_max     = commands.size
        @column_max   = @item_max
        @c_spacing    = c_spacing
        @alignment    = 1
        self.contents = Bitmap.new(@item_max * @c_spacing, height - 32)
        refresh
        self.index = 0
      end
      #--------------------------------------------------------------------------
      # * Command
      #--------------------------------------------------------------------------
      def command(index = self.index)
        return @commands[index]
      end
      #--------------------------------------------------------------------------
      # * Commands
      #--------------------------------------------------------------------------
      def commands=(commands)
        # Return if Commands Are Same
        return if @commands == commands
        # Reset Commands
        @commands = commands
        # Resets Item Max
        item_max    = @item_max
        @item_max   = @commands.size
        @column_max = @item_max
        # If Item Max Changes
        unless item_max == @item_max
          # Deletes Existing Contents (If Exist)
          unless self.contents.nil?
            self.contents.dispose
            self.contents = nil
          end
          # Recreates Contents
        self.contents = Bitmap.new(@item_max * @c_spacing, height - 32)
        end
        # Refresh Window
        refresh
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        for i in 0...@item_max
          draw_item(i, normal_color)
        end
      end
      #--------------------------------------------------------------------------
      # * Draw Item
      #--------------------------------------------------------------------------
      def draw_item(index, color)
        command = commands[index]
        x = index * @c_spacing + 4
        self.contents.font.color = color
        self.contents.draw_text(x, 0, @c_spacing - 8, 32, command, @alignment)
      end
      #--------------------------------------------------------------------------
      # * Disable Item
      #--------------------------------------------------------------------------
      def disable_item(index)
        draw_item(index, disabled_color)
      end
      #--------------------------------------------------------------------------
      # * Cursor Rectangle Update
      #--------------------------------------------------------------------------
      def update_cursor_rect
        if @index < 0
          self.cursor_rect.empty
        else
          self.cursor_rect.set(@c_spacing * @index, 0, @c_spacing, 32)
        end
      end
    end
    Now, the normal script to create a command window is typically:
    @command_window = Window_Command.new( window_width, [array of commands] )

    For example, the Title window would have thus:
    @command_window = Window_Command.new(192, [s1, s2, s3])

    But the new script to create a horizontal command window is this:
    @command_window = Window_Command.new( window_width, [array of commands], command_width )
    * The window width would be the value of the 'command_width' multiplied by the total number of commands, and with a '32' margin added.

    For example, a Title window with a Horizontal command window would use this:
    @command_window = Window_Command.new(512, [s1, s2, s3], 160)
    The 160 at the end indicates that each command_width option is 160px wide.
    As I have three options, the window_width is each 160px width X 3.... plus the 32px margin, or
    ( 160 x 3 ) + 32 .... or 512.

    So now you have this script to give you a Horizontal Command window, and a basic primer to use it. ^_^
     
    #2
    kaigames and CaRa_CrAzY like this.
  3. kaigames

    kaigames Villager Member

    Messages:
    11
    Likes Received:
    0
    First Language:
    Portuguese.BR
    Primarily Uses:
    RMXP
    I LOVE THIS FORUM THANK YOU :D
     
    #3

Share This Page