#===================================================
# ■ Ring Menu - Show Player Location - Release #1 (Edited By Dubealex)
#===================================================
# For more infos and update, visit:
# www.dubealex.com [OR] X-RPG V2 Forum
#
# Original Ring Menu by: 和希 (From XRXS)
# Original Edit and Fix by: Maki
# Show Player Location Version by: Dubealex
#
# You can customize this script at line #35 - Have fun !!
# If you want to show more stuff, its easy to do, just ask, and I will release
# new version of this edited script !
#
# alex@dubealex.com
#===================================================
#===================================================
# ▼ CLASS Scene_Menu Begins
#===================================================
class Scene_Menu
#--------------------------------------------------------------------------
# œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
# menu_index : ƒRƒ}ƒ"ƒh,̃J[ƒ\ƒ‹‰ŠúˆÊ'u
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
$location_text=[]
$window_size=[]
$ring_menu_text=[]
$chara_select=[]
@window_opacity=[]
@chara_select=[]
@window_position=[]
#---------------------------------------------------------------------------
# ■ Ring Menu Customization Section: (By Dubealex)
#---------------------------------------------------------------------------
# Those variables defines how the script will act.
# Simply change the value by those you want.
# Remember that changing the font size has its limitation due to text space.
#
# ▼ TEXT SETTINGS FOR SHOW PLAYER LOCATION WINDOW:
$location_text[0]="Tahoma" # Font Type
$location_text[1]=22 # Font Size
$location_text[2]=6 # Location Title Color
$location_text[4]=0 # Map Name Color
$location_text[3]="Location:" # Customize the "Location" Title Text
# ▼ SHOW LOCATION WINDOW SETTINS:
@show_location_window=true #Set to false to not use it !
@window_opacity[0]=255 # Border Opacity
@window_opacity[1]=130 # Background Opacity
$window_location_skin="001-Blue01" # Window Skin
@window_position[0]=20 # X Axis Position
@window_position[1]=20 # Y Axis Position
$window_size[0]=160 # Lengh
$window_size[1]=96 # Heigh
# ▼ TEXT SETTINGS FOR INSIDE THE RING MENU:
$ring_menu_text[0]="Tahoma" # Font Type
$ring_menu_text[7]=0 # Font Color
$ring_menu_text[8]=22 # Font Size
$ring_menu_text[1]="Items" # Items Menu Text
$ring_menu_text[2]="Skills" # Skills Menu Text
$ring_menu_text[3]="Equip" # Equip Menu Text
$ring_menu_text[4]="Stats" # Stats Menu Text
$ring_menu_text[5]="Save" # Save Menu Text
$ring_menu_text[6]="Quit" # Quit Menu Text
# ▼ CHARACTER SELECTION WINDOW SETTINGS :
@chara_select[0]=400 # X Axis Position
@chara_select[1]=0 # Y Axis Position
$chara_select[0]="Tahoma" # Font Type
$chara_select[1]=0 # Font Color
$chara_select[5]=22 # Font Size
$chara_select[2]=255 # Window Border Opacity
$chara_select[3]=130 # Window Background Opacity
$chara_select[4]="001-Blue01" # Window Skin to use
#--------------------------------------------------------------------------
end
#--------------------------------------------------------------------------
# œ ƒƒCƒ"ˆ--
#--------------------------------------------------------------------------
def main
# Show Player Location Feature:
if @show_location_window==true
@window_location = Window_Location.new
@window_location.x = @window_position[0]
@window_location.y = @window_position[1]
@window_location.opacity = @window_opacity[0]
@window_location.back_opacity = @window_opacity[1]
end
#End of Show Player Location
# ƒXƒvƒ‰ƒCƒgƒZƒbƒg,ðì¬
@spriteset = Spriteset_Map.new
# ƒRƒ}ƒ"ƒhƒEƒBƒ"ƒhƒE,ðì¬
px = $game_player.screen_x - 15
py = $game_player.screen_y - 24
@command_window = Window_RingMenu.new(px,py)
@command_window.index = @menu_index
# ƒp[ƒeƒBl",ª 0 l,Ìê‡
if $game_party.actors.size == 0
# ƒAƒCƒeƒ€AƒXƒLƒ‹A'•"õAƒXƒe[ƒ^ƒX,ð-³Œø‰»
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
@command_window.z = 100
# ƒZ[ƒu‹ÖŽ~,Ìê‡
if $game_system.save_disabled
# ƒZ[ƒu,ð-³Œø,É,·,é
@command_window.disable_item(4)
end
# ƒXƒe[ƒ^ƒXƒEƒBƒ"ƒhƒE,ðì¬
@status_window = Window_RingMenuStatus.new
@status_window.x = @chara_select[0]
@status_window.y = @chara_select[1]
@status_window.z = 200
@status_window.opacity=$chara_select[2]
@status_window.back_opacity=$chara_select[3]
@status_window.visible = false
# ƒgƒ‰ƒ"ƒWƒVƒ‡ƒ"ŽÀs
Graphics.transition
# ƒƒCƒ"ƒ‹[ƒv
loop do
# ƒQ[ƒ€‰æ-Ê,ðXV
Graphics.update
# "ü--Íî•ñ,ðXV
Input.update
# ƒtƒŒ[ƒ€XV
update
# ‰æ-Ê,ªØ,è'Ö,í,Á,½,烋[ƒv,ð'†'f
if $scene != self
break
end
end
# ƒgƒ‰ƒ"ƒWƒVƒ‡ƒ"€"õ
Graphics.freeze
# ƒXƒvƒ‰ƒCƒgƒZƒbƒg,ð‰ð•ú
@spriteset.dispose
# ƒEƒBƒ"ƒhƒE,ð‰ð•ú
if @show_location_window==true
@window_location.dispose
end
@command_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# œ ƒtƒŒ[ƒ€XV
#--------------------------------------------------------------------------
def update
# ƒEƒBƒ"ƒhƒE,ðXV
if @show_location_window==true
@window_location.update
end
@command_window.update
@status_window.update
# ƒRƒ}ƒ"ƒhƒEƒBƒ"ƒhƒE,ªƒAƒNƒeƒBƒu,Ìê‡: update_command ,ðŒÄ,Ô
if @command_window.active
update_command
return
end
# ƒXƒe[ƒ^ƒXƒEƒBƒ"ƒhƒE,ªƒAƒNƒeƒBƒu,Ìê‡: update_status ,ðŒÄ,Ô
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# œ ƒtƒŒ[ƒ€XV (ƒRƒ}ƒ"ƒhƒEƒBƒ"ƒhƒE,ªƒAƒNƒeƒBƒu,Ìê‡)
#--------------------------------------------------------------------------
def update_command
# B ƒ{ƒ^ƒ",ª‰Ÿ,³,ê,½ê‡
if Input.trigger?(Input::B)
# ƒLƒƒƒ"ƒZƒ‹ SE ,ð‰‰'t
$game_system.se_play($data_system.cancel_se)
# ƒ}ƒbƒv‰æ-Ê,ÉØ,è'Ö,¦
$scene = Scene_Map.new
return
end
# C ƒ{ƒ^ƒ",ª‰Ÿ,³,ê,½ê‡
if Input.trigger?(Input::C)
# ƒp[ƒeƒBl",ª 0 l,ÅAƒZ[ƒuAƒQ[ƒ€I--¹ˆÈŠO,̃Rƒ}ƒ"ƒh,Ìê‡
if $game_party.actors.size == 0 and @command_window.index < 4
# ƒuƒU[ SE ,ð‰‰'t
$game_system.se_play($data_system.buzzer_se)
return
end
# ƒRƒ}ƒ"ƒhƒEƒBƒ"ƒhƒE,̃J[ƒ\ƒ‹ˆÊ'u,Å•ªŠò
case @command_window.index
when 0 # ƒAƒCƒeƒ€
# Œˆ'è SE ,ð‰‰'t
$game_system.se_play($data_system.decision_se)
# ƒAƒCƒeƒ€‰æ-Ê,ÉØ,è'Ö,¦
$scene = Scene_Item.new
when 1 # ƒXƒLƒ‹
# Œˆ'è SE ,ð‰‰'t
$game_system.se_play($data_system.decision_se)
# ƒXƒe[ƒ^ƒXƒEƒBƒ"ƒhƒE,ðƒAƒNƒeƒBƒu,É,·,é
@command_window.active = false
@status_window.active = true
@status_window.visible = true
@status_window.index = 0
when 2 # '•"õ
# Œˆ'è SE ,ð‰‰'t
$game_system.se_play($data_system.decision_se)
# ƒXƒe[ƒ^ƒXƒEƒBƒ"ƒhƒE,ðƒAƒNƒeƒBƒu,É,·,é
@command_window.active = false
@status_window.active = true
@status_window.visible = true
@status_window.index = 0
when 3 # ƒXƒe[ƒ^ƒX
# Œˆ'è SE ,ð‰‰'t
$game_system.se_play($data_system.decision_se)
# ƒXƒe[ƒ^ƒXƒEƒBƒ"ƒhƒE,ðƒAƒNƒeƒBƒu,É,·,é
@command_window.active = false
@status_window.active = true
@status_window.visible = true
@status_window.index = 0
when 4 # ƒZ[ƒu
# ƒZ[ƒu‹ÖŽ~,Ìê‡
if $game_system.save_disabled
# ƒuƒU[ SE ,ð‰‰'t
$game_system.se_play($data_system.buzzer_se)
return
end
# Œˆ'è SE ,ð‰‰'t
$game_system.se_play($data_system.decision_se)
# ƒZ[ƒu‰æ-Ê,ÉØ,è'Ö,¦
$scene = Scene_Save.new
when 5 # ƒQ[ƒ€I--¹
# Œˆ'è SE ,ð‰‰'t
$game_system.se_play($data_system.decision_se)
# ƒQ[ƒ€I--¹‰æ-Ê,ÉØ,è'Ö,¦
$scene = Scene_End.new
end
return
end
# ƒAƒjƒ[ƒVƒ‡ƒ"'†,È,çƒJ[ƒ\ƒ‹,̈--,ðs,í,È,¢
return if @command_window.animation?
# ªor© ƒ{ƒ^ƒ",ª‰Ÿ,³,ê,½ê‡
if Input.press?(Input::UP) or Input.press?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@command_window.setup_move_move(Window_RingMenu::MODE_MOVEL)
return
end
# «or¨ ƒ{ƒ^ƒ",ª‰Ÿ,³,ê,½ê‡
if Input.press?(Input::DOWN) or Input.press?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@command_window.setup_move_move(Window_RingMenu::MODE_MOVER)
return
end
end
#--------------------------------------------------------------------------
# œ ƒtƒŒ[ƒ€XV (ƒXƒe[ƒ^ƒXƒEƒBƒ"ƒhƒE,ªƒAƒNƒeƒBƒu,Ìê‡)
#--------------------------------------------------------------------------
def update_status
# B ƒ{ƒ^ƒ",ª‰Ÿ,³,ê,½ê‡
if Input.trigger?(Input::B)
# ƒLƒƒƒ"ƒZƒ‹ SE ,ð‰‰'t
$game_system.se_play($data_system.cancel_se)
# ƒRƒ}ƒ"ƒhƒEƒBƒ"ƒhƒE,ðƒAƒNƒeƒBƒu,É,·,é
@command_window.active = true
@status_window.active = false
@status_window.visible = false
@status_window.index = -1
return
end
# C ƒ{ƒ^ƒ",ª‰Ÿ,³,ê,½ê‡
if Input.trigger?(Input::C)
# ƒRƒ}ƒ"ƒhƒEƒBƒ"ƒhƒE,̃J[ƒ\ƒ‹ˆÊ'u,Å•ªŠò
case @command_window.index
when 1 # ƒXƒLƒ‹
# ,±,̃AƒNƒ^[,Ìs"®§ŒÀ,ª 2 ˆÈã,Ìê‡
if $game_party.actors[@status_window.index].restriction >= 2
# ƒuƒU[ SE ,ð‰‰'t
$game_system.se_play($data_system.buzzer_se)
return
end
# Œˆ'è SE ,ð‰‰'t
$game_system.se_play($data_system.decision_se)
# ƒXƒLƒ‹‰æ-Ê,ÉØ,è'Ö,¦
$scene = Scene_Skill.new(@status_window.index)
when 2 # '•"õ
# Œˆ'è SE ,ð‰‰'t
$game_system.se_play($data_system.decision_se)
# '•"õ‰æ-Ê,ÉØ,è'Ö,¦
$scene = Scene_Equip.new(@status_window.index)
when 3 # ƒXƒe[ƒ^ƒX
# Œˆ'è SE ,ð‰‰'t
$game_system.se_play($data_system.decision_se)
# ƒXƒe[ƒ^ƒX‰æ-Ê,ÉØ,è'Ö,¦
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
#===================================================
# ▲ CLASS Scene_Menu Ends
#===================================================
#===================================================
# ▼ CLASS Window_RingMenu Begins
#===================================================
class Window_RingMenu < Window_Base
#--------------------------------------------------------------------------
# › ƒNƒ‰ƒX'è"
#--------------------------------------------------------------------------
STARTUP_FRAMES = 20
MOVING_FRAMES = 5
RING_R = 64
ICON_ITEM = RPG::Cache.icon("034-Item03")
ICON_SKILL = RPG::Cache.icon("044-Skill01")
ICON_EQUIP = RPG::Cache.icon("001-Weapon01")
ICON_STATUS = RPG::Cache.icon("050-Skill07")
ICON_SAVE = RPG::Cache.icon("038-Item07")
ICON_EXIT = RPG::Cache.icon("046-Skill03")
ICON_DISABLE= RPG::Cache.icon("")
SE_STARTUP = "056-Right02"
MODE_START = 1
MODE_WAIT = 2
MODE_MOVER = 3
MODE_MOVEL = 4
#--------------------------------------------------------------------------
# › ƒAƒNƒZƒT
#--------------------------------------------------------------------------
attr_accessor :index
#--------------------------------------------------------------------------
# œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
#--------------------------------------------------------------------------
def initialize( center_x, center_y )
super(0, 0, 640, 480)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = $ring_menu_text[0]
self.contents.font.color = text_color($ring_menu_text[7])
self.contents.font.size = $ring_menu_text[8]
self.opacity = 0
self.back_opacity = 0
s1 = $ring_menu_text[1]
s2 = $ring_menu_text[2]
s3 = $ring_menu_text[3]
s4 = $ring_menu_text[4]
s5 = $ring_menu_text[5]
s6 = $ring_menu_text[6]
@commands = [ s1, s2, s3, s4, s5, s6 ]
@item_max = 6
@index = 0
@items = [ ICON_ITEM, ICON_SKILL, ICON_EQUIP, ICON_STATUS, ICON_SAVE, ICON_EXIT ]
@disabled = [ false, false, false, false, false, false ]
@cx = center_x - 16
@cy = center_y - 16
setup_move_start
refresh
end
#--------------------------------------------------------------------------
# œ ƒtƒŒ[ƒ€XV
#--------------------------------------------------------------------------
def update
super
refresh
end
#--------------------------------------------------------------------------
# œ ‰æ-ÊÄ•`‰æ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# ƒAƒCƒRƒ",ð•`‰æ
case @mode
when MODE_START
refresh_start
when MODE_WAIT
refresh_wait
when MODE_MOVER
refresh_move(1)
when MODE_MOVEL
refresh_move(0)
end
# ƒAƒNƒeƒBƒu,ȃRƒ}ƒ"ƒh-¼•\ަ
rect = Rect.new(@cx - 272, @cy + 24, self.contents.width-32, 32)
self.contents.draw_text(rect, @commands[@index],1)
end
#--------------------------------------------------------------------------
# › ‰æ-ÊÄ•`‰æ(‰Šú‰»Žž)
#--------------------------------------------------------------------------
def refresh_start
d1 = 2.0 * Math::PI / @item_max
d2 = 1.0 * Math::PI / STARTUP_FRAMES
r = RING_R - 1.0 * RING_R * @steps / STARTUP_FRAMES
for i in 0...@item_max
j = i - @index
d = d1 * j + d2 * @steps
x = @cx + ( r * Math.sin( d ) ).to_i
y = @cy - ( r * Math.cos( d ) ).to_i
draw_item(x, y, i)
end
@steps -= 1
if @steps < 1
@mode = MODE_WAIT
end
end
#--------------------------------------------------------------------------
# › ‰æ-ÊÄ•`‰æ('Ò‹@Žž)
#--------------------------------------------------------------------------
def refresh_wait
d = 2.0 * Math::PI / @item_max
for i in 0...@item_max
j = i - @index
x = @cx + ( RING_R * Math.sin( d * j ) ).to_i
y = @cy - ( RING_R * Math.cos( d * j ) ).to_i
draw_item(x, y, i)
end
end
#--------------------------------------------------------------------------
# › ‰æ-ÊÄ•`‰æ(‰ñ"]Žž)
# mode : 0="½ŽžŒv‰ñ,è 1=ŽžŒv‰ñ,è
#--------------------------------------------------------------------------
def refresh_move( mode )
d1 = 2.0 * Math::PI / @item_max
d2 = d1 / MOVING_FRAMES
d2 *= -1 if mode != 0
for i in 0...@item_max
j = i - @index
d = d1 * j + d2 * @steps
x = @cx + ( RING_R * Math.sin( d ) ).to_i
y = @cy - ( RING_R * Math.cos( d ) ).to_i
draw_item(x, y, i)
end
@steps -= 1
if @steps < 1
@mode = MODE_WAIT
end
end
#--------------------------------------------------------------------------
# œ €-Ú,Ì•`‰æ
# x :
# y :
# i : €-Ú"Ô†
#--------------------------------------------------------------------------
def draw_item(x, y, i)
#p "x=" + x.to_s + " y=" + y.to_s + " i=" + @items[i].to_s
rect = Rect.new(0, 0, @items[i].width, @items[i].height)
if @index == i
self.contents.blt( x, y, @items[i], rect )
if @disabled[@index]
self.contents.blt( x, y, ICON_DISABLE, rect )
end
else
self.contents.blt( x, y, @items[i], rect, 128 )
if @disabled[@index]
self.contents.blt( x, y, ICON_DISABLE, rect, 128 )
end
end
end
#--------------------------------------------------------------------------
# œ €-Ú,ð-³Œø,É,·,é
# index : €-Ú"Ô†
#--------------------------------------------------------------------------
def disable_item(index)
@disabled[index] = true
end
#--------------------------------------------------------------------------
# › ‰Šú‰»ƒAƒjƒ[ƒVƒ‡ƒ",Ì€"õ
#--------------------------------------------------------------------------
def setup_move_start
@mode = MODE_START
@steps = STARTUP_FRAMES
if SE_STARTUP != nil and SE_STARTUP != ""
Audio.se_play("Audio/SE/" + SE_STARTUP, 80, 100)
end
end
#--------------------------------------------------------------------------
# › ‰ñ"]ƒAƒjƒ[ƒVƒ‡ƒ",Ì€"õ
#--------------------------------------------------------------------------
def setup_move_move(mode)
if mode == MODE_MOVER
@index -= 1
@index = @items.size - 1 if @index < 0
elsif mode == MODE_MOVEL
@index += 1
@index = 0 if @index >= @items.size
else
return
end
@mode = mode
@steps = MOVING_FRAMES
end
#--------------------------------------------------------------------------
# › ƒAƒjƒ[ƒVƒ‡ƒ"'†,©,Ç,¤,©
#--------------------------------------------------------------------------
def animation?
return @mode != MODE_WAIT
end
end
#===================================================
# ▲ CLASS Window_RingMenu Ends
#===================================================
#===================================================
# ▼ CLASS Window_RingMenuStatus Begins
#===================================================
class Window_RingMenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
#--------------------------------------------------------------------------
def initialize
super(204, 64, 232, 352)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = $chara_select[5]
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# œ ƒŠƒtƒŒƒbƒVƒ...
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.windowskin = RPG::Cache.windowskin($chara_select[4])
self.contents.font.name = $chara_select[0]
self.contents.font.color = text_color($chara_select[1])
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 80
y = 80 * i
actor = $game_party.actors[i]
draw_actor_graphic(actor, x - 40, y + 80)
draw_actor_name(actor, x, y + 24)
end
end
#--------------------------------------------------------------------------
# œ ƒJ[ƒ\ƒ‹,Ì‹éŒ`XV
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
end
end
end
#===================================================
# ▲ CLASS Window_RingMenuStatus Ends
#===================================================
#===================================================
# ▼ CLASS Game_Map Additional Code Begins
#===================================================
class Game_Map
#Dubealex Addition (from XRXS) to show Map Name on screen
def name
$map_infos[@map_id]
end
end
#===================================================
# ▲ CLASS Game_Map Additional Code Ends
#===================================================
#===================================================
# ▼ CLASS Scene_Title Additional Code Begins
#===================================================
class Scene_Title
#Dubealex Addition (from XRXS) to show Map Name on screen
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
end
#===================================================
# ▲ CLASS Scene_Title Additional Code Ends
#===================================================
#===================================================
# ▼ CLASS Window_Location Begins
#===================================================
class Window_Location < Window_Base
def initialize
super(0, 0, $window_size[0], $window_size[1])
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $location_text[0]
self.contents.font.size = $location_text[1]
refresh
end
def refresh
self.contents.clear
self.windowskin = RPG::Cache.windowskin($window_location_skin)
self.contents.font.color = text_color($location_text[2])
self.contents.draw_text(4, 0, 120, 32, $location_text[3])
self.contents.font.color = text_color($location_text[4])
self.contents.draw_text(4, 32, 120, 32, $game_map.name, 2)
end
end
#===================================================
# ▲ CLASS Window_Location Ends
#===================================================
#===================================================
# ▲ Ring Menu - Show Player Location R1 - Ends
#===================================================Quote from: Flower Lady WhiteRose on February 22, 2010, 11:38:16 pm
Code tags fixed the problem, thanks Aqua. Okay, so looking at the script, you'll have to edit line 69 to say "Hotkeys" instead of Stats (you probably could have figured that one out on your own, I'm sure,) and then Line 300 needs to be changed to call the Hotkeys scene rather than the status screen. Unfortunately, I don't know the name of the Hotkeys scene, and, knowing Blizz, he might have it called in some special way. I think right now your best course of action would be to hope that a scripter more familiar with... well, scripting, comes to give you a hand. Sorry I couldn't help more. Try contacting game_guy or even Blizzard himself if they're not busy. I'm sure they'll help you out if they have the time.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Z-HUD for Blizz-ABS by Blizzard
# Version: 1.01b
# Type: Blizz-ABS Add-on
# Date: 29.7.2009
# Date v1.0b: 30.7.2009
# Date v1.0b: 17.12.2009
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This script is to be distributed under the same terms and conditions like
# the script it was created for: Blizz-ABS.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Information:
#
# This script must be placed below Blizz-ABS and requires Blizz-ABS v2.56 or
# higher to work properly. It will add a completely new HUD system for
# Blizz-ABS.
#
# Notes:
#
# Images are placed in the Graphics/Pictures folder. Be sure to set up the
# HUD height properly. Usually it is enough if it is the sum of the heights
# of the HP and the SP image. If you use tiling, you need to calculate the
# maximum possible height the HUD can be and then use that value. It is not
# recommended to use extremely high values as your HUD will cover too much of
# the screen and increase lag.
#
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
if !$BlizzABS || BlizzABS::VERSION < 2.56
raise 'ERROR: The "Z-HUD" requires Blizz-ABS 2.56 or higher.'
end
#==============================================================================
# module BlizzCFG
#==============================================================================
module BlizzCFG
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# maximum height of the HUD
Z_HUD_HEIGHT = 96
# tiling HP images
Z_HP_TILING = true
# displays as if the images are filled up (only when tiling)
Z_HP_FILL_UP = true
# how many columns are used for the tile in one row (only when tiling)
Z_HP_TILE_COLUMNS = 10
# how many HP per column (only when tiling)
Z_HP_PER_TILE = 100
# full image file
Z_HP_FILE = 'hud_HP'
# empty image file
Z_HP_FILE_EMPTY = 'hud_HP_empty'
# tiling SP images
Z_SP_TILING = false
# displays as if the images are filled up (only when tiling)
Z_SP_FILL_UP = false
# how many columns are used for the tile in one row (only when tiling)
Z_SP_TILE_COLUMNS = 10
# how many SP per column (only when tiling)
Z_SP_PER_TILE = 10
# full image file
Z_SP_FILE = 'hud_SP'
# empty image file
Z_SP_FILE_EMPTY = 'hud_SP_empty'
# item hotkey background
Z_ITEM_BACK = 'item'
# skill hotkey background
Z_SKILL_BACK = 'skill'
# hotkeys display background
Z_HOTKEYS_BACK = 'hotkey'
# minimap background
Z_MINIMAP_BACK = 'minimap'
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end
#==============================================================================
# Hud
#==============================================================================
class Hud
attr_reader :hotkey_sprite
alias init_zhud_later initialize
def initialize(viewport = nil)
init_hotkey_sprite(viewport)
init_zhud_later(viewport)
self.x, self.y = 4, 4
@hotkey_sprite.z = self.z
end
alias create_positions_zhud_later create_positions
def create_positions
create_positions_zhud_later
b1 = RPG::Cache.picture(BlizzCFG::Z_HP_FILE)
b2 = RPG::Cache.picture(BlizzCFG::Z_SP_FILE)
if BlizzCFG::Z_HP_TILING
w = b1.width * BlizzCFG::Z_HP_TILE_COLUMNS
else
w = b1.width
end
@hud_width = w if @hud_width < w
if BlizzCFG::Z_SP_TILING
w = b2.width * BlizzCFG::Z_SP_TILE_COLUMNS
else
w = b2.width
end
@hud_width = w if @hud_width < w
@hud_height = BlizzCFG::Z_HUD_HEIGHT
@hp_x, @hp_y, @sp_x, @sp_y = 0, 0, 0, b1.height + 4
update_sp_y
b = RPG::Cache.picture(BlizzCFG::Z_ITEM_BACK)
@left_x = b.width
@left_y = b.height
@hot_x = b.width
end
def draw_basic
end
def draw_empty
end
def draw_name
end
def draw_level
end
def draw_hp
@hp, @maxhp = actor.hp, actor.maxhp
rate = (@maxhp > 0 ? @hp.to_f / @maxhp : 0)
b1 = RPG::Cache.picture(BlizzCFG::Z_HP_FILE)
b2 = RPG::Cache.picture(BlizzCFG::Z_HP_FILE_EMPTY)
if BlizzCFG::Z_HP_TILING
tiles = @maxhp / BlizzCFG::Z_HP_PER_TILE
rows = (tiles.to_f / BlizzCFG::Z_HP_TILE_COLUMNS).ceil
w, h = b1.width, b1.height
self.bitmap.fill_rect(@hp_x, @hp_y, w * BlizzCFG::Z_HP_TILE_COLUMNS,
h * rows, Color.new(0, 0, 0, 0))
full_tiles = (rate * tiles).to_i
semi_full = ((rate * tiles != full_tiles) ? 1 : 0)
(0...full_tiles).each {|i|
x = @hp_x + (i % BlizzCFG::Z_HP_TILE_COLUMNS) * w
y = @hp_y + (i / BlizzCFG::Z_HP_TILE_COLUMNS) * h
self.bitmap.blt(x, y, b1, Rect.new(0, 0, w, h))}
if semi_full > 0
x = @hp_x + (full_tiles % BlizzCFG::Z_HP_TILE_COLUMNS) * w
y = @hp_y + (full_tiles / BlizzCFG::Z_HP_TILE_COLUMNS) * h
if BlizzCFG::Z_HP_FILL_UP
h2 = ((1 - rate * tiles + full_tiles) * h).to_i
self.bitmap.blt(x, y, b2, Rect.new(0, 0, w, h2))
self.bitmap.blt(x, y + h2, b1, Rect.new(0, h2, w, h - h2))
else
w2 = ((rate * tiles - full_tiles) * w).to_i
self.bitmap.blt(x, y, b1, Rect.new(0, 0, w2, h))
self.bitmap.blt(x + w2, y, b2, Rect.new(w2, 0, w - w2, h))
end
end
((full_tiles + semi_full)...tiles).each {|i|
x = @hp_x + (i % BlizzCFG::Z_HP_TILE_COLUMNS) * w
y = @hp_y + (i / BlizzCFG::Z_HP_TILE_COLUMNS) * h
self.bitmap.blt(x, y, b2, Rect.new(0, 0, w, h))}
else
w1 = (b1.width * rate).to_i
w2 = b2.width - w1
self.bitmap.fill_rect(@hp_x, @hp_y, b1.width, b1.height, Color.new(0, 0, 0, 0))
self.bitmap.blt(@hp_x, @hp_y, b1, Rect.new(0, 0, w1, b1.height))
self.bitmap.blt(@hp_x + w1, @hp_y, b2, Rect.new(w1, 0, w2, b2.height))
end
draw_sp
end
def draw_sp
@sp, @maxsp = actor.sp, actor.maxsp
rate = (@maxsp > 0 ? @sp.to_f / @maxsp : 0)
b1 = RPG::Cache.picture(BlizzCFG::Z_SP_FILE)
b2 = RPG::Cache.picture(BlizzCFG::Z_SP_FILE_EMPTY)
if BlizzCFG::Z_SP_TILING
tiles = @maxsp / BlizzCFG::Z_SP_PER_TILE
rows = (tiles.to_f / BlizzCFG::Z_SP_TILE_COLUMNS).ceil
w, h = b1.width, b1.height
self.bitmap.fill_rect(@sp_x, @sp_y, w * BlizzCFG::Z_SP_TILE_COLUMNS,
h * rows, Color.new(0, 0, 0, 0))
full_tiles = (rate * tiles).to_i
semi_full = ((rate * tiles != full_tiles) ? 1 : 0)
(0...full_tiles).each {|i|
x = @sp_x + (i % BlizzCFG::Z_SP_TILE_COLUMNS) * w
y = @sp_y + (i / BlizzCFG::Z_SP_TILE_COLUMNS) * h
self.bitmap.blt(x, y, b1, Rect.new(0, 0, w, h))}
if semi_full > 0
x = @sp_x + (full_tiles % BlizzCFG::Z_SP_TILE_COLUMNS) * w
y = @sp_y + (full_tiles / BlizzCFG::Z_SP_TILE_COLUMNS) * h
if BlizzCFG::Z_SP_FILL_UP
h2 = ((1 - rate * tiles + full_tiles) * h).to_i
self.bitmap.blt(x, y, b2, Rect.new(0, 0, w, h2))
self.bitmap.blt(x, y + h2, b1, Rect.new(0, h2, w, h - h2))
else
w2 = ((rate * tiles - full_tiles) * w).to_i
self.bitmap.blt(x, y, b1, Rect.new(0, 0, w2, h))
self.bitmap.blt(x + w2, y, b2, Rect.new(w2, 0, w - w2, h))
end
end
((full_tiles + semi_full)...tiles).each {|i|
x = @sp_x + (i % BlizzCFG::Z_SP_TILE_COLUMNS) * w
y = @sp_y + (i / BlizzCFG::Z_SP_TILE_COLUMNS) * h
self.bitmap.blt(x, y, b2, Rect.new(0, 0, w, h))}
else
w1 = (b1.width * rate).to_i
w2 = b2.width - w1
self.bitmap.fill_rect(@sp_x, @sp_y, b1.width, b1.height, Color.new(0, 0, 0, 0))
self.bitmap.blt(@sp_x, @sp_y, b1, Rect.new(0, 0, w1, b1.height))
self.bitmap.blt(@sp_x + w1, @sp_y, b2, Rect.new(w1, 0, w2, b2.height))
end
end
def draw_hskill
@skill = actor.skill
b1 = RPG::Cache.picture(BlizzCFG::Z_SKILL_BACK)
@hotkey_sprite.bitmap.fill_rect(0, 0, b1.width, b1.height, Color.new(0, 0, 0, 0))
@hotkey_sprite.bitmap.blt(0, 0, b1, Rect.new(0, 0, b1.width, b1.height))
if @skill != 0
bitmap = RPG::Cache.icon($data_skills[@skill].icon_name)
x, y = (b1.width - 24) / 2, (b1.height - 24) / 2
@hotkey_sprite.bitmap.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))
end
draw_lskill
end
def draw_lskill
@hotkey_sprite.bitmap.fill_rect(0, @left_y + 4, @left_x, 16, Color.new(0, 0, 0, 0))
@skills_left = get_skills_left
if @skill != nil && @skill > 0
if @skills_left >= 0
if @skills_left == 0
@hotkey_sprite.bitmap.font.color = Color.new(255, 0, 0)
elsif @skills_left <= 5
@hotkey_sprite.bitmap.font.color = Color.new(255, 255, 0)
else
@hotkey_sprite.bitmap.font.color = normal_color
end
@hotkey_sprite.bitmap.font.size -= 2
@hotkey_sprite.bitmap.draw_text_full(0, @left_y, @left_x, 20, @skills_left.to_s, 1)
@hotkey_sprite.bitmap.font.size += 2
elsif @skills_left == -1
@hotkey_sprite.bitmap.font.color = Color.new(0, 255, 0)
@hotkey_sprite.bitmap.font.size += 4
@hotkey_sprite.bitmap.draw_text_full(0, @left_y, @left_x, 20, '∞', 1)
@hotkey_sprite.bitmap.font.size -= 4
end
end
end
def draw_hitem
@item = actor.item
b1 = RPG::Cache.picture(BlizzCFG::Z_SKILL_BACK)
b2 = RPG::Cache.picture(BlizzCFG::Z_ITEM_BACK)
x = b1.width + 4
@hotkey_sprite.bitmap.fill_rect(x, 0, b2.width, b2.height, Color.new(0, 0, 0, 0))
@hotkey_sprite.bitmap.blt(x, 0, b2, Rect.new(0, 0, b2.width, b2.height))
if @item != 0
bitmap = RPG::Cache.icon($data_items[@item].icon_name)
x, y = b1.width + 4 + (b2.width - 24) / 2, (b2.height - 24) / 2
@hotkey_sprite.bitmap.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))
end
draw_litem
end
def draw_litem
@items_left = $game_party.item_number(@item)
@hotkey_sprite.bitmap.fill_rect(@left_x + 4, @left_y + 4, @left_x, 16, Color.new(0, 0, 0, 0))
if @item != nil && @item > 0
if $data_items[@item] != nil && !$data_items[@item].consumable
@hotkey_sprite.bitmap.font.color = Color.new(0, 255, 0)
@hotkey_sprite.bitmap.font.size += 4
@hotkey_sprite.bitmap.draw_text_full(@left_x + 4, @left_y, @left_x, 20, '∞', 1)
@hotkey_sprite.bitmap.font.size -= 4
else
if @items_left == 0
@hotkey_sprite.bitmap.font.color = Color.new(255, 0, 0)
elsif @items_left <= 10
@hotkey_sprite.bitmap.font.color = Color.new(255, 255, 0)
else
@hotkey_sprite.bitmap.font.color = normal_color
end
@hotkey_sprite.bitmap.font.size -= 2
@hotkey_sprite.bitmap.draw_text_full(@left_x + 4, @left_y, @left_x, 20, @items_left.to_s, 1)
@hotkey_sprite.bitmap.font.size += 2
end
end
end
alias update_zhud_later update
def update
update_sp_y
update_zhud_later
end
def update_sp_y
return if !BlizzCFG::Z_HP_TILING
b1 = RPG::Cache.picture(BlizzCFG::Z_HP_FILE)
tiles = actor.maxhp / BlizzCFG::Z_HP_PER_TILE
@sp_y = (tiles.to_f / BlizzCFG::Z_HP_TILE_COLUMNS).ceil * b1.height
end
alias dispose_zhud_later dispose
def dispose
@hotkey_sprite.dispose if @hotkey_sprite != nil
@hotkey_sprite = nil
dispose_zhud_later
end
def init_hotkey_sprite(viewport)
b1 = RPG::Cache.picture(BlizzCFG::Z_ITEM_BACK)
b2 = RPG::Cache.picture(BlizzCFG::Z_SKILL_BACK)
width = b1.width + b2.width
@hotkey_sprite = Sprite.new(viewport)
@hotkey_sprite.x = 632 - width
@hotkey_sprite.y = 4
@hotkey_sprite.bitmap = Bitmap.new(width + 4, b1.height + 24)
@hotkey_sprite.bitmap.font.name = 'Arial'
@hotkey_sprite.bitmap.font.size = 16
@hotkey_sprite.bitmap.font.bold = true
end
end
#==============================================================================
# Hotkey_Assignment
#==============================================================================
class Hotkey_Assignment
def initialize(viewport = nil)
super
self.bitmap = Bitmap.new(32, 320)
self.bitmap.font.bold = true
self.bitmap.font.size -= 8
self.bitmap.font.color = system_color
self.x, self.y, self.z = 0, 160, 1100
@skills = BlizzABS::Cache::EmptyKeys
@items = BlizzABS::Cache::EmptyKeys
update
end
def draw(index = nil)
back = RPG::Cache.picture(BlizzCFG::Z_HOTKEYS_BACK)
w, h = back.width, back.height
ow, oh = (w - 24) / 2, (h - 24) / 2
(index == nil ? BlizzABS::Cache::HotkeyRange : [index]).each {|i|
if $game_player.skill_hotkeys[i%10] != 0
object = $data_skills[$game_player.skill_hotkeys[i%10]]
elsif $game_player.item_hotkeys[i%10] != 0
object = $data_items[$game_player.item_hotkeys[i%10]]
end
if @items[i%10] != $game_player.item_hotkeys[i%10] ||
@skills[i%10] != $game_player.skill_hotkeys[i%10]
self.bitmap.fill_rect(0, h*(i-1), w, h, Color.new(0, 0, 0, 0))
self.bitmap.blt(0, h*(i-1), back, Rect.new(0, 0, w, h))
if object != nil
bitmap = RPG::Cache.icon(object.icon_name)
self.bitmap.blt(ow, h*(i-1)+oh, bitmap, Rect.new(0, 0, 24, 24))
end
self.bitmap.draw_text_full(0, h*(i-1)+10, w-2, 32, (i%10).to_s, 2)
end}
@items = $game_player.item_hotkeys.clone
@skills = $game_player.skill_hotkeys.clone
end
end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map
alias update_zhud_later update
def update
update_zhud_later
if @minimap != nil && $game_system.minimap == 1
if @minimap_back == nil
@minimap_back = Sprite.new
@minimap_back.bitmap = RPG::Cache.picture(BlizzCFG::Z_MINIMAP_BACK)
w = (@minimap_back.bitmap.width - @minimap.vw) / 2
@minimap_back.x = @minimap.vx - w
h = (@minimap_back.bitmap.height - @minimap.vh) / 2
@minimap_back.y = @minimap.vy - h
end
elsif @minimap_back != nil
@minimap_back.dispose
@minimap_back = nil
end
end
alias hud_update_zhud_later hud_update
def hud_update
hud_update_zhud_later
if @hud != nil
s = @hud.hotkey_sprite
s.update
if $game_player.screen_x < s.vx + s.vw + 16 &&
$game_player.screen_y < s.vy + s.vh + 48 &&
$game_player.screen_x > s.vx && $game_player.screen_y > s.vy
s.opacity -= 25 if s.opacity > 80
elsif s.opacity <= 255
s.opacity += 25
end
end
if @minimap_back != nil
s = @minimap_back
s.update
if $game_player.screen_x < s.vx + s.vw + 16 &&
$game_player.screen_y < s.vy + s.vh + 48 &&
$game_player.screen_x > s.vx && $game_player.screen_y > s.vy
s.opacity -= 25 if s.opacity > 80
elsif s.opacity <= 255
s.opacity += 25
end
end
end
end
#==============================================================================
# Window_Skill_Hotkey
#==============================================================================
class Window_Skill_Hotkey < Window_Skill
def initialize(actor)
super
@column_max = 1
self.width, self.height = 288, 480
self.x, self.y, self.z = 64, 64, 21000
self.cursor_rect.empty
self.active = false
refresh
end
def draw_item(i)
if @data[i] == nil
self.contents.font.color = normal_color
self.contents.draw_text(32, i*32, 204, 32, '<Remove>')
else
if @actor.skill_can_use?(@data[i].id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.fill_rect(Rect.new(4, i*32, 256, 32), Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(@data[i].icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(4, 4+i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
text = @data[i].name
if @actor.skills.include?(@data[i].id) &&
$tons_version != nil && $tons_version >= 3.7 &&
TONS_OF_ADDONS::EQUAP_SKILLS && DISPLAY_AP_REQ
aps = BlizzCFG.maxap(@data[i].id)
text = "#{text} (#{@actor.ap(@data[i].id)}/#{aps})" if aps != 0
end
self.contents.draw_text(32, i*32, 204, 32, text)
sp_cost = @data[i].sp_cost
if $tons_version != nil && $tons_version >= 6.54 &&
$game_system.SP_COST_MOD
sp_cost = BlizzCFG.get_cost_mod(@actor.states, sp_cost)
end
self.contents.draw_text(204, i*32, 48, 32, sp_cost.to_s, 2)
end
end
end
#==============================================================================
# Window_Item_Hotkey
#==============================================================================
class Window_Item_Hotkey < Window_Item
def initialize
super
@column_max = 1
self.width, self.height = 288, 480
self.x, self.y, self.z = 352, 64, 21000
self.cursor_rect.empty
self.active = false
refresh
end
def draw_item(i)
if @data[i] == nil
self.contents.font.color = normal_color
self.contents.draw_text(32, i*32, 212, 32, '<Remove>')
else
number = $game_party.item_number(@data[i].id)
if $game_party.item_can_use?(@data[i].id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.fill_rect(Rect.new(4, i*32, 256, 32), Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(@data[i].icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(4, 4+i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(32, i*32, 212, 32, @data[i].name)
self.contents.draw_text(212, i*32, 16, 32, ':', 1)
self.contents.draw_text(228, i*32, 24, 32, number.to_s, 2)
end
end
end
#==============================================================================
# Scene_Hotkeys
#==============================================================================
class Scene_Hotkeys
def main
@spriteset = Spriteset_Map.new
@view = Viewport.new(0, 0, 640, 480)
@view.tone = @tone.clone
@hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud
if BlizzABS::Config::HOTKEYS
@hotkeys = Hotkey_Assignment.new
@hotkeys.z = 5000
end
if BlizzABS::Config::MINIMAP && $game_system.minimap > 0
@minimap = Minimap.new
end
@choice = Sprite.new
@choice.bitmap = $BlizzABS.cache.image('menu_arrow')
@choice.x, @choice.y, @choice.z, @choice.opacity = 40, 192, 500, 128
@choice.angle = 90
@choice.ox = -8
@active = true
@index = 0
@up_mode = true
@skill_window = Window_Skill_Hotkey.new($game_player.battler)
@item_window = Window_Item_Hotkey.new
@last_active = true
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
@spriteset.dispose
[@hud, @hotkeys, @minimap].each {|s| s.dispose if s != nil}
@choice.dispose
@skill_window.dispose
@item_window.dispose
@view.dispose
while @party_leader != $game_party.actors[0]
$BlizzABS.player.switch_leader
end
end
def update
@choice.update
@skill_window.update
@item_window.update
@hotkeys.update if @hotkeys != nil
@choice.oy += (@up_mode ? (@active ? 2 : 1) : (@active ? -2 : -1))
@up_mode = (@up_mode ? (@choice.oy < 8) : (@choice.oy <= -8))
if $game_system.select_button && Input.trigger?(Input::Select)
$game_system.se_play($data_system.cursor_se)
$BlizzABS.player.switch_leader
@skill_window.switch_actor
@hud.update if @hud != nil
@hotkeys.update if @hotkeys != nil
elsif @active
@choice.oy = @choice.oy / 2 * 2
update_choice
elsif @skill_window.active
update_skill
elsif @item_window.active
update_item
end
end
def update_choice
@choice.y = 192 + @index * 32
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active = false
@skill_window.active = @last_active
@item_window.active = (!@last_active)
elsif Input.repeat?(Input::DOWN)
if Input.trigger?(Input::DOWN) || @index < 9
$game_system.se_play($data_system.cursor_se)
@index = (@index + 1) % 10
end
elsif Input.repeat?(Input::UP)
if Input.trigger?(Input::UP) || @index >= 1
$game_system.se_play($data_system.cursor_se)
@index = (@index + 9) % 10
end
end
end
endQuote from: Flower Lady WhiteRose on February 23, 2010, 12:37:09 am
I'm sorry, ojp, but I'm fairly new to scripting myself, so this is out of my realm of knowledge. I'm sure someone else will be able to help you with your problem. Might I recommend, though, that you take Aqua's advice and edit some Code tags into your post?
Quote from: Champion Blizzard on February 23, 2010, 02:29:20 am
Try changing the script order, it could help.
Quote from: Champion Blizzard on February 23, 2010, 03:46:06 am
Ugh... Put scripts by other people above mine.
Quote from: Elite Four Aqua on February 23, 2010, 04:29:16 pm
Did you do Hotkey_Assignment.new in your ring menu?
Because line 354 is having trouble calling the super method within the Hotkey_Assignment class