RPG Master Brasil
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

[RGSS] HUD Amneria [Simple] v2.0

2 participantes

Ir para baixo

[RGSS] HUD Amneria [Simple] v2.0 Empty [RGSS] HUD Amneria [Simple] v2.0

Mensagem por VitorJ Qua Dez 10, 2008 8:54 pm

Olá! Venho trazer um de meus scripts! Wink
Utilidade:
Adiciona uma janela mostrando os status básico dos personagens.
Utilização:
Cole o script acima do main, customize-o ao seu gosto e pronto!
Screen:
[RGSS] HUD Amneria [Simple] v2.0 77129726lt2.th
Script:
Código:

##############################################################
## HUD Amneria[Simple]2.0 Por VitorJ ## Creditos Nescessarios#
##############################################################
## Como Usar: ################################################
############## Cole Acima do main e costumize a seu gosto. ###
##############################################################
module Hud_Edit
  e = 150 # (Opcional) Coloque aqui o espaço entre uma hud e outra
  HUDX = [0*e,1*e,2*e,3*e] # Posição X Da HUD [char1,char2,char3,char4]
  HUDY = [10,10,10,10] # Posição Y Da HUD [char1,char2,char3,char4]
  SWITCH = 1 # Switch que mostrara a HUD.
  FONTNAME = "Palatino Linotype" # Fonte das Letras
  EXPX = 0 # Posição X Da Barra de EXP
  EXPY = 35 # Posição Y Da Barra de EXP
  SP = "MP" # Nome do MP
  HP = "HP" # Nome do HP
  PARTY = true # Vai mostrar a HUD dos outros membros?
  FACE_AJUST =  0 # Coloque um ajuste para face do personagen.
  # Cor das Barras, coloque [r,g,b,opacity]
  C_INI_HP = [0,100,0,255] #Cor Inicial da barra de HP
  C_FIN_HP = [253,209,77,255] #Cor Final da barra de HP
  C_INI_SP = [67,89,153,255] #Cor Inicial da barra de SP
  C_FIN_SP = [2,58,218,255] #Cor Final da barra de SP
  C_INI_XP = [67,153,153,200] #Cor Inicial da barra de EXP
  C_FIN_XP = [2,218,218,255] #Cor Final da barra de EXP
