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 6153
14 HUD 캐릭터 아래 SP,HP표시해주는 스크립트 33 file 김!제스! 2010.08.04 4269
13 HUD 강화 나침반 스크립트 (원본 by 허걱) 16 file JACKY 2010.08.16 3105
» HUD HUD Menu 2.0 by Raziel 3 Alkaid 2010.09.07 2031
11 HUD MOG_C_HUD. 6 file Bera 2010.09.11 2329
10 HUD MOG_Active_Hud 3 file Bera 2010.09.11 2468
9 HUD [게이지바]2.0버젼「체력,마나,경험치,직업,캐릭터,레벨,돈,맵이름」(HelloCoa2Ver2.0) 67 file 코아 코스튬 2010.10.23 5550
8 HUD [게이지바]3.0버젼「현재시간, 플레이시간, 걸음수, 윈도우 이동 추가」(HelloCoa2Ver3.0) 63 file 코아 코스튬 2010.10.30 4921
7 HUD 주인공,NPC이름 머리 나타내기 49 file 송긔 2010.11.28 6059
6 HUD 시트르산의 나침반 스크립트 19 file 시트르산 2011.01.23 3195
5 HUD 맵 이름을 표시해주는 스크립트입니다. 25 임희성 2011.02.12 2936
4 HUD 맵이름표시 6 캉쿤 2011.09.14 2381
3 HUD 맵 이름 표시 스크립트 수정하기 (계속 뜨게 하기, 위치 바꾸기 등) 3 뮤리온。 2011.10.08 2886
2 HUD 맵 이름 표시와 미니맵을 같이하자 8 file 뮤리온。 2011.10.08 4191
1 HUD 맵이름 스크립트 1 file 긔염둥이♥ 2012.05.19 2913
Board Pagination Prev 1 2 Next
/ 2