XP 스크립트

class Window_HP < Window_Base
  def initialize
    super(0, 0, 180, 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, 170, 30, @show_text)
  end
  def actor
    $game_party.actors[0] # <- 파티 0번째
  end
  def update
    super
    text = sprintf("체력: %4d / %4d", actor.hp.to_i, actor.maxhp.to_i)
    if @show_text != text
      @show_text = text
      refresh
    end
  end
end

class Scene_Map
  alias update_window_hp update
  def update
    update_window_hp
    @window_hp = Window_HP.new unless @window_hp
    @window_hp.update
    unless $scene.is_a?(Scene_Map)
      @window_hp.dispose
      @window_hp = nil
    end
  end
end


원본은 비밀님의 경험치 %를 필드에 출력하는 소스입니다.

HP: 534/768 이런식으로 출력됩니다.


Tip & Tech. 1 : text = sprintf("체력: %4d / %4d", actor.hp.to_i, actor.maxhp.to_i)에서 'actor.hp.to_i' 와 'actor.maxhp.to_i' 를 어떤걸로 수정하느냐에 따라서 출력되는 데이터가 변경됩니다.

ex. 1) 'actor.hp.to_i' 와 'actor.maxhp.to_i'를 'actor.sp.to_i' 'actor.maxsp.to_i'로 바꿔주시면 마력이 표시됩니다.

ex. 2) 'actor.hp.to_i' 와 'actor.maxhp.to_i'를 'actor.exp_s' 'actor.next_exp_s'로 바꿔주시면 경험치가 표시됩니다. 형식은 '현재까지 쌓은 경험치' / '도달 목표 경험치' 입니다. (예 : 100 / 1024 이런식으로..)



Tip & Tech. 2 : %4d는 자릿수를 맞추기 위해서 (4자리) 수정한 것입니다. 알맞게 조절해서 사용하세요.

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '4'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6203
254 기타 (T-RPG) 데미지 표시 시의 폰트를 설정 백호 2009.02.22 1349
253 기타 3d 렌더링스크립트 어렵게 찾음 9 라구나 2011.03.05 3610
252 기타 3D스크립트 48 file ok하승헌 2010.02.18 3809
251 기타 4방향 마우스 스크립트 12 file 아방스 2009.02.28 2666
250 기타 8방향 마우스 스크립트 10 file 아방스 2009.02.28 4063
249 기타 ABS 몬스터 HP 게이지 바 11 백호 2009.02.22 2486
248 기타 Activation_system file 백호 2009.02.22 775
247 기타 Advanced Gold display by Dubealex 1 백호 2009.02.22 761
246 기타 Advanced Gold Display by Dubealex (돈 액수를 세자리씩 끊어 표기) 2 Alkaid 2010.11.18 1562
245 기타 Advanced Weather System (AWS) 3 file 백호 2009.02.22 1272
244 기타 AMS-Advanced Message Script Edited by Dubleax 3 file 백호 2009.02.21 766
243 기타 AMS___Advanced_Message_Script 1 file 백호 2009.02.22 889
242 기타 Anti Event Lag Script 3 백호 2009.02.21 1057
241 기타 appletree님 요청) 화면 명암 주기 3 file 뮤바보 2013.01.31 2727
240 기타 ATS-Advanced Time System 1 file 백호 2009.02.21 964
239 기타 Boat Script 백호 2009.02.21 729
238 기타 Book Event v2 by Bruth 5 백호 2009.02.22 1694
237 기타 CG그림 감상 스크립트 file 백호 2009.02.21 1735
236 기타 CG모드 도입 스크립트 file 백호 2009.02.21 1383
235 기타 Chaos Project Debug System 1.06b by Blizzard file Alkaid 2010.09.07 1370
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 Next
/ 13