UltimaForum

Skrypty [XP] - Paski hp i sp

HESEE - Wto 13 Kwi, 2010 20:14
Temat postu: Paski hp i sp
Skrypt pokazujący pasek HP (czerwony) i SP (niebieski), może komuś się przyda.

Spoiler:

Kod:
#==============================================================================
# Paski HP i SP
# Autor: nieznany
#==============================================================================
# Umieść nad Main
#==============================================================================
# Kolor paska HP
HP_GAUGE = Color.new(70, 255, 70) # Kolor RGB

# Kolor paska SP
SP_GAUGE = Color.new(70, 70, 255) # Kolor RGB

#==============================================================================
# Window_Base
#==============================================================================
class Window_Base < Window
  def draw_actor_hp(actor, x, y, width = 144)
    self.contents.fill_rect(x + 38 + width - 144, y + 24, 102, 1, Color.new(192, 192, 192))
    self.contents.fill_rect(x + 38 + width - 144, y + 29, 102, 1, Color.new(192, 192, 192))
    self.contents.fill_rect(x + 38 + width - 144, y + 24, 1, 6, Color.new(192, 192, 192))
    self.contents.fill_rect(x + 139 + width - 144, y + 24, 1, 5, Color.new(192, 192, 192))
    gw = actor.hp * 100 / actor.maxhp
    self.contents.fill_rect(x + 39 + width - 144 + (100 - gw), y + 25, gw, 4, HP_GAUGE)
    self.contents.fill_rect(x + 39 + width - 144, y + 25, 100 - gw, 4, Color.new(255, 70, 70))
    if width - 32 >= 108
      flag = true
    elsif width - 32 >= 48
      flag = false
    end
    hp_x = x + width - 108
    if flag
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
    end
    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 - 3, 48, 32, actor.hp.to_s, 2)
    self.contents.font.color = normal_color
    self.contents.draw_text(hp_x + 48, y - 3, 12, 32, "/", 1)
    self.contents.draw_text(hp_x + 60, y - 3, 48, 32, actor.maxhp.to_s)
  end

  def draw_actor_sp(actor, x, y, width = 144)
    self.contents.fill_rect(x + 38 + width - 144, y + 24, 102, 1, Color.new(192, 192, 192))
    self.contents.fill_rect(x + 38 + width - 144, y + 29, 102, 1, Color.new(192, 192, 192))
    self.contents.fill_rect(x + 38 + width - 144, y + 24, 1, 6, Color.new(192, 192, 192))
    self.contents.fill_rect(x + 139 + width - 144, y + 24, 1, 5, Color.new(192, 192, 192))
    gw = actor.sp * 100 / actor.maxsp
    self.contents.fill_rect(x + 39 + width - 144 + (100 - gw), y + 25, gw, 4, SP_GAUGE)
    self.contents.fill_rect(x + 39 + width - 144, y + 25, 100 - gw, 4, Color.new(255, 70, 70))
    if width - 32 >= 108
      flag = true
    elsif width - 32 >= 48
      flag = false
    end
    sp_x = x + width - 108
    if flag
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
    end
    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 - 3, 48, 32, actor.sp.to_s, 2)
    self.contents.font.color = normal_color
    self.contents.draw_text(sp_x + 48, y - 3, 12, 32, "/", 1)
    self.contents.draw_text(sp_x + 60, y - 3, 48, 32, actor.maxsp.to_s)
  end
end

#==============================================================================
# Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
  alias hpsp_gauge_refresh refresh
  def refresh
    hpsp_gauge_refresh
    self.contents.font.color = system_color
    self.contents.font.size = 18
    self.contents.draw_text(0, 32, 16, 32, "HP")
    self.contents.draw_text(0, 64, 16, 32, "MP")
  end
end


Screen:
Spoiler:




Izaya - Pon 21 Cze, 2010 16:54

Fajny Skrypt, ale zakładam że to Ty jesteś Autorem, tak?
Bo o Autorach tu nic nie ma. :-|

Czeliosss - Pon 21 Cze, 2010 16:59

On nie jest autorem.
Cytat:
Autor: nieznany

chyba, że on ma taki nick.
Pzdr.

Izaya - Sro 23 Cze, 2010 14:15

Ah, rozumiem.

[ Dodano: Sro 23 Cze, 2010 15:15 ]
przepraszam, nie zaglądąłem do Skryptu :-P

wito35 - Czw 24 Cze, 2010 08:20

Czy da się dodać pasek EXP, było by jakieś urozmaicenie, a poza tym nigdzie nie moge takiego skryptu znaleźć.

Powered by phpBB modified by Przemo © 2003 phpBB Group