end
class Simple_Hud_Sprite < Sprite
  include Hud_Edit
  def initialize(viewport,actor,pchar)
    super(viewport)
    self.bitmap = Bitmap.new(640, 480)
    self.bitmap.font.name = FONTNAME
    self.visible = $game_switches[SWITCH]
    @actor = actor
    @pchar = pchar
    start if actor != nil
  end
  def start
    actor = @actor
    @hp = actor.hp
    @sp = actor.sp
    @maxhp = actor.maxhp
    @maxsp = actor.maxsp
    @name = actor.name
    @level = actor.level
    @exp = actor.exp
    @gold = $game_party.gold.to_s
    draw_char
    draw_hp
    draw_sp
    draw_xp
    draw_name
    #draw_gold
  end
  def draw_char
    actor = @actor
    x = HUDX[@pchar]
    y = HUDY[@pchar]+8
    bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
    cw = bitmap.width / 4
    ch = bitmap.height / 4 / 2
    src_rect = Rect.new(0, 0+FACE_AJUST, cw, ch)
    self.bitmap.fill_rect(Rect.new(x, y, cw, ch), Color.new(0,0,0,0))
    self.bitmap.blt(x, y, bitmap, src_rect)
  end
  def draw_name
    x = HUDX[@pchar]+8
    y = HUDY[@pchar]
  end
  def draw_hp
    x = HUDX[@pchar]+8
    y = HUDY[@pchar]
    self.bitmap.fill_rect(Rect.new(x-3, y-6, 115, 18), Color.new(0,0,0,0))
    draw_gradient([0,0,0,255],[0,0,0,255],102,8,x,y)
    draw_gradient([200,183,130,255],[253,209,77,255],100,6,x+2,y+1)
    draw_gradient([0,0,0,100],[0,0,0,170],98,4,x+4,y+2)
    cw = 98  * @hp / @maxhp
    ch = 4
    r = C_FIN_HP[0] * @hp / @maxhp
    g = C_FIN_HP[1] * @hp / @maxhp
    b = C_FIN_HP[2] * @hp / @maxhp
    draw_gradient(C_INI_HP,[r,g,b,C_FIN_HP[3]],cw,ch,x+4,y+2)
    text = HP
    size = self.bitmap.text_size(text)
    rx = 200 * @hp / @maxhp
    self.bitmap.font.size = 15
    draw_text(x-2, y-12,size.width,size.height,text,Color.new(rx+55,0,0,255))
    self.bitmap.font.size = 15
    text = "#{@hp} / #{@maxhp}"
    size = self.bitmap.text_size(text)
    c = 255 * @hp / @maxhp
    draw_text(x+50, y-8,size.width,size.height, text,Color.new(255,c,c,255))
  end
  def draw_sp
    x = HUDX[@pchar]+32
    y = HUDY[@pchar]+20
    self.bitmap.fill_rect(Rect.new(x-3, y-6, 115, 18), Color.new(255,0,0,0))
    draw_gradient([0,0,0,255],[0,0,0,255],102,8,x,y)
    draw_gradient([200,183,130,255],[253,209,77,255],100,6,x+2,y+1)
    draw_gradient([0,0,0,100],[0,0,0,170],98,4,x+4,y+2)
    cw = 98  * @sp / @maxsp
    ch = 4
    r = C_FIN_SP[0] * @sp / @maxsp
    g = C_FIN_SP[1] * @sp / @maxsp
    b = C_FIN_SP[2] * @sp / @maxsp
    draw_gradient(C_INI_SP,[r,g,b,C_FIN_SP[3]],cw,ch,x+4,y+2)
    text = SP
    size = self.bitmap.text_size(text)
    draw_text(x-2, y-8,size.width,size.height,text,Color.new(0,0,255,255))
    text = "#{@sp} / #{@maxsp}"
    size = self.bitmap.text_size(text)
    self.bitmap.font.size = 15
    draw_text(x+50, y-8,size.width,size.height, text,Color.new(255,255,255,255))
  end
  def draw_xp
    x = HUDX[@pchar]+EXPX
    y = HUDY[@pchar]+EXPY
    actor = @actor
    self.bitmap.fill_rect(Rect.new(x, y-4, 48, 15), Color.new(0,0,0,0))
    if actor.next_exp != 0
      rate = actor.now_exp.to_f / actor.next_exp
    else
      rate = 1
    end
    if @actor.level < 99
      cw = 44 * rate
    else
      cw = 44
    end 
    ch = 5
    self.bitmap.fill_rect(Rect.new(x, y, 48, 8), Color.new(0,0,0,255))
    self.bitmap.fill_rect(Rect.new(x+1, y+1, 46, 6), Color.new(0,0,0,160))
    draw_gradient([67,153,153,200],[2,218,218,255],cw,ch,x+1,y+1,1)
    self.bitmap.font.size = 15
    text = "Level: #{@level}"
    size = self.bitmap.text_size(text)
    draw_text(x, y-8,size.width,size.height, text,Color.new(255,255,255,255))
  end
  def draw_gradient(cor_ini,cor_fin,width,height,x,y,type=0)
    if width < 1
      width2 = width
      width = 1
    end
    calc0 = cor_fin[0]/width
    calc1 = cor_fin[1]/width
    calc2 = cor_fin[2]/width
    calc3 = cor_fin[3]/width
    width = width2 if width2 != nil
    cor_fin = [calc0,calc1,calc2,calc3]
    r = cor_ini[0]
    g = cor_ini[1]
    b = cor_ini[2]
    o = cor_ini[3]
    for i in 0..width
      for n in 0..height
        self.bitmap.fill_rect(Rect.new(x+i+n, y+n, 1, 1), Color.new(r,g,b,o)) if type == 0
        self.bitmap.fill_rect(Rect.new(x+i, y+n, 1, 1), Color.new(r,g,b,o)) if type == 1
      end
      r += cor_fin[0]
      g += cor_fin[1]
      b += cor_fin[2]
      o += cor_fin[3]
    end
  end
  def draw_text(x,y,width,height,text,color)
    self.bitmap.font.color = Color.new(0,0,0,255)
    self.bitmap.draw_text(Rect.new(x-1, y,width,height), text)
    self.bitmap.draw_text(Rect.new(x+1, y,width,height), text)
    self.bitmap.draw_text(Rect.new(x, y-1,width,height), text)
    self.bitmap.draw_text(Rect.new(x, y+1,width,height), text)
    self.bitmap.font.color = color
    self.bitmap.draw_text(Rect.new(x, y,width,height), text)
  end
  def update(pchar)
    if $game_party.actors[@pchar] != nil
      actor = $game_party.actors[@pchar]
    else
      actor = $game_actors[0]
    end
    if @actor != actor
      @actor = actor
      start
    end
    if @hp != actor.hp or @maxhp != actor.maxhp
      @hp = actor.hp
      @maxhp = actor.maxhp
      draw_hp
    end
    if @sp != actor.sp or @maxsp != actor.maxsp
      @sp = actor.sp
      @maxsp = actor.maxsp
      draw_sp
    end
    if @exp != actor.exp or @level != actor.level
      @exp = actor.exp
      @level = actor.level
      draw_xp
    end
    self.visible = $game_switches[SWITCH]
  end
