XP 스크립트

Source Thread: http://www.rmvxp.com/showthread.php?t=613
(1.2 is here: http://www.creationasylum.net/forum/index.php?showtopic=9869&st=0)

  맵 화면상에서 현재 파티에 있는 액터의 HP/SP/EXP를 보여줍니다.  HUD는 스위치를 사용하여 on/off 가능.  2.0은 기존버전의 랙 문제와 버그를 수정한 것입니다.(문제는 이 이후로 업데이트된 것을 본 적이 없다는 것이지만)


 

#==============================================================================
# ** Hud Menu
#==============================================================================
# Raziel
# Version 2.0
# 2007-08-18
#------------------------------------------------------------------------------
#===============================================================================
# * Module Raz_Hud
#===============================================================================

module Raz_Hud
#switch to show/hide the hud
SWITCH_ID = 1
#set it to true to center the hud if there are less than four party members
Center_hud = true
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================

class Scene_Map
#----------------------------------------------------------------------------
# * Alias Listings
#----------------------------------------------------------------------------
alias raz_hud_main main
alias raz_hud_update update
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
@hud_dummy = []
for i in 0...$game_party.actors.size
@hud_dummy[i] = Window_Dummy.new(i)
end
@hud_window = Window_HUD.new
raz_hud_main
@hud_window.dispose
@hud_dummy.each { |hud| hud.dispose }
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@hud_dummy.each {|hud| hud.visible = $game_switches[Raz_Hud::SWITCH_ID]}
if @hud_dummy[$game_party.actors.size] != nil
@hud_dummy.each{|hud| hud.dispose}
@hud_dummy = []
for i in 0...$game_party.actors.size
@hud_dummy[i] = Window_Dummy.new(i)
end
end
@hud_window.update
raz_hud_update
end
end
#===============================================================================
# * Window_HUD
#===============================================================================

class Window_HUD < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 800, 600)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.visible = $game_switches[Raz_Hud::SWITCH_ID]
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@old_hp, @old_sp, @old_exp, @old_size = [],[],[],$game_party.actors.size
for actor in $game_party.actors
@old_hp << actor.hp; @old_sp << actor.sp; @old_exp << actor.exp
a = $game_party.actors.size - 1
center = Raz_Hud::Center_hud == true ? (240 - (a * 80)) : 0
x = ($game_party.actors.index(actor) * 160 + 25) + center
self.contents.font.size = 21
draw_actor_graphic(actor, x - 15, 445)
self.contents.font.color = normal_color
self.contents.draw_text(x - 25, 360, 100, 32, actor.name)
draw_slant_bar(x + 8, 396, actor.hp, actor.maxhp, 100, 6)
draw_slant_bar(x + 8, 416, actor.sp, actor.maxsp, 100, 6, Color.new(0, 0, 150), Color.new(60, 155, 155))
now_exp = actor.level == 99 ? 1 : actor.now_exp
next_exp = actor.level == 99 ? 1 : actor.next_exp
draw_slant_bar(x + 8, 436, now_exp, next_exp, 100, 6, Color.new(0, 150, 0), Color.new(60, 255, 60))
self.contents.font.size = 16
draw_actor_state(actor, x + 45, 360)
self.contents.font.color = normal_color
self.contents.font.bold = true
self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(x + 16, 382, 100, 32, "#{actor.hp}/#{actor.maxhp}", 1)
self.contents.font.color = actor.sp == 0 ? crisis_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(x + 16, 402, 100, 32, "#{actor.sp}/#{actor.maxsp}", 1)
self.contents.font.color = system_color
self.contents.font.size = 20
self.contents.font.bold = false
self.contents.draw_text(x, 384, 50, 32, $data_system.words.hp)
self.contents.draw_text(x, 404, 50, 32, $data_system.words.sp)
self.contents.draw_text(x, 424, 50, 32, "Exp")
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
refresh if @old_size != $game_party.actors.size
@old_hp.each_with_index {|hp, index| refresh if hp != $game_party.actors[index].hp}
@old_sp.each_with_index {|sp, index| refresh if sp != $game_party.actors[index].sp}
@old_exp.each_with_index {|exp, index| refresh if exp != $game_party.actors[index].exp}
self.visible = $game_switches[Raz_Hud::SWITCH_ID]
end
end
#===============================================================================
# * Window_Dummy
#===============================================================================

class Window_Dummy < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# size: Party's size
#--------------------------------------------------------------------------
def initialize(size)
@old_size = $game_party.actors.size
x = Raz_Hud::Center_hud == true ? 240 - ($game_party.actors.size - 1) * 80 : 0
super(160 * size + x, 372,160, 108)
self.visible = $game_switches[Raz_Hud::SWITCH_ID]
self.opacity = 200
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================

class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Slant Bar (by SephirothSpawn)
#--------------------------------------------------------------------------
def draw_slant_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
for i in 0..height
self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
end
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
end
for i in 1..( (min / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
end
end
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor
#--------------------------------------------------------------------------
# * Now Exp
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Next Exp
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
Comment '3'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6202
821 전투 전투에서도 맵 BGM 연결하는 스크립트 2 file 백호 2009.02.21 1130
820 퀘스트 퀘스트 다이어리 15 백호 2009.02.21 4408
819 타이틀/게임오버 타이틀 가기전에 오프닝 이벤트 시작하기?! 13 file 백호 2009.02.21 3631
818 전투 물리친 적의수 표시 file 백호 2009.02.21 1131
817 전투 에너미들도 게이지바 달고싶다~!! 14 file 백호 2009.02.21 4100
816 스킬 패시브 스킬 (출처 RPGXP 포럼 - 후우님) 18 백호 2009.02.21 2915
815 전투 SimpleAction (출처 -RPGXP 포럼 비밀소년님의 자작품) 1 file 백호 2009.02.21 1194
814 메뉴 메뉴에서 실제시간 보기 2 백호 2009.02.21 1124
813 기타 디버그 윈도우 강화! 3 file 백호 2009.02.21 1550
812 메뉴 새로운 메뉴 시스템 을 한글화 및 약간 개조 3 file 백호 2009.02.21 2203
811 기타 좌표 스크립트 2 백호 2009.02.21 908
810 전투 간단한 액알 스크립트!(1번째) 2 백호 2009.02.21 3166
809 전투 간단 액알 스크립티!(2번째) 2 백호 2009.02.21 2696
808 전투 간단 액알 사용법(3번째) 12 file 백호 2009.02.21 3337
807 키입력 전체 키 사용 스크립트 1 백호 2009.02.21 1424
806 전투 사이드뷰 방식 스크립트. 8 file 백호 2009.02.21 4640
805 전투 배틀포인트 + 배틀샵 1 file 백호 2009.02.21 1272
804 기타 무기 개조 스크립트 file 백호 2009.02.21 1248
803 장비 장비 시 전능력 표시 스크립트 4 file 백호 2009.02.21 1110
802 장비 장비 제련 스크립트 2 file 백호 2009.02.21 1206
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52