UltimaForum

Skrypty [XP] - Prosty system pasków

PaKiTos - Sro 20 Paź, 2010 14:13
Temat postu: Prosty system pasków
Napisał/a amaranth. Jest to system pasków, chyba każdy wie co to...
Zdjęcie:

Instalacja:
1.Na końcu Window_Base dajemy:
Spoiler:

Kod:
  #--------------------------------------------------------------------------
  # ● Draw a gradient bar
  #     actor : actor assigned to the bar
  #     x          : X coordinate of the upper-left pixel of the bar
  #     y          : Y coordinate of the upper-left pixel of the bar
  #     bar_width  : width of the bar
  #     bar_height : height of the bar
  #     current    : current value to compare (eg. hp, sp, exp)
  #     max        : max value to compare (eg. max hp, max sp, max exp)
  #     color      : base color to use (eg. text_color(5))
  #-------------------------------------------------------------------------- 
  def draw_bar(actor, x, y, bar_width, bar_height, current, max, color)
   
    adj_width = bar_width - 4
    adj_height = bar_height - 4
   
    # outline of bar
    border_color = Color.new(255, 255, 255, 255)
    self.contents.fill_rect(x + 3, y + 8, bar_width, bar_height, border_color)
   
    # background of bar
    background_color = Color.new(0, 0, 0, 255)
    self.contents.fill_rect(x + 5, y + 10, adj_width, adj_height, background_color)
   
    # current bar
    if max != 0

      percent = (current * 100) / max
      adj_width = (adj_width * percent) / 100 
     
      for i in 1..adj_width
        color.red += 1
        color.blue += 1
        color.green += 1
        self.contents.fill_rect(x + 5, y + 10, adj_width, adj_height, color)
        x += 1
        adj_width -= 1
      end     
           
    end   
   
  end


2.Jako funkcję refresh w Window_MenuStatus dajemy:
Spoiler:

Kod:
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      @leader = ""
      x = 40
      y = i * 80
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x-25, y + 60)
     
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x, y + 15)
 
      draw_bar(actor, x + 140, y, 120, 16, actor.hp, actor.maxhp, text_color(3))     
      draw_actor_hp(actor, x + 115, y)
     
      draw_bar(actor, x + 140, y + 20, 120, 16, actor.sp, actor.maxsp, text_color(4))           
      draw_actor_sp(actor, x + 115, y + 20) 
     
      draw_actor_state(actor, x + 280, y + 20) 
      draw_actor_level(actor, x + 280, y + 40)     
     
    end


Jakby ktoś nie zrozumiał instrukcja po angielsku: http://www.rpgrevolution....showtopic=24983

Itaki - Sro 20 Paź, 2010 21:38

Nie rozumiem tej funkcji refresh wytłumacz jaśniej
PaKiTos - Pią 22 Paź, 2010 14:10

To sobie poszukaj w Window_MenuStatus nie rozumiem was jak chcecie wklejać skrypty to nauczcie się czegoś o nich
Lord Voldemort - Czw 10 Mar, 2011 22:30

Wkleiłem wszystko i wyskakuje błąd:
Kod:
Script 'Window_MenuStatus' line 54: SyntaxError occured.

54 linijka to:
Kod:
end

Legendarny - Wto 26 Lip, 2011 12:56

Mam ten sam problem...
Melvin - Wto 26 Lip, 2011 13:03

Lord Voldemort, Legendarny, zabrakło Wa jednego "end".
Wstawcie jeszcze jedno i będzie śmigać.


Powered by phpBB modified by Przemo © 2003 phpBB Group