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
881 기타 Hero Databass 4 file 백호 2009.02.22 797
880 기타 House Decoration System 1.6 by MephistoX (SDK 2.x, MACL 2.x 필요) 1 file Alkaid 2010.09.02 1489
879 HUD HP/SP 상태를 표시해주는 간이 윈도우 3 file 백호 2009.02.21 3067
878 HUD HP과 SP 바 19 Man... 2008.11.04 4534
877 HUD HUD Menu 1.2 by Raziel 6 file 백호 2009.02.22 2390
» HUD HUD Menu 2.0 by Raziel 3 Alkaid 2010.09.07 2031
875 기타 ID띄우기 스크립트(新) 3 백호 2009.02.22 1280
874 저장 Improved Save by gerrtunk 2 file Alkaid 2010.10.13 1983
873 변수/스위치 Initial Switches and Variables by PK8 (XP/VX/VXA) Alkaid 2012.09.14 1296
872 저장 Inn & Save Point System by SephirothSpawn (SDK호환) 1 file 백호 2009.02.22 810
871 기타 Introduction & optional Splash 2.1 by SephirothSpawn (SDK호환) 1 백호 2009.02.22 860
870 아이템 Item Acquired Window by SiliconHero@rmxp.net 백호 2009.02.22 1096
869 키입력 Key Simulator by Fantasist 4 습작 2013.05.01 1143
868 키입력 Keyboard Input Module v5 by Near Fantastica (SDK호환) 백호 2009.02.22 1075
867 이름입력 Keyboard-Controlled Name Input Script by BlueScope@rmxp.org 1 file 백호 2009.02.22 1769
866 기타 KGC - RMXP 스크립트 개발용 프로젝트 1.01 4 file 백호 2009.02.22 1515
865 스킬 KGC - 도주스킬 스크립트 백호 2009.02.22 1193
864 기타 KGC - 입수 경험치&금 증가 스크립트 백호 2009.02.22 1299
863 기타 KGC 디버거 (최신 올라온 것에 비해 성능은 딸리지만) file 백호 2009.02.22 929
862 메뉴 KGC 메뉴화면 개조 스크립트 번역 3 file 백호 2009.02.22 1940
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