[VXA] Adding some infos to [LDS] Save Screen

Discussion in 'RGSSx Script Support' started by Tw0Face, Nov 25, 2019.

  1. Tw0Face

    Tw0Face Chief Executive Officer Veteran

    Messages:
    285
    Likes Received:
    307
    First Language:
    German
    Primarily Uses:
    RMVXA
    Hi. I was playing around with [LDS] Save Screen a bit. I've commented out some stuff I don't need and I was trying to add some infos; most of them given by custom variables. While editing the script and get some smart tweaks running, I actually remembered that I'm no Scripter and I've no clue what I'm doing at all. So I'm coming to you who can probably do much better than I can... because I can't.

    Here's what I have so far:

    [​IMG]

    Here's what I want to achieve:

    [​IMG]

    I made this edit using scrolling text event command. :rolleyes:

    Here's my current version of the script:

    Code:
    =begin
    =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    =*=*=*=*=*=*=*=*=*=*=*=*    [LDS] Save Screen       =*=*=*=*=*=*=*=*=*=*=*=*
    =*=*=*=*=*=*=*=*=*=*=*=* Date Created: 1/5/2013     =*=*=*=*=*=*=*=*=*=*=*=*
    =*=*=*=*=*=*=*=*=*=*=*=* Last Updated: 1/5/2013     =*=*=*=*=*=*=*=*=*=*=*=*
    =*=*=*=*=*=*=*=*=*=*=*=* Created by: Levi Stepp     =*=*=*=*=*=*=*=*=*=*=*=*
    =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
      __________________________________________________________________________
     /                                                                          \
    |      This save script allows you to view images on current saved files.    |
    |                        ~Up to 6 actors can be viewed~                      |
    |     This may be used in commercial projects, as long as you give credit.   |
     \__________________________________________________________________________/
                             ◆  There is no configuration. ◆
                                   ◆  PLUG N' PLAY   ◆
    =end
    #==============================================================================
    # ■ LDS_SAVE : Do not remove!
    #==============================================================================
    class LDS_SAVE
      #--------------------------------------------------------------------------
      # ● Variables
      #--------------------------------------------------------------------------
      attr_reader :name
      attr_reader :level
      attr_reader :hp
      attr_reader :mp
      attr_reader :mhp
      attr_reader :mmp
      attr_reader :face_name
      attr_reader :face_index
      #--------------------------------------------------------------------------
      # ● Object Initialization
      #--------------------------------------------------------------------------
      def initialize(actor)
        @name = actor.name
        @level = actor.level
        @hp = actor.hp; @mhp = actor.mhp
        @mp = actor.mp; @mmp = actor.mmp
        @face_name = actor.face_name
        @face_index = actor.face_index
        @dead = actor.dead?
      end
      #--------------------------------------------------------------------------
      # ● Non-Combat Check
      #--------------------------------------------------------------------------
      def dead?
        @dead
      end
      #--------------------------------------------------------------------------
      # ● HP Set
      #--------------------------------------------------------------------------
      def hp_rate
        @hp.to_f / @mhp
      end
      #--------------------------------------------------------------------------
      # ● MP Set
      #--------------------------------------------------------------------------
      def mp_rate
        @mmp > 0 ? @mp.to_f / @mmp : 0
      end
    end
     
    #==============================================================================
    # ■ Game_Party
    #==============================================================================
    class Game_Party < Game_Unit
      #--------------------------------------------------------------------------
      # ● Party Member Graphics
      #--------------------------------------------------------------------------
      def member_for_savefile
        members.collect { |actor| LDS_SAVE.new(actor) }
      end
    end
     
    #==============================================================================
    # ■ DataManager
    #==============================================================================
    class << DataManager
      #--------------------------------------------------------------------------
      # ● Create Location / Actors
      #--------------------------------------------------------------------------
      alias make_save_header_faces make_save_header
      def make_save_header
        header = make_save_header_faces
        header[:map_name] = $game_map.display_name
        #header[:map_name] = Vocab.get_mapname() #eingefügt von Tw0, oben auskommentiert.
        header[:actors] = $game_party.member_for_savefile
        header
      end
    end
     
     
    #==============================================================================
    # ■ Window_SaveFile
    #==============================================================================
    class Window_SaveFile < Window_Base
      #--------------------------------------------------------------------------
      # ● Object Initialization
      #     Index: Saved Files
      #--------------------------------------------------------------------------
      def initialize(height, index)
        super(0, index * height, window_width, height)
        @file_index = index
        refresh
        @selected = false
      end
      #--------------------------------------------------------------------------
      # ● Window Width
      #--------------------------------------------------------------------------
      def window_width
        return 134
      end
      #--------------------------------------------------------------------------
      # ● Refresh
      #--------------------------------------------------------------------------
      def refresh
        contents.clear
        change_color(normal_color)
        name = Vocab::File + " #{@file_index + 1}"
        draw_text(4, 0, 200, line_height, name)
        @name_width = text_size(name).width
      end
    end
     
    #==============================================================================
    # ■ Window_SaveFile
    #==============================================================================
    class Window_SaveInfo < Window_Selectable
      #--------------------------------------------------------------------------
      # ● Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x, h)
        @actors = []
        super(x, h, Graphics.width - x, Graphics.height - h)
        self.file_index = index
      end
      #--------------------------------------------------------------------------
      # ● Capture Height
      #--------------------------------------------------------------------------
      def item_height
        (contents_height - (line_height * 2)) / row_num
      end
      #--------------------------------------------------------------------------
      # ● Calculate Height of the Window
      #--------------------------------------------------------------------------
      def contents_height
        height - standard_padding * 2
      end
      #--------------------------------------------------------------------------
      # ● Rows
      #--------------------------------------------------------------------------
      def row_num
        return 3
      end
      #--------------------------------------------------------------------------
      # ● Getting Digits
      #--------------------------------------------------------------------------
      def col_max
        return 2
      end
      #--------------------------------------------------------------------------
      # ● Update the Bottom Padding
      #--------------------------------------------------------------------------
      def update_padding_bottom
      end
      #--------------------------------------------------------------------------
      # ● Gets the width of the blanks
      #--------------------------------------------------------------------------
      def spacing
        return 16
      end
      #--------------------------------------------------------------------------
      # ● Actor Limit
      #--------------------------------------------------------------------------
      def item_max
        return [@actors.size, 6].min
      end
      #--------------------------------------------------------------------------
      # ● File changes
      #--------------------------------------------------------------------------
      def file_index=(index)
        return if @file_index == index
        @file_index = index
        header = DataManager.load_header(@file_index)
        @actors   = !header.nil? ? header[:actors] : []
        @map_name = !header.nil? ? header[:map_name] : ""
        @playtime = !header.nil? ? header[:playtime_s] : ""
        create_contents
        refresh
      end
      #--------------------------------------------------------------------------
      # ● Refresh
      #--------------------------------------------------------------------------
      def refresh
        super
        if @actors.empty? or @actors.nil?
          #draw_text(0, 0, contents_width, contents_height, INFO::SPEICHER, 1)
          draw_text(0, 0, contents_width, contents_height, "empty slot", 1)
          return
        end
        draw_text(0, 0, contents_width, line_height, @map_name)
        draw_playtime(200, 0, contents_width - 200)
        draw_horz_line(line_height)
      end
      #--------------------------------------------------------------------------
      # ● Draw Item
      #--------------------------------------------------------------------------
      def draw_item(index)
        return if @actors.empty? or @actors.nil?
        actor = @actors[index]
        rect = item_rect(index)
        rect.y += line_height * 2
        #draw_actor_face(actor, rect.x, rect.y, !actor.dead?)
        #draw_actor_name(actor,  rect.x + 100, rect.y+line_height*0)
        #draw_actor_level(actor, rect.x + 100, rect.y+line_height*1)
        w = [124, rect.width - 100].min
        #draw_actor_hp(actor,   rect.x + 100, rect.y+line_height*2, w)
        #draw_actor_mp(actor,   rect.x + 100, rect.y+line_height*3, w)
      end
      #--------------------------------------------------------------------------
      # ● Draw Playtime
      #--------------------------------------------------------------------------
      def draw_playtime(x, y, width)
        draw_text(x, y, width, line_height, @playtime, 2)
      end
      #--------------------------------------------------------------------------
      # ● Draw a horizontal line
      #--------------------------------------------------------------------------
      def draw_horz_line(y)
        line_y = y + line_height / 2 - 1
        contents.fill_rect(0, line_y, contents_width, 2, line_color)
      end
      #--------------------------------------------------------------------------
      # ● Gets the color of the horizontal line
      #--------------------------------------------------------------------------
      def line_color
        color = normal_color
        color.alpha = 48
        color
      end
    end
     
    #==============================================================================
    # ■ Scene_File
    #==============================================================================
    class Scene_File < Scene_MenuBase
      #--------------------------------------------------------------------------
      # ● Create a save file window
      #--------------------------------------------------------------------------
      alias create_savefile_windows_save create_savefile_windows
      def create_savefile_windows
        create_savefile_windows_save
        @info_window = Window_SaveInfo.new(@savefile_windows[0].window_width, @help_window.height)
      end
      #--------------------------------------------------------------------------
      # ● Initialization of Selected State
      #--------------------------------------------------------------------------
      alias init_selection_save init_selection
      def init_selection
        init_selection_save
        @info_window.file_index = @index
      end
      #--------------------------------------------------------------------------
      # ● Get the number of save files that are displayed in the screen
      #--------------------------------------------------------------------------
      def visible_max
        return @savefile_viewport.rect.height / @help_window.height
      end
      #--------------------------------------------------------------------------
      # ● Cursor updates
      #--------------------------------------------------------------------------
      alias update_cursor_save update_cursor
      def update_cursor
        update_cursor_save
        @info_window.file_index = @index
      end
    end

    Maybe someone can help me adding these infos and maybe I can learn from you.

    Thanks. :smile:
     
    #1
  2. Ebanyle

    Ebanyle Veteran Veteran

    Messages:
    288
    Likes Received:
    165
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMVXA
    I managed to do a layout:
    Code:
    class Window_SaveInfo < Window_Selectable
      #--------------------------------------------------------------------------
      # ● Refresh
      #--------------------------------------------------------------------------
      def refresh
        super
        if @actors.empty? or @actors.nil?
          #draw_text(0, 0, contents_width, contents_height, INFO::SPEICHER, 1)
          draw_text(0, 0, contents_width, contents_height, "empty slot", 1)
          return
        end
        Marshal.load(Marshal.dump($game_variables))
        draw_text(0, 0, contents_width, line_height, @map_name)
        draw_playtime(200, 0, contents_width - 200)
        draw_horz_line(line_height)
        #Gold
        draw_icon(361, 0, line_height*2)
        draw_text(25, line_height*2, contents_width, line_height, Vocab::currency_unit)
        draw_text(-180, line_height*2, contents_width, line_height, $game_party.gold,2)
        #Variable 1
        draw_icon(10, 0, line_height*3)
        draw_text(25, line_height*3, contents_width, line_height, $data_system.variables[1])
        draw_text(-180, line_height*3, contents_width, line_height, $game_variables[1], 2)
        #Variable 2
        draw_icon(11, 0, line_height*4)
        draw_text(25, line_height*4, contents_width, line_height, $data_system.variables[2])
        draw_text(-180, line_height*4, contents_width, line_height, $game_variables[2],2)
        #Variable 3
        draw_icon(12, 0, line_height*5)
        draw_text(25, line_height*5, contents_width, line_height, $data_system.variables[3])
        draw_text(-180, line_height*5, contents_width, line_height, $game_variables[3],2)
        #Variable 4
        draw_icon(13, 0, line_height*6)
        draw_text(25, line_height*6, contents_width, line_height, $data_system.variables[4])
        draw_text(-180, line_height*6, contents_width, line_height, $game_variables[4],2)
        #Variable 5
        draw_icon(14, 0, line_height*7)
        draw_text(25, line_height*7, contents_width, line_height, $data_system.variables[5])
        draw_text(-180, line_height*7, contents_width, line_height, $game_variables[5],2)
      end
    end
    upload_2019-11-25_14-38-11.png

    But it will not show the specific values of the savefile :(
    Unfortunately I can't do more than that since I'm no scripter... It probably goes way beyond than that
     
    #2

Share This Page