Ergebnis 1 bis 20 von 20

Thema: Hilfe gesucht: HP Leiste vertikal im Menü anzeigen

Hybrid-Darstellung

Vorheriger Beitrag Vorheriger Beitrag   Nächster Beitrag Nächster Beitrag
  1. #1

    Hilfe gesucht: HP Leiste vertikal im Menü anzeigen

    Hallo Community,

    ich suche Hilfe, denn ich versuche seit Tagen erfolglos, die HP Leiste im Menü vertikal wie auf der Abbildung anzuzeigen.

    Ich verwende das Pac!-Menü, unten in den Spoilern zu finden.

    Mag jemand helfen? Ich bekomme nur Errors

    Code:
    #===============================================================================
    #
    # PAC Main Menu Ace (1.2)
    # 15/7/2012
    # By Pacman
    #
    #===============================================================================
    #
    # This is the PAC Main Menu converted to VX Ace. On a basic level, this offers
    # a configurable setup for your main menu, allowing the user to create, alter
    # and move the position of menu commands at their pleasure. It can be used
    # very simply to merely reorder the default commands, or to its' fullest
    # potential, that is creating commands to put custom scenes into the menu. It
    # also offers two graphical features: adding an EXP gauge into the menu status
    # window, and adding icons into the command display. Both are optional and
    # customizable.
    #
    #===============================================================================
    #
    #   ~! INSTALLATION !~
    # Paste above Main, below Materials. I suggest you paste this high up in your
    # custom scripts list, for technical reasons considering overwriting methods.
    # There are details for configuration below.
    #
    #===============================================================================
    #
    #   ~! DO NOT HESITATE TO ASK FOR HELP !~
    # This can get very confusing, and there is so much you can do with this, so if
    # you would like to know anything, just ask.
    #
    #===============================================================================
    #--------------------
    module PAC; module MM # <- Do not touch.
      #------------------
      # How to set up your menu commands:
      # Below is the COMMANDS array, which holds all the commands for the menu in
      # it. Within the array is a set of more arrays. Each array represents one
      # command. These command arrays can contain 5 elements, which each give a
      # piece of information to the script that sets up the menu. Note that each
      # element must be followed by a comma or an error will occur. Make sure that
      # each array begins with an open square bracket ([) and a close square bracket
      # (]).
      #----------
      # Element 1 - The Name
      # The first element of each array is the name that is displayed for that
      # command on the menu. It must be written in quotation marks ('' or "").
      #----------
      # Element 2 - The Method
      # The second element of each array is the name of the method that is executed
      # when the command is selected. The method must be located in the Scene_Menu
      # class. If you are planning on using this in tandem with a custom script's
      # scene, you should try and find the methods necessary to open that scene.
      # If a scene requires actor selection (Skill, Equip, etc.), put
      # "command_personal" as the method and set the scene in element 5.
      #----------
      # Element 3 - The Icon
      # The third element of each array is a number: the index of the icon to be
      # displayed in the menu window. The index is the number displayed at the
      # bottom-left of the icon selection window.
      #----------
      # Element 4 - The Disable Method
      # The fourth element of each array is a condition which, if met, disables
      # the command associated with it. The method must be located in the Scene_Menu
      # class, or accessible otherwise. To disable a command with a switch, use:
      # "$game_switches[x]" which will disable the command when switch with ID x is
      # on. To do the same with a variable, use:
      # "$game_variables[x] <=> n" which will disable the command when variable with
      # ID x is <=> to n.
      # This element can be ommited, or simply written as nil if you don't want one.
      # It must be there if you wish to include the fifth element though.
      #----------
      # Element 5 - The Scene Call
      # The fifth element (teehee) of each array is only required if the second
      # element is set to 'command_personal'. It is the command to be executed upon
      # actor selection. This is required for scenes that are specific to actors,
      # namely Skill, Equip, Status and any custom scenes that are similar.
      #----------
      # If you have any inquiries on how to use these elements in the most effective
      # way possible, or at all, ask away.
      #----------
      COMMANDS = [  # <- Do not touch
      #----------
        ['Inventory',             # Command Name
        'command_item',           # Command Method
        270,                      # Command Icon
        'main_commands_enabled'], # Disable Method
      #----------
        ['Skill Menu',
        'command_ownskillmenu',
        112,
        'main_commands_enabled',
        'SceneManager.call(LDT_Skill_Scene)'],  # Scene Call.
      #----------
         ['Load Game',
        'command_customload',
        117,
        'load_enabled'],
      #----------
        ['Save Game',
        'command_save',
        117,
        'save_enabled'],
      #----------
        ['Options',
        'command_game_end',
        6]
      #----------
      ] # <- Do not touch.
      #------------------
      Exp_Gauge = false  # Use the EXP Gauge?
      Exp_Color1 = "text_color(30)" # Color 1 for EXP gauge.
      Exp_Color2 = "text_color(31)" # Color 2 for EXP gauge.
      Exp_a = "EXP" # Text displayed on the EXP Gauge.
      Icons = true  # Use icons in the menu display?
      ALIGNMENT = 0 # Alignment of menu command text. 0 for left, 1 for center, 2
      # for right.
      Map_Window = false   # Use the map window in the menu display?
      Time_Window = false  # Use the time window in the menu display?
      Time_Height = 1     # Height of the time window.
      Gold_Window = true  # Use the gold window in the menu display
      Gold_Correction = true  # Correct the gold window's y value to fit in?
      Windows_Pos = :left # Command, gold, map and time window orientation. :left
      # or :right. Anything else will go to :left.
      Heal_Button = :F5 # Button to fully heal the party in the menu. Set to nil if
      # you don't want that. It will also clear all statuses. Only in test play, of
      # course.
    #--------------------
    end; end
    #--------------------
     
    #===============================================================================
    #
    # END OF CONFIGURATION
    #
    #==============================================================================
    # ** Game_System
    #------------------------------------------------------------------------------
    #  This class handles system data. It saves the disable state of saving and
    # menus. Instances of this class are referenced by $game_system.
    #==============================================================================
     
    class Game_System
      #--------------------------------------------------------------------------
      # Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :menu_index, :menu_actor_selection
      #--------------------------------------------------------------------------
      # Alias listing
      #--------------------------------------------------------------------------
      alias pac_mm_gsys_ini initialize
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(*args)
        pac_mm_gsys_ini(*args)
        @menu_index = 0
        @menu_actor_selection = false
      end
    end
     
    #==============================================================================
    # ** Window_Base
    #------------------------------------------------------------------------------
    #  This is a super class of all windows within the game.
    #==============================================================================
     
    if PAC::MM::Exp_Gauge
    class Window_Base < Window
      #--------------------------------------------------------------------------
      # Alias Listing
      #--------------------------------------------------------------------------
      alias pac_mm_wnbs_simsta draw_actor_simple_status if PAC::MM::Exp_Gauge
      #--------------------------------------------------------------------------
      # * Get Text Colors (writing color without the u is killing me)
      #--------------------------------------------------------------------------
      def exp_gauge_color1; eval PAC::MM::Exp_Color1 rescue text_color(30); end
      def exp_gauge_color2; eval PAC::MM::Exp_Color2 rescue text_color(31); end
      #--------------------------------------------------------------------------
      # * Draw EXP
      #--------------------------------------------------------------------------
      def draw_actor_exp(actor, x, y, width = 60)
        draw_gauge(x, y, width, actor.final_exp_rate, exp_gauge_color1,
         exp_gauge_color2)
        change_color(system_color)
        draw_text(x, y, 30, line_height, PAC::MM::Exp_a)
        draw_current_and_max_values(x, y, width, actor.exp, actor.next_level_exp,
          normal_color, normal_color)
      end
      #--------------------------------------------------------------------------
      # * Draw Simple Status
      #--------------------------------------------------------------------------
      def draw_actor_simple_status(actor, x, y, *args)
        pac_mm_wnbs_simsta(actor, x, y, *args)
        draw_actor_exp(actor, x + 58, y + line_height)
      end
    end
    end
     
    #==============================================================================
    # ** Window_MenuStatus
    #------------------------------------------------------------------------------
    #  This window displays the map name on the menu screen.
    #==============================================================================
     
    class Window_MenuMap < Window_Base
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x, y)
        super(x, y, window_width, fitting_height(1))
        refresh
      end
      #--------------------------------------------------------------------------
      # * Get Window Width
      #--------------------------------------------------------------------------
      def window_width
        return 160
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        contents.clear
        change_color(normal_color)
        unless $game_map.display_name.empty?
          draw_text(contents.rect, $game_map.display_name, 1)
        end
      end
    end
     
    #==============================================================================
    # ** Window_Time
    #------------------------------------------------------------------------------
    #  This window displays play time on the menu screen.
    #==============================================================================
     
    class Window_Time < Window_Base
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x, y)
        super(x, y, window_width, fitting_height(PAC::MM::Time_Height || 1))
        refresh
      end
      #--------------------------------------------------------------------------
      # * Get Window Width
      #--------------------------------------------------------------------------
      def window_width
        return 160
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        contents.clear
        @time = Graphics.frame_count / Graphics.frame_rate
        hour = @time / 3600
        min = @time / 60 % 60
        sec = @time % 60
        text = sprintf("%02d:%02d:%02d", hour, min, sec)
        change_color(normal_color)
        draw_text(contents.rect, text, 1)
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        super
        refresh if Graphics.frame_count / Graphics.frame_rate != @time
      end
    end
     
    #==============================================================================
    # ** Window_MenuCommand
    #------------------------------------------------------------------------------
    #  This command window appears on the menu screen.
    #==============================================================================
     
    class Window_MenuCommand < Window_Command
      #--------------------------------------------------------------------------
      # * Initialize Command Selection Position (Class Method)
      #--------------------------------------------------------------------------
      def self.init_command_position(*args)
        @@last_command_symbol ||= nil
      end
      #--------------------------------------------------------------------------
      # * Create Command List
      #--------------------------------------------------------------------------
      def make_command_list(*args)
        PAC::MM::COMMANDS.each {|c| add_command(c[0], c[0].to_sym, pac_disable(c))}
      end
      #--------------------------------------------------------------------------
      # * Disable PAC Command
      #--------------------------------------------------------------------------
      def pac_disable(command)
        command[3] || ''
      end
      #--------------------------------------------------------------------------
      # * Draw Item
      #--------------------------------------------------------------------------
      def draw_item(index, *args)
        rect = item_rect_for_text(index)
        if PAC::MM::Icons && PAC::MM::COMMANDS[index][2] != nil
          irect = item_rect(index)
          draw_icon(PAC::MM::COMMANDS[index][2], irect.x, irect.y)
          rect.x += 24
        end
        change_color(normal_color, command_enabled?(index))
        draw_text(rect, command_name(index), PAC::MM::ALIGNMENT)
      end
    end
     
    #==============================================================================
    # ** Scene_Menu
    #------------------------------------------------------------------------------
    #  This class performs the menu screen processing.
    #==============================================================================
     
    class Scene_Menu < Scene_MenuBase
      #--------------------------------------------------------------------------
      # Alias listing
      #--------------------------------------------------------------------------
      alias pac_mm_start  start
      alias pac_mm_update update
      alias pac_mm_cgw    create_gold_window if PAC::MM::Gold_Correction
      alias pac_mm_opc    on_personal_cancel
      #--------------------------------------------------------------------------
      # * Start Processing
      #--------------------------------------------------------------------------
      def start(*args)
        pac_mm_start
        @@start_personal ||= false
        if @@start_personal; @command_window.deactivate; command_personal; end
        if PAC::MM::Windows_Pos == :right
          @gold_window.x = Graphics.width-@gold_window.width if @gold_window != nil
          @status_window.x = 0
        end
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update(*args)
        pac_mm_update(*args)
        update_heal
      end
      #--------------------------------------------------------------------------
      # * Update Heal Butten
      #--------------------------------------------------------------------------
      def update_heal # BUTTEN
        if $TEST && PAC::MM::Heal_Button != nil &&
         Input.trigger?(PAC::MM::Heal_Button)
          Sound.play_recovery
          $game_party.members do |actor| actor.recover_all end
        end
      end
      #--------------------------------------------------------------------------
      # * Create Command Window
      #--------------------------------------------------------------------------
      def create_command_window(*args)
        @command_window = Window_MenuCommand.new
        PAC::MM::COMMANDS.each {|c|
          @command_window.set_handler(c[0].to_sym, pac_method(c))
        }
        @command_window.set_handler(:cancel, method(:return_scene))
        if PAC::MM::Windows_Pos == :right
          @command_window.x = Graphics.width - @command_window.width
        end
        create_map_window
        create_time_window
      end
      #--------------------------------------------------------------------------
      # * Create Gold Window
      #--------------------------------------------------------------------------
      if PAC::MM::Gold_Correction; def create_gold_window(*args)
        pac_mm_cgw(*args)
        @gold_window.visible = false if !PAC::MM::Gold_Window
        y = @command_window.height
        y += @map_window.height if @map_window
        y += @time_window.height if @time_window
        @gold_window.y = y
      end; end
      #--------------------------------------------------------------------------
      # * Create Map Window
      #--------------------------------------------------------------------------
      def create_map_window
        x = PAC::MM::Windows_Pos ==:right ? Graphics.width-@command_window.width : 0
        @map_window = Window_MenuMap.new(x, @command_window.height)
        @map_window.visible = false if !PAC::MM::Map_Window
      end
      #--------------------------------------------------------------------------
      # * Create Time Window
      #--------------------------------------------------------------------------
      def create_time_window
        x = PAC::MM::Windows_Pos ==:right ? Graphics.width-@command_window.width : 0
        y = @map_window.nil? ? @command_window.height : @map_window.height +
         @map_window.y
        @time_window = Window_Time.new(x, y)
        @time_window.visible = false if !PAC::MM::Time_Window
      end
      #--------------------------------------------------------------------------
      # * Get Method for Command
      #--------------------------------------------------------------------------
      def pac_method(command)
        method(command[1] || '')
      end
      #--------------------------------------------------------------------------
      # * [OK] Personal Command
      #--------------------------------------------------------------------------
      def on_personal_ok(*args)
        @@start_personal = true
        eval(PAC::MM::COMMANDS[@command_window.index][4]) rescue nil
      end
      #--------------------------------------------------------------------------
      # * [Cancel] Personal Command
      #--------------------------------------------------------------------------
      def on_personal_cancel(*args)
        pac_mm_opc(*args)
        @command_window.activate
        @@start_personal = false
      end
    end
     
    ($pac ||= {})[:main_menu] = 1.2
     
    #===============================================================================
    #
    # END OF SCRIPT
    #
    #===============================================================================
    Code:
    #===============================================================================
    #
    # PAC Main Menu Ace - Compact Display Addon (1.0)
    # 16/7/2012
    # By Pacman
    #
    #===============================================================================
    #
    # This is the Compact Display Addon for the PAC Main Menu Ace. This script
    # requires PAC Main Menu Ace to work. This is a graphical change to the menu,
    # "compacting" the menu screen to only display the status window when required.
    # The extra windows (the gold, map and playtime windows) can now by closed by
    # pressing a designated button.
    #
    #===============================================================================
    #------------------------------------
    module PAC; module MM; module Compact # <- Do not touch.
      #----------------------------------
      Use_Compact = true  # Use the compact menu?
      Show_Extras = true  # Show the extra display windows when the menu opens?
      Show_Button = :X    # Button used to open and close the extra windows.
      Move_Speed = 10      # Number of pixels per second the windows move when
                          # sliding.
    #------------------------------------
    end; end; end
    #------------------------------------
     
    #===============================================================================
    #
    # END OF CONFIGURATION
    #
    #===============================================================================
     
    if PAC::MM::Compact::Use_Compact
    if !($pac ||= {})[:main_menu] || $pac[:main_menu] < 1.2
      msgbox "You require the PAC MM 1.2 base script to use the Compact Addon."
      exit
    end
     
    #==============================================================================
    # ** Game_System
    #------------------------------------------------------------------------------
    #  This class handles system data. It saves the disable state of saving and
    # menus. Instances of this class are referenced by $game_system.
    #==============================================================================
     
    class Game_System
      #--------------------------------------------------------------------------
      # Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :menu_window_vis
      #--------------------------------------------------------------------------
      # Alias listing
      #--------------------------------------------------------------------------
      alias pac_mmc_initialize initialize
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(*args)
        pac_mmc_initialize(*args)
        @menu_window_vis = PAC::MM::Compact::Show_Extras
      end
    end
     
    #==============================================================================
    # ** Scene_Menu
    #------------------------------------------------------------------------------
    #  This class performs the menu screen processing.
    #==============================================================================
     
    class Scene_Menu < Scene_MenuBase
      #--------------------------------------------------------------------------
      # Alias listing
      #--------------------------------------------------------------------------
      alias pac_mmc_start start
      alias pac_mmc_comper command_personal
      alias pac_mmc_comfor command_formation
      alias pac_mmc_opc on_personal_cancel
      alias pac_mmc_ofc on_formation_cancel
      alias pac_mmc_update update
      #--------------------------------------------------------------------------
      # * Start Processing
      #--------------------------------------------------------------------------
      def start(*args)
        #----------- Original Method
        pac_mmc_start(*args)
        #----------- Setup window visibility
        if $game_system.menu_window_vis == false
          @gold_window.openness = @time_window.openness = @map_window.openness = 0
        end
        #----------- Setup window coordinates (y)
        @command_window.y = (Graphics.height - @command_window.height) / 400
        @map_window.y = @command_window.height + @command_window.y
        @gold_window.y = @map_window.y
        @gold_window.y += @map_window.height if PAC::MM::Map_Window
        @time_window.y = @command_window.y - @time_window.height
        #----------- Setup window coordinates (x)
        @windows = [@command_window, @gold_window, @time_window, @map_window]
        unless @@start_personal
          @status_window.hide
          @status_window.openness = 0
          @windows.each do |window| window.x = (Graphics.width -
           @command_window.width) / 400 end
        else
          @windows.each do |window| window.x = PAC::MM::Windows_Pos == :right ?
           Graphics.width - @command_window.width : 0 end
        end
      end
      #--------------------------------------------------------------------------
      # * [Skill], [Equipment] and [Status] Commands
      #--------------------------------------------------------------------------
      def command_personal(*args)
        pac_mmc_open_status
        pac_mmc_comper(*args)
      end
      #--------------------------------------------------------------------------
      # * [Cancel] Personal Command
      #--------------------------------------------------------------------------
      def on_personal_cancel(*args)
        pac_mmc_close_status
        pac_mmc_opc(*args)
      end
      #--------------------------------------------------------------------------
      # * [Formation] Command
      #--------------------------------------------------------------------------
      def command_formation(*args)
        pac_mmc_open_status
        pac_mmc_comfor(*args)
      end
      #--------------------------------------------------------------------------
      # * Formation [Cancel]
      #--------------------------------------------------------------------------
      def on_formation_cancel(*args)
        pac_mmc_close_status
        pac_mmc_ofc(*args)
      end
      #--------------------------------------------------------------------------
      # * Open Status Window
      #--------------------------------------------------------------------------
      def pac_mmc_open_status
        c = 0
        c = Graphics.width - @command_window.width if PAC::MM::Windows_Pos == :right
        unless @command_window.x == c
          s = PAC::MM::Compact::Move_Speed
          s *= -1 if PAC::MM::Windows_Pos != :right
          c = 0
        c = Graphics.width - @command_window.width if PAC::MM::Windows_Pos == :right
          begin
            @windows.each do |window| window.x += s end
            Graphics.update
          end until PAC::MM::Windows_Pos == :right ? @command_window.x >= c :
           @command_window.x <= c
          @windows.each do |window| window.x = c end
        end
        @status_window.show if @status_window.visible == false
        @status_window.open if @status_window.openness == 0
      end
      #--------------------------------------------------------------------------
      # * Close Status Window
      #--------------------------------------------------------------------------
      def pac_mmc_close_status
        @status_window.close
        begin; @status_window.update; Graphics.update
        end until @status_window.openness == 0
        s = PAC::MM::Compact::Move_Speed
        s *= -1 if PAC::MM::Windows_Pos == :right
        c = (Graphics.width - @command_window.width) / 2
        begin
          @windows.each do |window| window.x += s end
          Graphics.update
        end until PAC::MM::Windows_Pos == :right ? @command_window.x <= c :
         @command_window.x >= c
        @windows.each do |window| window.x = c end
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update(*args)
        pac_mmc_update(*args)
        update_window_vis
      end
      #--------------------------------------------------------------------------
      # * Update Window Visibility
      #--------------------------------------------------------------------------
      def update_window_vis
        if PAC::MM::Compact::Show_Button != nil &&
         Input.trigger?(PAC::MM::Compact::Show_Button)
          Sound.play_cursor
          win = [@gold_window, @map_window, @time_window]
          if @gold_window.open?
            win.each do |window| window.close end
            $game_system.menu_window_vis = false
          else
            win.each do |window| window.open end
            $game_system.menu_window_vis = true
          end
        end
      end
    end
     
    $pac[:compact] = 1.0
     
    end
     
    #===============================================================================
    #
    # END OF SCRIPT
    #
    #===============================================================================
    Miniaturansichten angehängter Grafiken Miniaturansichten angehängter Grafiken Unbenannt.png  

    Geändert von Ken der Kot (08.03.2018 um 19:50 Uhr)

  2. #2
    Ist die HP-Leiste teil des PAC-Menüs? Oder versuchst du die selbst hinzuzufügen?
    Was hast du versucht und was für Errors bekommst du?

  3. #3
    Nein, die Leiste ist kein Teil des Pac Menüs, ich versuche vielmehr eine HP Leiste wie oben gezeigt in das Script mit einzufügen. Sodass sie erscheint (und nur dann) wenn das Menü aufgerufen wird. Wenn ich das Menü mit escape wieder schließe soll sie verschwinden. Was ich versucht habe: HP-Leisten aus anderen Scripts in das Script zu copypasten und Klassen und Methoden hinzuzufügen, die sie callen sollen. Ich hab echt kein blassen Schimmer wie man das macht und was ich da überhaupt mache. Und wenn ich eine HP Leiste als extrernes Script anzeigen lasse, verschwindet sie immer hinter dem schwarzen (unscharfen) Background.

  4. #4
    Poste das Script bitte nochmal und stelle dabei die Smileys vorher aus, damit ich mir das in den Maker reinkopieren kann. Dann schau ich bei Zeiten mal rein.

  5. #5
    Uuupsi gar nicht gesehen. Hab mal den Code-Tag stattdessen benutzt. Danke

  6. #6
    Füge unter PAC ein neues, leeres Script ein, und kopiere folgenden Code rein:
    Code:
    ######
    # PAC - HP Bar Addon
    # Author: Linkey D. T.
    # Date: 08.03.2018
    ######
    class Scene_Menu < Scene_MenuBase
      alias ldt_create_command_window create_command_window
      def create_command_window(*args)
        ldt_create_command_window(*args)
        create_hp_bar_window
      end
          
    
      def create_hp_bar_window
        @hp_bar_window = LDT_Window_HPBar.new(@command_window.width,0,@command_window.height)
      end
      
      def update_hp_bar_window
        thp = $game_actors[1].hp
        thp_max = $game_actors[1].mhp
        @hp_bar_window.set_hp(thp,thp_max)
      end
    end
    
    
    ####
    # HP Bar Window
    # Author: Linkey D. T.
    # Date: 08.03.2018
    ####
    class LDT_Window_HPBar < Window_Base
      HP_WIDTH = 20
      HP_HEIGHT = 100
      
      BORDER_WIDTH = 4
      BORDER_COLOR = 1
      HP_COLOR = 3
      BACKGROUND_COLOR = 2
      
      def initialize(x,y,th=nil)
        @hp_height = th ? th : HP_HEIGHT
        @hp_height = @hp_height - BORDER_WIDTH*2
        super(x,y,HP_WIDTH+BORDER_WIDTH*2,@hp_height+BORDER_WIDTH*2)
        @hp = 0
        @max_hp = 0
      end
      
      def set_hp(hp,maxhp)
        trefresh = (hp != @hp || maxhp != @max_hp) ? true : false
        @hp = hp + 0.0
        @max_hp = maxhp + 0.0
        refresh if(trefresh)
      end
      
      def refresh
        contents.clear
        th = (@hp / @max_hp * @hp_height).to_i
        ty2 = @hp_height - th
        contents.fill_rect(BORDER_WIDTH, BORDER_WIDTH, HP_WIDTH, @hp_height, text_color(BACKGROUND_COLOR))
        contents.fill_rect(BORDER_WIDTH, BORDER_WIDTH + ty2, HP_WIDTH, th, text_color(HP_COLOR))
      end
      
      def standard_padding
        return 0
      end
    end

  7. #7
    Du bist echt schnell, vielen Dank. Der Balken ist nur leider leer. Hab jede Farbe ausprobiert und anschließend alle Scripte nacheinander testweise entfernt um zu schauen ob da was nicht miteinander funktioniert. Aber der Balken bleibt leer. Wie zeige ich die Farbe denn an?

  8. #8
    So wie ich es hier reinkopiert habe, ist der Balken grün (wenn HP voll), rot (der Teil der HP, der nicht gefüllt ist) und weiß (die Ränder).
    Hast du dir denn auch selbst HP abgezogen, um das zu testen?

    Ansonsten, was zu beachten ist: Die PAC-Scripte müssen über dem stehen, was ich dir geschickt habe.

    Sollte es dennoch nicht funktionieren, kannst du mir auch ein test-projekt schicken, in welches du alle scripts, die du benutzt, in gleicher reihenfolge reinkopierst. Dann kann ich mir das einmal anschauen.

    EDIT:
    Mein Fehler. Hatte die Update-Methode, warum auch immer, hier nicht mit reinkopiert (hatte die bei mir im Projekt noch auf einer anderen Scriptseite rumfliegen):
    Code:
    def update(*args)
        pac_mm_update(*args)
        update_hp_bar_window
        update_heal
      end
    Sollte dann so aussehen:
    Code:
    ######
    # PAC - HP Bar Addon
    # Author: Linkey D. T.
    # Date: 08.03.2018
    ######
    class Scene_Menu < Scene_MenuBase
      def update(*args)
        pac_mm_update(*args)
        update_hp_bar_window
        update_heal
      end
      
      alias ldt_create_command_window create_command_window
      def create_command_window(*args)
        ldt_create_command_window(*args)
        create_hp_bar_window
      end
          
    
      def create_hp_bar_window
        @hp_bar_window = LDT_Window_HPBar.new(@command_window.width,0,@command_window.height)
      end
      
      def update_hp_bar_window
        thp = $game_actors[1].hp
        thp_max = $game_actors[1].mhp
        @hp_bar_window.set_hp(thp,thp_max)
      end
    end
    
    
    ####
    # HP Bar Window
    # Author: Linkey D. T.
    # Date: 08.03.2018
    ####
    class LDT_Window_HPBar < Window_Base
      HP_WIDTH = 20
      HP_HEIGHT = 100
      
      BORDER_WIDTH = 4
      BORDER_COLOR = 1
      HP_COLOR = 3
      BACKGROUND_COLOR = 2
      
      def initialize(x,y,th=nil)
        @hp_height = th ? th : HP_HEIGHT
        @hp_height = @hp_height - BORDER_WIDTH*2
        super(x,y,HP_WIDTH+BORDER_WIDTH*2,@hp_height+BORDER_WIDTH*2)
        @hp = 0
        @max_hp = 0
      end
      
      def set_hp(hp,maxhp)
        trefresh = (hp != @hp || maxhp != @max_hp) ? true : false
        @hp = hp + 0.0
        @max_hp = maxhp + 0.0
        refresh if(trefresh)
      end
      
      def refresh
        contents.clear
        th = (@hp / @max_hp * @hp_height).to_i
        ty2 = @hp_height - th
        contents.fill_rect(BORDER_WIDTH, BORDER_WIDTH, HP_WIDTH, @hp_height, text_color(BACKGROUND_COLOR))
        contents.fill_rect(BORDER_WIDTH, BORDER_WIDTH + ty2, HP_WIDTH, th, text_color(HP_COLOR))
      end
      
      def standard_padding
        return 0
      end
    end

    Geändert von Linkey (09.03.2018 um 12:37 Uhr)

  9. #9
    Hab deine pm bekommen. Es tut! Danke!

    Die "Füllung" der HP erscheint nur sehr zeitverzögert nach dem Aufrufen des Menüs. Lässt sich das möglicherweise noch durch irgendeinen Zusatzbefehl beschleunigen? Könnte an der refresh Methode liegen. Beim verlassen von Untermenüs (Items) baut sich die Füllung ebenso zeitverzögert auf.

  10. #10
    Natürlich. Pack noch in diese Zeile in die create methode: update_hp_bar_window
    Code:
    def create_hp_bar_window
        @hp_bar_window = LDT_Window_HPBar.new(@command_window.width,0,@command_window.height)
        update_hp_bar_window
      end
    Ging davon aus, dass die Update-Methode so oder so immediately aufgerufen wird. Scheinbar aber erst nach einigen Frames.

  11. #11
    Du bist genial! Nun ist mein Menü endlich komplett und ich kann mich an die kosmetischen Sachen (Icons) machen. Danke dir sehr!!!

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •