RPGXP 스크립트

경험치 표시 스크립트

by 청담 posted Sep 24, 2013
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

class Game_Actor < Game_Battler 
  def exp_rate 
    if @exp_list[@level+1] - @exp_list[@level] > 0 
      return (@exp - @exp_list[@level]).to_f / (@exp_list[@level+1] - @exp_list[@level]).to_f 
    else 
      return 0 
    end 
  end 
end 
class Window_ExpRate < Window_Base 
  def initialize 
    super(0, 0, 125, 55) # <- location, size 
    self.contents = Bitmap.new(width - 32, height - 32) 
    
    self.contents.font = Font.new("궁서체", 16) # <- font, size 
    self.opacity = 0 
self.back_opacity = 0 
  end 
  def refresh 
    self.contents.clear 
    self.contents.draw_text(0, 0, 100, 30, @show_text) 
  end 
  def actor 
    $game_party.actors[0] # <- 파티 0번째 
  end 
  def update 
    super 
    text = sprintf("경험치: %d%%", (actor.exp_rate * 100).to_i) 
    if @show_text != text 
      @show_text = text 
      refresh 
    end 
  end 
end 
class Scene_Map 
  alias update_before_map update 
  def update 
    update_before_map 
    @window_exp = Window_ExpRate.new unless @window_exp 
    @window_exp.update 
    unless $scene.is_a?(Scene_Map) 
      @window_exp.dispose 
      @window_exp = nil 
    end 
  end 
end 


출처: 게임공작소