[RGSS] Criando uma HUD usando o Window Scene Wizard 2(Traduzido)

    Compartilhe
    avatar
    jiraya
    Administrador
    Administrador

    Mensagens : 1299
    Credibilidade : 54

    [RGSS] Criando uma HUD usando o Window Scene Wizard 2(Traduzido)

    Mensagem por jiraya em Dom Maio 27, 2012 12:32 am

    [Autor=dodoop]

    Criando uma HUD usando o Window Scene Wizard 2(Traduzido)

    Perguntas frequentes:

    O que é HUD?
    R:È uma janela que fica na tela monstrando o HP,SP em outras coisas do personagem.

    O que é Window Scene Wizard?
    R:È um conjunto de scripts que acaba criando um programa que cria scripts.

    O que é WSW?
    R:Window Scene Wizard.

    Qual é o seu objetivo em estar nos ensinando isso?Por que voce está nos encinando isso sendo que voce pode ficar sem nos encinar e ficar criando HUD pro seu game?
    R:Porque eu quero ajudar aos makers.Eu sei como é querer criar um script sem saber RGSS porque eu não sabia RGSS antes.

    Introdução:
    Eu vou encinar a criar uma HUD usando o Window Scene Wizard 2 traduzido pelo Aderson Porto por isso deem bastante créditos a ele.

    Créditos:
    dodoop:(eu)Por criar esse tutorial.
    Aderson Porto:Por traduzir o Window Scene Wizard 2 do qual iremos usar para criar a HUD e ter juntado uns scripts que estão na demo do WSW e são necesarios para os scripts criados no WSW rodarem.

    Tutorial:
    1.Primeiro voce tem que baixar o Window Scene Wizard 2(traduzido) voce pode baixar ele nesse link:
    http://www.4shared.com/file/18980368/e3074768/Window_Scene_Wizard_2.html

    2.Após ter baixado o WSW(Window Scene Wizard) abra ele normalmente como se voce fosse jogar um jogo criando no RMXP e com demo encriptada.

    3.Clik em: Nova_Escene.

    4.Click em adicionar iten.

    5.Após ter clikado em adicionar iten vá em Janela Normal.

    6.Será criada uma janela nela coloque o que voce quizer barra de HP,SP...

    7.Voce deve ter criado uma janela como algo do tipo:


    8.Coloque o nome na janela de HUD e clike em Gerar Script e feche o WSW!

    9.Abra a pasta onde está o WSW lá voce vai ver que o WSW criou 2 scripts cada 1 sauvo em 1 bloco de notas.

    10.Apague o bloco de notas que esta escrito Nova_Scene pois nós não vamos precisar desse script.

    11.Vá no RMXP ou no seu projeto e coloque esse script:

    Obs:Voce deve copiar a pasta Gradients que está dentro da pasta Graphics do WSW e colar no na pasta Graphics do seu projeto.

    Obs2:Acho melhor voce criar um pojeto novo e testar primeiro eu não me reponsabilizo se o seu projeto começar a dar erros!
    Código:
    #==============================================================================
    # ** Window_Base
    #------------------------------------------------------------------------------
    #  This class is for all in-game windows.
    #==============================================================================
    class Window_Base
      attr_accessor :content
      attr_accessor :name
      attr_accessor :variable
      attr_accessor :windowskin_name
      attr_accessor :help_text
      attr_reader  :background_name
      #--------------------------------------------------------------------------
      # * Object Initialization
      #    x      : window x-coordinate
      #    y      : window y-coordinate
      #    width  : window width
      #    height : window height
      #--------------------------------------------------------------------------
      alias mr_mo_wiz_int initialize
      def initialize(x, y, width, height)
        mr_mo_wiz_int(x, y, width, height)
        @content = []
        @variable = "@"
        @name = ""
        @background_name = "None"
        @background = Sprite.new
        @background.x = self.x
        @background.y = self.y
        @background.z += self.z
        @help_text = ""
        #Contetnt Varaibles
        @pictures = {}
      end
      #--------------------------------------------------------------------------
      # * Add Text(text, x, y, width, height, Font size, color)
      #--------------------------------------------------------------------------
      def add_text(text,x,y,w,h,size,color,b,i)
        self.contents.font.color = color
        self.contents.font.size = size
        self.contents.font.bold = b
        self.contents.font.italic = i
        self.contents.draw_text(x, y, w, h, text)
      end
      #--------------------------------------------------------------------------
      # * Add Picture
      #--------------------------------------------------------------------------
      def add_picture(name,x,y,w=nil,h=nil)
        bmp = RPG::Cache.picture(name)
        w = bmp.width if w == nil
        h = bmp.height if h == nil
        src_rect = Rect.new(0, 0, w, h)
        self.contents.blt(x, y, bmp, src_rect)
      end
      #--------------------------------------------------------------------------
      # * Add Character Set
      #--------------------------------------------------------------------------
      def add_characterset(name,x,y,dir=2,h=0,w=0,hue=0)
        bmp = RPG::Cache.character(name, hue)
        cw = bmp.width / 4
        ch = bmp.height / 4
        if dir == 0
          cw = h
          ch = w
          yy = 0
        else
          d = (dir == 2 ? 1 : 0)
          yy = ch * ((dir/2)-d)
        end
        src_rect = Rect.new(0, yy, cw, ch)
        self.contents.blt(x, y, bmp, src_rect)
      end
      #--------------------------------------------------------------------------
      # * Add Battler
      #--------------------------------------------------------------------------
      def add_battler(name,x,y,w,h,hue=0)
        bmp = RPG::Cache.battler(name,hue)
        src_rect = Rect.new(0, 0, w, h)
        self.contents.blt(x, y, bmp, src_rect)
      end
      #--------------------------------------------------------------------------
      # * Add Icon
      #--------------------------------------------------------------------------
      def add_icon(name,x,y,w,h)
        bmp = RPG::Cache.icon(name)
        src_rect = Rect.new(0, 0, w, h)
        self.contents.blt(x, y, bmp, src_rect)
      end
      #--------------------------------------------------------------------------
      # * Add Background
      #--------------------------------------------------------------------------
      def background=(bg)
        @background_name = bg
        if bg == "None"
          @background.dispose
          @background = Sprite.new
          return
        end
        bmp = RPG::Cache.picture(bg)
        @background.bitmap = bmp
      end
      #--------------------------------------------------------------------------
      # * Draw HP
      #    actor : actor
      #    x    : draw spot x-coordinate
      #    y    : draw spot y-coordinate
      #    width : draw spot width
      #--------------------------------------------------------------------------
      def draw_actor_hp(actor, x, y, width = 144, file=HP_BAR)
        # Draw "HP" text string
        self.contents.font.color = system_color
        self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
        # Calculate if there is draw space for MaxHP
        if width - 32 >= 108
          hp_x = x + width - 108
          flag = true
        elsif width - 32 >= 48
          hp_x = x + width - 48
          flag = false
        end
        # Draw HP
        self.contents.font.color = actor.hp == 0 ? knockout_color :
          actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
        self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
        # Draw MaxHP
        if flag
          self.contents.font.color = normal_color
          self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
          self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
        end
      end
      #--------------------------------------------------------------------------
      # * Draw SP
      #    actor : actor
      #    x    : draw spot x-coordinate
      #    y    : draw spot y-coordinate
      #    width : draw spot width
      #--------------------------------------------------------------------------
      def draw_actor_sp(actor, x, y, width = 144, file=SP_BAR)
        # Draw "SP" text string
        self.contents.font.color = system_color
        self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
        # Calculate if there is draw space for MaxHP
        if width - 32 >= 108
          sp_x = x + width - 108
          flag = true
        elsif width - 32 >= 48
          sp_x = x + width - 48
          flag = false
        end
        # Draw SP
        self.contents.font.color = actor.sp == 0 ? knockout_color :
          actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
        self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
        # Draw MaxSP
        if flag
          self.contents.font.color = normal_color
          self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
          self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
        end
      end
      #--------------------------------------------------------------------------
      # * Draw Parameter
      #    actor : actor
      #    x    : draw spot x-coordinate
      #    y    : draw spot y-coordinate
      #    type  : parameter type (0-6)
      #--------------------------------------------------------------------------
      def draw_actor_parameter(actor, x, y, type, file=nil)
        case type
        when 0
          parameter_name = $data_system.words.atk
          parameter_value = actor.atk
        when 1
          parameter_name = $data_system.words.pdef
          parameter_value = actor.pdef
        when 2
          parameter_name = $data_system.words.mdef
          parameter_value = actor.mdef
        when 3
          parameter_name = $data_system.words.str
          parameter_value = actor.str
        when 4
          parameter_name = $data_system.words.dex
          parameter_value = actor.dex
        when 5
          parameter_name = $data_system.words.agi
          parameter_value = actor.agi
        when 6
          parameter_name = $data_system.words.int
          parameter_value = actor.int
        end
        self.contents.font.color = system_color
        self.contents.draw_text(x, y, 120, 32, parameter_name)
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
      end
      #--------------------------------------------------------------------------
      # * Draw EXP
      #    actor : actor
      #    x    : draw spot x-coordinate
      #    y    : draw spot y-coordinate
      #--------------------------------------------------------------------------
      def draw_actor_exp(actor, x, y, width=144,file=EXP_BAR)
        self.contents.font.color = system_color
        self.contents.draw_text(x, y, 24, 32, "Exp")
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 24, y, 84, 32, actor.exp_s, 2)
        self.contents.draw_text(x + 108, y, 12, 32, "/", 1)
        self.contents.draw_text(x + 120, y, 84, 32, actor.next_exp_s)
      end
    end
    #--------------------------------------------------------------------------
    # * Load Gradient from RPG::Cache
    #--------------------------------------------------------------------------
    module RPG
      module Cache
        def self.gradient(filename, hue = 0)
          self.load_bitmap("Graphics/Gradients/", filename, hue)
        end
      end
    end
      #--------------------------------------------------------------------------
      # * Window Base
      #--------------------------------------------------------------------------
    class Window_Base < Window
      #--------------------------------------------------------------------------
      # * Constants Bar Types and Hues for parameters and parameter names
      #--------------------------------------------------------------------------
      HP_BAR = "014-Reds01"
      SP_BAR = "013-Blues01"
      EXP_BAR = "015-Greens01"
      ATK_BAR = "020-Metallic01"
      PDEF_BAR = "020-Metallic01"
      MDEF_BAR = "020-Metallic01"
      STR_BAR = "020-Metallic01"
      DEX_BAR = "020-Metallic01"
      AGI_BAR = "020-Metallic01"
      INT_BAR = "020-Metallic01"
      HUES = [150,180,60,30,270,350,320]
      STATS = ["atk","pdef","mdef","str","dex","agi","int"]
      # leave this alone if you don't know what you are doing
      OUTLINE = 1
      BORDER = 1
      #--------------------------------------------------------------------------
      # * Draw Bar Type
      #--------------------------------------------------------------------------
      def draw_bar_type(x, y, min, max, file, width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2", view = "Horizantel")
        if view == "Horizantel"
          draw_gradient_bar(x, y, min, max, file, width, height, hue, back, back2)
        else
          draw_vertical_gradient_bar(x, y, min, max, file, width, height, hue, back, back2)
        end
      end
      #--------------------------------------------------------------------------
      # * Draw Gradient Bar
      #--------------------------------------------------------------------------
      def draw_gradient_bar(x, y, min, max, file, width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2")
        bar = RPG::Cache.gradient(file, hue)
        back = RPG::Cache.gradient(back)
        back2 = RPG::Cache.gradient(back2)
        cx = BORDER
        cy = BORDER
        dx = OUTLINE
        dy = OUTLINE
        zoom_x = width != nil ? width : back.width
        zoom_y = height != nil ? height : back.height
        percent = min / max.to_f if max != 0
        percent = 0 if max == 0
        back_dest_rect = Rect.new(x,y,zoom_x,zoom_y)
        back2_dest_rect = Rect.new(x+dx,y+dy,zoom_x -dx*2,zoom_y-dy*2)
        bar_dest_rect = Rect.new(x+cx,y+cy,zoom_x * percent-cx*2,zoom_y-cy*2)
        back_source_rect = Rect.new(0,0,back.width,back.height)
        back2_source_rect = Rect.new(0,0,back2.width,back2.height)
        bar_source_rect = Rect.new(0,0,bar.width* percent,bar.height)
        self.contents.stretch_blt(back_dest_rect, back, back_source_rect)
        self.contents.stretch_blt(back2_dest_rect, back2, back2_source_rect)
        self.contents.stretch_blt(bar_dest_rect, bar, bar_source_rect)
      end 
      #--------------------------------------------------------------------------
      # * Draw Vertical Gradient Bar
      #--------------------------------------------------------------------------
      def draw_vertical_gradient_bar(x, y, min, max, file, width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2")
        bar = RPG::Cache.gradient(file, hue)
        back = RPG::Cache.gradient(back)
        back2 = RPG::Cache.gradient(back2)
        cx = BORDER
        cy = BORDER
        dx = OUTLINE
        dy = OUTLINE
        zoom_x = width != nil ? width : back.width
        zoom_y = height != nil ? height : back.height
        percent = min / max.to_f if max != 0
        percent = 0 if max == 0
        bar_y = (zoom_y - zoom_y * percent).ceil
        source_y = bar.height - bar.height * percent
        back_dest_rect = Rect.new(x,y,zoom_x,zoom_y)
        back2_dest_rect = Rect.new(x+dx,y+dy,zoom_x -dx*2,zoom_y-dy*2)
        bar_dest_rect = Rect.new(x+cx,y+bar_y+cy,zoom_x-cx*2,(zoom_y * percent).to_i-cy*2)
        back_source_rect = Rect.new(0,0,back.width,back.height)
        back2_source_rect = Rect.new(0,0,back2.width,back2.height)
        bar_source_rect = Rect.new(0,source_y,bar.width,bar.height * percent)
        self.contents.stretch_blt(back_dest_rect, back, back_source_rect)
        self.contents.stretch_blt(back2_dest_rect, back2, back2_source_rect)
        self.contents.stretch_blt(bar_dest_rect, bar, bar_source_rect)
      end 
      #--------------------------------------------------------------------------
      # * Draw HP
      #    actor : actor
      #    x    : draw spot x-coordinate
      #    y    : draw spot y-coordinate
      #    width : draw spot width
      #--------------------------------------------------------------------------
      alias trick_draw_actor_hp draw_actor_hp
      def draw_actor_hp(actor, x, y, width = 144, file=HP_BAR)
        # Calculate if there is draw space for MaxHP
        return if width <= 32
        if width - 32 >= 108
          hp_x = x + width - 108
          flag = true
        elsif width - 32 >= 48
          hp_x = x + width - 48
          flag = false
        end
        width = hp_x - x
        width += $game_temp.in_battle ? 50 : 100
        # Draw HP
        draw_gradient_bar(x, y + 16, actor.hp, actor.maxhp, file, width, 8)
        trick_draw_actor_hp(actor, x, y, width, file=HP_BAR)
      end
      #--------------------------------------------------------------------------
      # * Draw SP
      #    actor : actor
      #    x    : draw spot x-coordinate
      #    y    : draw spot y-coordinate
      #    width : draw spot width
      #--------------------------------------------------------------------------
      alias trick_draw_actor_sp draw_actor_sp
      def draw_actor_sp(actor, x, y, width = 144, file=SP_BAR)
        # Calculate if there is draw space for MaxHP
        return if width <= 32
        if width - 32 >= 108
          sp_x = x + width - 108
          flag = true
        elsif width - 32 >= 48
          sp_x = x + width - 48
          flag = false
        end
        width = sp_x - x
        width += $game_temp.in_battle ? 50 : 100
        # Draw SP
        draw_gradient_bar(x, y + 16, actor.sp, actor.maxsp, file, width, 8)
        trick_draw_actor_sp(actor, x, y, width, file=SP_BAR)
      end
      #--------------------------------------------------------------------------
      # * Draw Exp
      #    actor : actor
      #    x    : draw spot x-coordinate
      #    y    : draw spot y-coordinate
      #--------------------------------------------------------------------------
      alias trick_bars_base_exp draw_actor_exp
      def draw_actor_exp(actor, x, y, width = 144, file=EXP_BAR)
        return if width <= 32
        min = actor.level == 99 ? 1 : actor.now_exp
        max = actor.level == 99 ? 1 : actor.next_exp
        draw_gradient_bar(x, y + 16, min, max, file, width)
        trick_bars_base_exp(actor, x, y, width=144,file=EXP_BAR)
      end
      #--------------------------------------------------------------------------
      # * Draw Parameter
      #    actor : actor
      #    x    : draw spot x-coordinate
      #    y    : draw spot y-coordinate
      #    type  : draw which parameter
      #--------------------------------------------------------------------------
      alias trick_bars_base_parameter draw_actor_parameter
      def draw_actor_parameter(actor, x, y, type, file=nil)
        hue = HUES[type]
        stat = eval("actor.#{STATS[type]}")
        file = eval("#{STATS[type].upcase}_BAR") if file == nil
        draw_gradient_bar(x, y + 18, stat, 999, file, 190, 8, hue)
        trick_bars_base_parameter(actor, x, y, type,file=nil)
      end
    end
      #--------------------------------------------------------------------------
      # * Game Actor
      #--------------------------------------------------------------------------
    class Game_Actor
      #--------------------------------------------------------------------------
      # * Get the current EXP
      #--------------------------------------------------------------------------
      def now_exp
        return @exp - @exp_list[@level]
      end
      #--------------------------------------------------------------------------
      # * Get the next level's EXP
      #--------------------------------------------------------------------------
      def next_exp
        exp = @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
        return exp
      end
    end
    #==============================================================================
    # ** PreMade Command
    #==============================================================================

    class Pre_Command < Window_Selectable
      attr_accessor :item_max
      attr_accessor :commands
      attr_accessor :target
      attr_reader  :view
      attr_reader  :font_s
      #--------------------------------------------------------------------------
      # * Object Initialization
      #    width    : window width
      #    commands : command text string array
      #--------------------------------------------------------------------------
      def initialize(width, commands, size=21)
        # Compute window height from command quantity
        super(0, 0, width, commands.size * 32 + 32)
        @item_max = commands.size
        @commands = commands
        @target = nil
        @view = "Verticle"
        @font_s = size
        @help_text = "This is a List/Menu Window, you can use it to display contents on it. Drag contents on it from Tool Box. Righ-Click to add more commands."
        self.contents = Bitmap.new(width - 32, @item_max * 32)
        self.contents.font.size = size
        refresh
        self.index = 0
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        if self.contents != nil
          self.contents.dispose
          self.contents = nil
          self.contents = Bitmap.new(width-32, height-32)
        end
        @item_max = @commands.size
        self.contents.clear
        for i in 0...@item_max
          draw_item(i, normal_color)
        end
        do_contents
      end
      #--------------------------------------------------------------------------
      # * Draw Item
      #    index : item number
      #    color : text color
      #--------------------------------------------------------------------------
      def draw_item(index, color)
        self.contents.font.color = color
        rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
        self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
        self.contents.draw_text(rect, @commands[index])
      end
      #--------------------------------------------------------------------------
      # * Disable Item
      #    index : item number
      #--------------------------------------------------------------------------
      def disable_item(index)
        draw_item(index, disabled_color)
      end
      #--------------------------------------------------------------------------
      # * Horizantel or Vertical
      #--------------------------------------------------------------------------
      def view=(v)
        @view = v
      end
      #--------------------------------------------------------------------------
      # * Sets Font Size
      #--------------------------------------------------------------------------
      def font_s=(s)
        return if self.contents == nil or self.contents.disposed?
        @font_s = s
        return if s <= 10 or s >= 35
        self.contents.font.size = s
        refresh
      end
      #--------------------------------------------------------------------------
      # * Add a Command
      #--------------------------------------------------------------------------
      def add_command(n="")
        @commands.push(n)
        @item_size = @commands.size
        #Get Font Size
        size = self.contents.font.size
        #Dispose Bitmap
        if self.contents != nil
          self.contents.dispose
          self.contents = nil
        end
        #Get New Bitmap
        self.contents = Bitmap.new(width - 32, @item_max * 32 + 32)
        self.contents.font.size = size
        self.height = @commands.size * 32 + 32
        refresh
      end
      #--------------------------------------------------------------------------
      # * Adds the contents
      #--------------------------------------------------------------------------
      def do_contents
        #Get all the contents
        for cont in @content
          next if cont == nil
          @current_c = cont
          #If the content is a text
          if cont.is_a?(Game_Text)
            # Add the text
            add_text(cont.text,cont.x,cont.y,cont.w,cont.h,cont.size,cont.color,cont.bol,cont.it)
          elsif cont.is_a?(Game_DataText)
            # Add the text
            add_text(cont.text,cont.x,cont.y,cont.w,cont.h,cont.size,cont.color,cont.bol,cont.it)
          elsif cont.is_a?(Game_Bar)
            # Add Bar
            draw_bar_type(cont.x, cont.y, cont.min, cont.max, cont.file, cont.w , cont.h, cont.hue, cont.back, cont.back2, cont.view)
          elsif cont.is_a?(Game_HpBar)
            #Draw HP Bar
            draw_actor_hp(cont.actor, cont.x, cont.y, cont.w,cont.file)
          elsif cont.is_a?(Game_SpBar)
            #Draw Sp Bar
            draw_actor_sp(cont.actor, cont.x, cont.y, cont.w,cont.file)
          elsif cont.is_a?(Game_ExpBar)
            #Draw Exp Bar
            draw_actor_exp(cont.actor, cont.x, cont.y, cont.w,cont.file)
          elsif cont.is_a?(Game_ParaBar)
            #Draw Parameter Bar
            draw_actor_parameter(cont.actor, cont.x, cont.y, cont.type, cont.file)
          elsif cont.is_a?(Game_Pic)
            #Draw Picture
            add_picture(cont.file,cont.x,cont.y,cont.w,cont.h)
          elsif cont.is_a?(Game_CharacterSet)
            #Draw Characterset
            add_characterset(cont.file,cont.x,cont.y,cont.dir,cont.h,cont.w,cont.hue)
          elsif cont.is_a?(Game_Bat)
            #Draw Game Battler
            add_battler(cont.file,cont.x,cont.y,cont.w,cont.h,cont.hue)
          elsif cont.is_a?(Game_AcCharacterSet)
            #Draw Characterset
            add_characterset(cont.file,cont.x,cont.y,cont.dir,cont.h,cont.w,cont.hue)
          elsif cont.is_a?(Game_AcBat)
            #Draw Game Battler
            add_battler(cont.file,cont.x,cont.y,cont.w,cont.h,cont.hue)
          elsif cont.is_a?(Game_Icon)
            #Draw Icon
            add_icon(cont.file,cont.x,cont.y,cont.w,cont.h)
          end
          @current_c = nil
        end
      end
    end
    #==============================================================================
    # ** Game Text
    #------------------------------------------------------------------------------
    #  This is to hold text info.
    #==============================================================================
    class Game_Text
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :text
      attr_accessor :h
      attr_accessor :w
      attr_accessor :x
      attr_accessor :y
      attr_accessor :color
      attr_accessor :size
      attr_accessor :parent
      attr_reader  :font_s
      attr_reader  :blue
      attr_reader  :green
      attr_reader  :red
      attr_reader  :alpha
      attr_reader  :help_text
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x=0,y=0,w=100,h=32,text="Text#{self.object_id}",s=21,b=false,i=false,r=255,g=255,bl=255,a=255)
        @text = text
        @h = h
        @w = w
        @x = x
        @y = y
        @size = s
        @font_s = s
        @bold = b
        @italic = i
        @parent = nil
        @red = r
        @green = g
        @blue = bl
        @alpha = a
        @color = Color.new(@red, @green, @blue, @alpha)
        @help_text = "This displays Text on a window. Use the property panel to edit it."
      end
      #--------------------------------------------------------------------------
      # * Blue
      #--------------------------------------------------------------------------
      def blue=(b)
        @blue = b
        @color.set(@red, @green, @blue, @alpha)
      end
      #--------------------------------------------------------------------------
      # *Green
      #--------------------------------------------------------------------------
      def green=(g)
        @green = g
        @color.set(@red, @green, @blue, @alpha)
      end
      #--------------------------------------------------------------------------
      # * Red
      #--------------------------------------------------------------------------
      def red=(r)
        @red = r
        @color.set(@red, @green, @blue, @alpha)
      end
      #--------------------------------------------------------------------------
      # * Alpha
      #--------------------------------------------------------------------------
      def alpha=(a)
      @alpha = a
      @color.set(@red, @green, @blue, @alpha)
      end
      #--------------------------------------------------------------------------
      # * Bold
      #--------------------------------------------------------------------------
      def bol
        case @bold
        when "true"
          return true
        when "false"
          return false
        end
      end
      #--------------------------------------------------------------------------
      # * Italic
      #--------------------------------------------------------------------------
      def it
        case @italic
        when "true"
          return true
        when "false"
          return false
        end
      end
      #--------------------------------------------------------------------------
      # * Bold=(boolean)
      #--------------------------------------------------------------------------
      def bold=(b)
        case b
        when "true"
          @bold = true
        when "false"
          @bold = false
        end
      end
      #--------------------------------------------------------------------------
      # * Italic=(boolean)
      #--------------------------------------------------------------------------
      def italic=(i)
        case i
        when "true"
          @italic = true
        when "false"
          @italic = false
        end
      end
      #--------------------------------------------------------------------------
      # * Bold
      #--------------------------------------------------------------------------
      def bold
        return "true" if @bold
        return "false" if !@bold
      end
      #--------------------------------------------------------------------------
      # * Italic
      #--------------------------------------------------------------------------
      def italic
        return "true" if @italic
        return "false" if !@italic
      end
      #--------------------------------------------------------------------------
      # * Sets Font Size
      #--------------------------------------------------------------------------
      def font_s=(s)
        @font_s = s
        return if s <= 10 or s >= 35
        @size = s
      end
    end
    #==============================================================================
    # ** Game DataText
    #------------------------------------------------------------------------------
    #  This is to hold datatext info.
    #==============================================================================
    class Game_DataText
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :text
      attr_accessor :h
      attr_accessor :w
      attr_accessor :x
      attr_accessor :y
      attr_accessor :color
      attr_accessor :size
      attr_accessor :parent
      attr_accessor :data
      attr_accessor :id
      attr_reader  :font_s
      attr_reader  :blue
      attr_reader  :green
      attr_reader  :red
      attr_reader  :alpha
      attr_reader  :help_text
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x=0,y=0,w=100,h=32,data=nil,s=21,b=false,i=false,r=255,g=255,bl=255,a=255,id=1)
        @id = id
        @data = $game_actors[id].name
        @text = @data
        @h = h
        @w = w
        @x = x
        @y = y
        @size = s
        @font_s = s
        @bold = b
        @italic = i
        @parent = nil
        @red = r
        @green = g
        @blue = bl
        @alpha = a
        @color = Color.new(@red, @green, @blue, @alpha)
        @help_text = "This displays Text on a window. Use the property panel to edit it."
      end
      #--------------------------------------------------------------------------
      # * Blue
      #--------------------------------------------------------------------------
      def blue=(b)
        @blue = b
        @color.set(@red, @green, @blue, @alpha)
      end
      #--------------------------------------------------------------------------
      # *Green
      #--------------------------------------------------------------------------
      def green=(g)
        @green = g
        @color.set(@red, @green, @blue, @alpha)
      end
      #--------------------------------------------------------------------------
      # * Red
      #--------------------------------------------------------------------------
      def red=(r)
        @red = r
        @color.set(@red, @green, @blue, @alpha)
      end
      #--------------------------------------------------------------------------
      # * Alpha
      #--------------------------------------------------------------------------
      def alpha=(a)
      @alpha = a
      @color.set(@red, @green, @blue, @alpha)
      end
      #--------------------------------------------------------------------------
      # * Bold
      #--------------------------------------------------------------------------
      def bol
        case @bold
        when "true"
          return true
        when "false"
          return false
        end
      end
      #--------------------------------------------------------------------------
      # * Italic
      #--------------------------------------------------------------------------
      def it
        case @italic
        when "true"
          return true
        when "false"
          return false
        end
      end
      #--------------------------------------------------------------------------
      # * Bold=(boolean)
      #--------------------------------------------------------------------------
      def bold=(b)
        case b
        when "true"
          @bold = true
        when "false"
          @bold = false
        end
      end
      #--------------------------------------------------------------------------
      # * Italic=(boolean)
      #--------------------------------------------------------------------------
      def italic=(i)
        case i
        when "true"
          @italic = true
        when "false"
          @italic = false
        end
      end
      #--------------------------------------------------------------------------
      # * Bold
      #--------------------------------------------------------------------------
      def bold
        return "true" if @bold
        return "false" if !@bold
      end
      #--------------------------------------------------------------------------
      # * Italic
      #--------------------------------------------------------------------------
      def italic
        return "true" if @italic
        return "false" if !@italic
      end
      #--------------------------------------------------------------------------
      # * Sets Font Size
      #--------------------------------------------------------------------------
      def font_s=(s)
        @font_s = s
        return if s <= 10 or s >= 35
        @size = s
      end
    end
    #==============================================================================
    # ** Game Bar
    #------------------------------------------------------------------------------
    #  This is to hold bar info.
    #==============================================================================
    class Game_Bar
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :h
      attr_accessor :w
      attr_accessor :x
      attr_accessor :y
      attr_accessor :min
      attr_accessor :max
      attr_accessor :file
      attr_accessor :hue
      attr_accessor :back
      attr_accessor :back2
      attr_accessor :parent
      attr_reader :view
      attr_reader  :help_text
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x=0,y=0,w=144,h=12,f="014-Reds01",min=32,max=64,hue=0,view="Horizantel")
        @h = h
        @w = w
        @x = x
        @y = y
        @min = min
        @max = max
        @file = f
        @hue = hue
        @back = "Back"
        @back2 = "Back2"
        @parent = nil
        @view = view
        @help_text = "This displays a Bar on a window. Use the property panel to edit it."
      end
      #--------------------------------------------------------------------------
      # * View
      #--------------------------------------------------------------------------
      def view=(v)
        h=@h
        w=@w
        @w = h
        @h = w
        @view = v
      end
    end
    #==============================================================================
    # ** Game HP Bar
    #------------------------------------------------------------------------------
    #  This is to hold HPbar info.
    #==============================================================================
    class Game_HpBar
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :h
      attr_accessor :w
      attr_accessor :x
      attr_accessor :y
      attr_accessor :parent
      attr_accessor :kind
      attr_accessor :file
      attr_reader  :actor_id
      attr_reader  :a_id
      attr_reader  :help_text
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x=0,y=0,w=144,h=12,id=1,kind="Database",file="014-Reds01")
        @h = h
        @w = w
        @x = x
        @y = y
        @actor_id = id
        @parent = nil
        @a_id = id
        @kind = kind
        @file = file
        @help_text = "This displays HPbar on a window. Use the property panel to edit it."
      end
      #--------------------------------------------------------------------------
      # * Actor
      #--------------------------------------------------------------------------
      def actor
        if @kind == "Database"
          return $game_actors[@actor_id]
        elsif @kind == "Party"
          return $game_party.actors[@actor_id]
        end
      end
      #--------------------------------------------------------------------------
      # * Actor
      #--------------------------------------------------------------------------
      def actor_tos
        if @kind == "Database"
          return "$game_actors[#{@actor_id}]"
        elsif @kind == "Party"
          return "$game_party.actors[#{@actor_id}]"
        end
      end
      #--------------------------------------------------------------------------
      # * Actor Id
      #--------------------------------------------------------------------------
      def actor_id=(id)
        @actor_id = id
      end
      #--------------------------------------------------------------------------
      # * Actor Id
      #--------------------------------------------------------------------------
      def a_id=(id)
        @a_id = id
        if $game_actors[id] != nil
          actor_id=id
        end
      end
    end
    #==============================================================================
    # ** Game SP Bar
    #------------------------------------------------------------------------------
    #  This is to hold HPbar info.
    #==============================================================================
    class Game_SpBar
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :h
      attr_accessor :w
      attr_accessor :x
      attr_accessor :y
      attr_accessor :parent
      attr_accessor :kind
      attr_accessor :file
      attr_reader  :actor_id
      attr_reader  :a_id
      attr_reader  :help_text
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x=0,y=0,w=144,h=12,id=1,kind="Database",file="013-Blues01")
        @h = h
        @w = w
        @x = x
        @y = y
        @actor_id = id
        @parent = nil
        @a_id = id
        @kind = kind
        @file = file
        @help_text = "This displays SpBar on a window. Use the property panel to edit it."
      end
      #--------------------------------------------------------------------------
      # * Actor
      #--------------------------------------------------------------------------
      def actor
        if @kind == "Database"
          return $game_actors[@actor_id]
        elsif @kind == "Party"
          return $game_party.actors[@actor_id]
        end
      end
      #--------------------------------------------------------------------------
      # * Actor
      #--------------------------------------------------------------------------
      def actor_tos
        if @kind == "Database"
          return "$game_actors[#{@actor_id}]"
        elsif @kind == "Party"
          return "$game_party.actors[#{@actor_id}]"
        end
      end
      #--------------------------------------------------------------------------
      # * Actor Id
      #--------------------------------------------------------------------------
      def actor_id=(id)
        @actor_id = id
        @actor = $game_actors[@actor_id]
      end
      #--------------------------------------------------------------------------
      # * Actor Id
      #--------------------------------------------------------------------------
      def a_id=(id)
        @a_id = id
        if $game_actors[id] != nil
          actor_id=id
        end
      end
    end
    #==============================================================================
    # ** Game Exp Bar
    #------------------------------------------------------------------------------
    #  This is to hold Expbar info.
    #==============================================================================
    class Game_ExpBar
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :h
      attr_accessor :w
      attr_accessor :x
      attr_accessor :y
      attr_accessor :parent
      attr_accessor :kind
      attr_accessor :file
      attr_reader  :actor_id
      attr_reader  :a_id
      attr_reader  :help_text
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x=0,y=0,w=144,h=12,id=1,kind="Database",file="015-Greens01")
        @h = h
        @w = w
        @x = x
        @y = y
        @actor_id = id
        @parent = nil
        @a_id = id
        @kind = kind
        @file = file
        @help_text = "This displays ExpBar on a window. Use the property panel to edit it."
      end
      #--------------------------------------------------------------------------
      # * Actor
      #--------------------------------------------------------------------------
      def actor
        if @kind == "Database"
          return $game_actors[@actor_id]
        elsif @kind == "Party"
          return $game_party.actors[@actor_id]
        end
      end
      #--------------------------------------------------------------------------
      # * Actor
      #--------------------------------------------------------------------------
      def actor_tos
        if @kind == "Database"
          return "$game_actors[#{@actor_id}]"
        elsif @kind == "Party"
          return "$game_party.actors[#{@actor_id}]"
        end
      end
      #--------------------------------------------------------------------------
      # * Actor Id
      #--------------------------------------------------------------------------
      def actor_id=(id)
        @actor_id = id
        @actor = $game_actors[@actor_id]
      end
      #--------------------------------------------------------------------------
      # * Actor Id
      #--------------------------------------------------------------------------
      def a_id=(id)
        @a_id = id
        if $game_actors[id] != nil
          actor_id=id
        end
      end
    end
    #==============================================================================
    # ** Game ParaMeters Bar
    #------------------------------------------------------------------------------
    #  This is to hold Parabar info.
    #==============================================================================
    class Game_ParaBar
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :h
      attr_accessor :w
      attr_accessor :x
      attr_accessor :y
      attr_accessor :parent
      attr_accessor :kind
      attr_accessor :file
      attr_accessor :type
      attr_reader  :actor_id
      attr_reader  :a_id
      attr_reader  :help_text
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x=0,y=0,w=144,h=12,id=1,kind="Database",file=nil,type=0)
        @h = h
        @w = w
        @x = x
        @y = y
        @actor_id = id
        @parent = nil
        @a_id = id
        @kind = kind
        @file = file
        @type = type
        @help_text = "This displays ParaBar on a window. Use the property panel to edit it."
      end
      #--------------------------------------------------------------------------
      # * Actor
      #--------------------------------------------------------------------------
      def actor
        if @kind == "Database"
          return $game_actors[@actor_id]
        elsif @kind == "Party"
          return $game_party.actors[@actor_id]
        end
      end
      #--------------------------------------------------------------------------
      # * Actor
      #--------------------------------------------------------------------------
      def actor_tos
        if @kind == "Database"
          return "$game_actors[#{@actor_id}]"
        elsif @kind == "Party"
          return "$game_party.actors[#{@actor_id}]"
        end
      end
      #--------------------------------------------------------------------------
      # * Actor Id
      #--------------------------------------------------------------------------
      def actor_id=(id)
        @actor_id = id
        @actor = $game_actors[@actor_id]
      end
      #--------------------------------------------------------------------------
      # * Actor Id
      #--------------------------------------------------------------------------
      def a_id=(id)
        @a_id = id
        if $game_actors[id] != nil
          actor_id=id
        end
      end
    end
    #==============================================================================
    # ** Game Picture
    #------------------------------------------------------------------------------
    #  This is to hold Picture info.
    #==============================================================================
    class Game_Pic
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :h
      attr_accessor :w
      attr_accessor :x
      attr_accessor :y
      attr_accessor :file
      attr_accessor :parent
      attr_reader  :help_text
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x=0,y=0,w=32,h=32,f="nopic")
        @h = h
        @w = w
        @x = x
        @y = y
        @file = f
        @parent = nil
        @help_text = "This displays a Picture on a window. Use the property panel to edit it."
      end
    end
    #==============================================================================
    # ** Game CharacterSet
    #------------------------------------------------------------------------------
    #  This is to hold text info.
    #==============================================================================
    class Game_CharacterSet
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :file
      attr_accessor :x
      attr_accessor :y
      attr_accessor :dir
      attr_accessor :hue
      attr_accessor :h
      attr_accessor :w
      attr_accessor :parent
      attr_reader  :help_text
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x=0,y=0,w=32,h=32,f="001-Fighter01",dir=2,hue=0)
        @x = x
        @y = y
        @file = f
        @dir = dir
        @hue = hue
        @h = h
        @w = w
        @parent = nil
        @help_text = "This displays a CharacterSet on a window. Use the property panel to edit it."
      end
    end
    #==============================================================================
    # ** Game Battler
    #------------------------------------------------------------------------------
    #  This is to hold text info.
    #==============================================================================
    class Game_Bat
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :file
      attr_accessor :h
      attr_accessor :w
      attr_accessor :x
      attr_accessor :y
      attr_accessor :hue
      attr_accessor :parent
      attr_reader  :help_text
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x=0,y=0,w=100,h=100,f="nopic",hu=0)
        @h = h
        @w = w
        @x = x
        @y = y
        @file = f
        @hue = hu
        @parent = nil
        @help_text = "This displays a Battler on a window. Use the property panel to edit it."
      end
    end
    #==============================================================================
    # ** Game CharacterSet
    #------------------------------------------------------------------------------
    #  This is to hold text info.
    #==============================================================================
    class Game_AcCharacterSet
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :x
      attr_accessor :y
      attr_accessor :dir
      attr_accessor :hue
      attr_accessor :h
      attr_accessor :w
      attr_accessor :parent
      attr_accessor :kind
      attr_reader  :actor_id
      attr_reader  :a_id
      attr_reader  :help_text
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x=0,y=0,w=32,h=32,id=1,kind="Database",dir=2,hue=0)
        @x = x
        @y = y
        @actor_id = id
        @kind = kind
        @file = actor.character_name
        @dir = dir
        @hue = hue
        @a_id = id
        @h = h
        @w = w
        @parent = nil
        @help_text = "This displays an Actor's CharacterSet on a window. Use the property panel to edit it."
      end
      #--------------------------------------------------------------------------
      # *  File
      #--------------------------------------------------------------------------
      def file
        return actor.character_name
      end
      #--------------------------------------------------------------------------
      # * Actor
      #--------------------------------------------------------------------------
      def actor
        if @kind == "Database"
          return $game_actors[@actor_id]
        elsif @kind == "Party"
          return $game_party.actors[@actor_id]
        end
      end
      #--------------------------------------------------------------------------
      # * Actor
      #--------------------------------------------------------------------------
      def actor_tos
        if @kind == "Database"
          return "$game_actors[#{@actor_id}]"
        elsif @kind == "Party"
          return "$game_party.actors[#{@actor_id}]"
        end
      end
      #--------------------------------------------------------------------------
      # * Actor Id
      #--------------------------------------------------------------------------
      def actor_id=(id)
        @actor_id = id
      end
      #--------------------------------------------------------------------------
      # * Actor Id
      #--------------------------------------------------------------------------
      def a_id=(id)
        @a_id = id
        if $game_actors[id] != nil and @kind == "Database"
          @actor_id=id
        elsif $game_party.actors[id] != nil and @kind == "Party"
          @actor_id=id
        end
      end
    end
    #==============================================================================
    # ** Game Battler
    #------------------------------------------------------------------------------
    #  This is to hold text info.
    #==============================================================================
    class Game_AcBat 
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :x
      attr_accessor :y
      attr_accessor :hue
      attr_accessor :h
      attr_accessor :w
      attr_accessor :parent
      attr_accessor :kind
      attr_reader  :actor_id
      attr_reader  :a_id
      attr_reader  :help_text
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x=0,y=0,w=100,h=100,id=1,kind="Database",hue=0)
        @x = x
        @y = y
        @actor_id = id
        @kind = kind
        @hue = hue
        @h = h
        @w = w
        @a_id = id
        @parent = nil
        @help_text = "This displays an Actor's Battler on a window. Use the property panel to edit it."
      end
      #--------------------------------------------------------------------------
      # *  File
      #--------------------------------------------------------------------------
      def file
        return actor.battler_name
      end
      #--------------------------------------------------------------------------
      # * Actor
      #--------------------------------------------------------------------------
      def actor
        if @kind == "Database"
          return $game_actors[@actor_id]
        elsif @kind == "Party"
          return $game_party.actors[@actor_id]
        end
      end
      #--------------------------------------------------------------------------
      # * Actor
      #--------------------------------------------------------------------------
      def actor_tos
        if @kind == "Database"
          return "$game_actors[#{@actor_id}]"
        elsif @kind == "Party"
          return "$game_party.actors[#{@actor_id}]"
        end
      end
      #--------------------------------------------------------------------------
      # * Actor Id
      #--------------------------------------------------------------------------
      def actor_id=(id)
        @actor_id = id
      end
      #--------------------------------------------------------------------------
      # * Actor Id
      #--------------------------------------------------------------------------
      def a_id=(id)
        @a_id = id
        if $game_actors[id] != nil and @kind == "Database"
          @actor_id=id
        elsif $game_party.actors[id] != nil and @kind == "Party"
          @actor_id=id
        end
      end
    end
    #==============================================================================
    # ** Game Icon
    #------------------------------------------------------------------------------
    #  This is to hold text info.
    #==============================================================================
    class Game_Icon
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :file
      attr_accessor :h
      attr_accessor :w
      attr_accessor :x
      attr_accessor :y
      attr_accessor :parent
      attr_reader  :help_text
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(x=0,y=0,w=32,h=32,f="nopic")
        @h = h
        @w = w
        @x = x
        @y = y
        @file = f
        @parent = nil
        @help_text = "This displays an Icon on a window. Use the property panel to edit it."
      end
    end

    12.Abra a pasta onde está o seu WSW e abra o bloco de notas que nós não apagamos.

    13.Copie o script que está nele e cole no seu projeto lenbrado que tem que ser debaixo do script que está acima.

    14.Já esta quase acabando!Depois do script da HUD cole esse:
    Código:
    #by:dodoop
    #Esse script coloca a janela da hud na tela!
    class Scene_Map
      alias hud_main main
      def main
        @Hud = Hud.new
        hud_main
        @Hud.dispose
      end
      alias hud_update update
      def update
        hud_update
        @Hud.update
        @Hud.refresh
      end
    end

    15.Pronto fassa bom proveito.[/font]

    Demo:
    Eu não acho que tem necessidade de demo pois o tutorial está bem explicado + mesmo assim depois eu crio uma demo e posto aqui!

    Fassa bom proveito!Algum erro no tuto ou nos scripts me Avize!

      Data/hora atual: Seg Jan 21, 2019 6:20 pm