end

class Simple_Hud
  def initialize
    @viewport = Viewport.new(0, 0, 640, 480)
    @viewport.z = 9999
    @simple_hud = []
    @sprites = []
    @psize = $game_party.actors.size
    if Hud_Edit::PARTY == true
      for i in 0...4#$game_party.actors.size
        actor = $game_actors[0]
        actor = $game_party.actors[i] if $game_party.actors[i] != nil
        pchar = i
        @simple_hud[i] = Simple_Hud_Sprite.new(@viewport,actor,pchar)
        @sprites.push(@simple_hud[i])
      end
    else
      actor = $game_actors[0]
      actor = $game_party.actors[0] if $game_party.actors[0] != nil
      pchar = 0
      @simple_hud[0] = Simple_Hud_Sprite.new(@viewport,actor,pchar)
      @sprites.push(@simple_hud[0])
    end
    @visible = true
  end
  def update
    if @psize != $game_party.actors.size
      if Hud_Edit::PARTY == true
        for i in 0...@psize
          @simple_hud[i].visible = false
        end
        for i in 0...$game_party.actors.size
          actor = $game_actors[0]
          actor = $game_party.actors[i] if $game_party.actors[i] != nil
          pchar = i
          @simple_hud[i].update(i)
        end
      else
        actor = $game_actors[0]
        actor = $game_party.actors[0] if $game_party.actors[0] != nil
        pchar = 0
        @simple_hud[0].update(0)
      end
    else
      if Hud_Edit::PARTY == true
        for i in 0...$game_party.actors.size
          @simple_hud[i].update(i)
        end
      else
        @simple_hud[0].update(0)
      end
    end
  end
  def dispose
    for sprite in @sprites
      next if sprite.nil?
      sprite.dispose
    end
    @sprites = []
  end
end
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
class Scene_Map
  alias simple_hud_main main
  def main
    @hud = Simple_Hud.new
    simple_hud_main
    @hud.dispose
  end
  alias simple_hud_update update
  def update
    @hud.update
    simple_hud_update
  end
end
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
class Game_Actor < Game_Battler
  def now_exp
    return @exp - @exp_list[@level]
  end
  def next_exp
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end
end

Demo:
http://www.4shared.com/file/75406550/cc418faf/HUD_Amneria_Simple.html

Use e Abuse!
E comente! Very Happy
VitorJ
VitorJ


Masculino Número de Mensagens : 11
Idade : 32
Localização : São Sebastião - SP
Data de inscrição : 10/12/2008

RMB Games
Nível de Reputação: 1
Reputação:
[RGSS] HUD Amneria [Simple] v2.0 Left_bar_bleue34/100[RGSS] HUD Amneria [Simple] v2.0 Empty_bar_bleue  (34/100)
Gamescore:
[RGSS] HUD Amneria [Simple] v2.0 Left_bar_bleue0/0[RGSS] HUD Amneria [Simple] v2.0 Empty_bar_bleue  (0/0)

Ir para o topo Ir para baixo

[RGSS] HUD Amneria [Simple] v2.0 Empty Re: [RGSS] HUD Amneria [Simple] v2.0

Mensagem por Dark Dudu Qua Dez 10, 2008 8:58 pm

Você fazendo scripts? Uia Smile
Eu gosto de HUDs pequenas, mas a sua tá beeeeeeemmmm pequena... de qualquer modo, gostei muito, parabéns ^^

Aliás, você quis dizer "Simples" ou "Sample"? Desconheço o que vem a ser "Simple" 0o

Edit: Já percebi o que é, dei mancada feia u.u' Ignorem /\

+2 Reputação
Dark Dudu
Dark Dudu


Masculino Número de Mensagens : 385
Idade : 30
Localização : São Vicente - SP
Especialidade : Eventos
Data de inscrição : 01/12/2008

RMB Games
Nível de Reputação: 2
Reputação:
[RGSS] HUD Amneria [Simple] v2.0 Left_bar_bleue61/100[RGSS] HUD Amneria [Simple] v2.0 Empty_bar_bleue  (61/100)
Gamescore:
[RGSS] HUD Amneria [Simple] v2.0 Left_bar_bleue0/0[RGSS] HUD Amneria [Simple] v2.0 Empty_bar_bleue  (0/0)

https://rmbrasil.forumeiros.com

Ir para o topo Ir para baixo

Ir para o topo

- Tópicos semelhantes

 
Permissões neste sub-fórum
Não podes responder a tópicos