12-16-2006, 01:00 PM
(This post was last modified: 05-12-2017, 04:03 AM by DerVVulfman.)
Leon Blade's CMS
(Custom Menu System)
Dec 16 2006
(Custom Menu System)
Dec 16 2006
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
I have my menu system to share with you today!
First this is Scene_Menu place this above Main
Here is the new screen shot.
Scene_Menu - Place above Main
Code:
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
# メニュー画面の処理を行うクラスです。
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# menu_index : コマンドのカーソル初期位置
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
s1 = " Items" # 0
s2 = " Skills" # 1
if $game_switches[8] == true
s3 = " Materia" # 2
else
s3 = " "
end
s4 = " Equip" # 3
s5 = " Stats" # 4
if $game_switches[9] == true
s6 = " Quest" # 5
else
s6 = " "
end
if $game_switches[12] == true
s7 = " E-Mail" # 6
else
s7 = " "
end
s8 = " Quit Game" # 7
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8])
@command_window.x = 480
@command_window.y = 0
@command_window.index = @menu_index
# パーティ人数が 0 人の場合
if $game_party.actors.size == 0
# Checking To See If Anyone Is In Party and if not
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
#----------------------------------------------------
@icon_window = Window_MenuIcons.new
@icon_window.x = 480
@icon_window.y = 0
@icon_window.opacity = 0
#----------------------------------------------------
@status_window = Window_MenuStatus.new
@status_window.x = 0
@status_window.y = 0
#----------------------------------------------------
@map_window = Window_Mapname.new
@map_window.x = 320
@map_window.y = 424
#----------------------------------------------------
@crystal_window = Window_Crystal.new
@crystal_window.x = 0
@crystal_window.y = 359
#----------------------------------------------------
@sheild_window = Window_GameTitle.new
@sheild_window.x = 320
@sheild_window.y = 359
#----------------------------------------------------
@gold_window = Window_Gold.new
@gold_window.x = 480
@gold_window.y = 359
#----------------------------------------------------
@percent_window = Window_GameCompletion.new
@percent_window.x = 480
@percent_window.y = 287
#----------------------------------------------------
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@command_window.dispose
@status_window.dispose
@map_window.dispose
@crystal_window.dispose
@sheild_window.dispose
@gold_window.dispose
@icon_window.dispose
@percent_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@command_window.update
@status_window.update
@map_window.update
@crystal_window.update
@sheild_window.update
@gold_window.update
@icon_window.update
@percent_window.update
# コマンドウィンドウがアクティブの場合: update_command を呼ぶ
if @command_window.active
update_command
return
end
# ステータスウィンドウがアクティブの場合: update_status を呼ぶ
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (コマンドウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_command
# B ボタンが押された場合
if Input.trigger?(Input::cool.gif
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
#---------------------------------------------------------
case @command_window.index
when 0 # Item
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1 # Skills
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # Materia
if $game_switches[8] == true
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
else
end
when 3 # Equip
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 #Status
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 5 # Quest
if $game_switches[9] == true
$game_system.se_play($data_system.decision_se)
$scene = Scene_Quest.new
else
end
when 6 # Mail
if $game_switches[12] == true
$game_system.se_play($data_system.decision_se)
$scene = Scene_Mail.new
else
end
when 7 # Quit
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (ステータスウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_status
# B ボタンが押された場合
if Input.trigger?(Input::cool.gif
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# コマンドウィンドウをアクティブにする
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# コマンドウィンドウのカーソル位置で分岐
case @command_window.index
when 1 # Skill
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2 # Materia
$game_system.se_play($data_system.decision_se)
$scene = Scene_MagicEquip.new(@status_window.index)
when 3 # Equip
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 4 # Status
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
end
Window_Crystals - Place above Menu
Code:
#==============================================================================
# ■ Window_Crystal
#------------------------------------------------------------------------------
# This Window displays what you need to do next like a task or job or objective!
#==============================================================================
class Window_Crystal < Window_Base
#--------------------------------------------------------------------------
# Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 320, 121)
self.contents = Bitmap.new(width - 52, height - 34)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
# Draws info on screen Crystal and the pics
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, -9, 320, 32, "Crystals:") # Text Discription like
self.contents.font.color = normal_color
if $game_switches[26] == true
draw_icon_graphic("fire crystal", 15, 45)
self.contents.draw_text(4, 35, 320, 32, "Fire")
else
draw_icon_graphic("049-Skill06", 15, 45)
end
if $game_switches[27] == true
draw_icon_graphic("ice crystal", 43, 45)
self.contents.draw_text(35, 35, 320, 32, "Ice")
else
draw_icon_graphic("049-Skill06", 43, 45)
end
if $game_switches[28] == true
draw_icon_graphic("bolt crystal", 75, 45)
self.contents.draw_text(63, 35, 320, 32, "Bolt")
else
draw_icon_graphic("049-Skill06", 75, 45)
end
if $game_switches[29] == true
draw_icon_graphic("water crystal", 110, 45)
self.contents.draw_text(94, 35, 320, 32, "Water")
else
draw_icon_graphic("049-Skill06", 110, 45)
end
if $game_switches[30] == true
draw_icon_graphic("air crystal", 145, 45)
self.contents.draw_text(136, 35, 320, 32, "Air")
else
draw_icon_graphic("049-Skill06", 145, 45)
end
if $game_switches[31] == true
draw_icon_graphic("earth crystal", 177, 45)
self.contents.draw_text(162, 35, 320, 32, "Earth")
else
draw_icon_graphic("049-Skill06", 177, 45)
end
if $game_switches[32] == true
draw_icon_graphic("holy crystal", 212, 45)
self.contents.draw_text(200, 35, 320, 32, "Light")
else
draw_icon_graphic("049-Skill06", 212, 45)
end
if $game_switches[33] == true
draw_icon_graphic("black crystal", 247, 45)
self.contents.draw_text(236, 35, 320, 32, "Dark")
else
draw_icon_graphic("049-Skill06", 247, 45)
end
end
end
Window_Mapname - Place Above Menu
Code:
#========================================
#■ Game_Map
#--------------------------------------------------------------------------------
# Setting functions for the Map
#========================================
class Game_Map
def name
$map_infos[@map_id]
end
end
#========================================
#■ Window_Title
#--------------------------------------------------------------------------------
# Setting functions for the Title
#========================================
class Scene_Title
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
end
#==============================================================================
# ■ Window_Mapname
#------------------------------------------------------------------------------
# Draws the Map name
#==============================================================================
class Window_Mapname < Window_Base
#--------------------------------------------------------------------------
# Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 320, 56)
self.contents = Bitmap.new(width - 52, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
# Draws info on screen
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
bitmap = RPG::Cache.icon("map")
self.contents.blt(5, 0, bitmap, Rect.new(0, 0, 24, 24))
new_name = $game_map.name.tr("/*","")
self.contents.draw_text(40, -5, 320, 32, new_name.to_s)
end
end
Window_GameTitle - Place Above Main
Code:
#==============================================================================
# ■ Window_Window_GameTitle
#------------------------------------------------------------------------------
#==============================================================================
class Window_GameTitle < Window_Base
#--------------------------------------------------------------------------
# Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 65)
self.contents = Bitmap.new(width - 52, height - 34)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
# Draws info on screen Crystal and the pics
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, -9, 320, 32, "Blade")
self.contents.draw_text(45, 10, 320, 32, "Brothers")
end
end
Window_Gold - Place Above Main
Code:
#==============================================================================
# ■ Window_Gold
#------------------------------------------------------------------------------
# ゴールドを表示するウィンドウです。
#==============================================================================
class Window_Gold < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Gold" window font
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 320, 32, "Gil")
draw_icon_graphic("coin", 120, 28) # Gold
end
end
Window_MenuIcons - Place Above Main
Code:
#==============================================================================
# ■ Window_Window_MenuIcons
#------------------------------------------------------------------------------
# I made this window to make everything look a lot cooler!
#==============================================================================
class Window_MenuIcons < Window_Base
#--------------------------------------------------------------------------
# Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 306)
self.contents = Bitmap.new(width - 52, height - 52)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
# Draws info on screen
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
draw_icon_graphic("bag", 15, 29) # Items
draw_icon_graphic("witch", 15, 61) # Skills
if $game_switches[8] == true
draw_icon_graphic("materia_fire", 15, 90) # Materia
else
end
draw_icon_graphic("ar30", 15, 125) # Equip
draw_icon_graphic("star", 15, 157) # Stats
if $game_switches[9] == true
draw_icon_graphic("note", 15, 189) # Quest
else
end
if $game_switches[12] == true
draw_icon_graphic("lttr", 15, 221) # Mail
else
end
draw_icon_graphic("sku3", 15, 253) # Quit
end
end
Window_GameCompletion - Place Above Main
Code:
#==============================================================================
# ■ Window_Window_GameCompletion
#------------------------------------------------------------------------------
#==============================================================================
class Window_GameCompletion < Window_Base
#--------------------------------------------------------------------------
# Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 72)
self.contents = Bitmap.new(width - 52, height - 34)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
# Draws percentage
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, -9, 320, 32, "Game Completion")
self.contents.font.color = normal_color
game_percent = ("0%")
if $game_switches[1] == true
game_percent = ("1%")
end
if $game_switches[5] == true
game_percent = ("2%")
end
if $game_switches[11] == true
game_percent = ("3%")
end
if $game_switches[14] == true
game_percent = ("4%")
end
if $game_switches[17] == true
game_percent = ("5%")
end
if $game_switches[19] == true
game_percent = ("6%")
end
if $game_switches[20] == true
game_percent = ("7%")
end
if $game_switches[34] == true
game_percent = ("8%")
end
if $game_switches[35] == true
game_percent = ("9%")
end
if $game_switches[36] == true
game_percent = ("10%")
end
self.contents.draw_text(56, 13, 320, 32, game_percent)
end
end
You will need the following icons... (not available in post)
These will all be attached to this updated post. (Original post lost attachment)
The Game Completion is a new thing it uses switches to tell how far into the game you are. When a switch activates your percentage goes up by 1%.
I couldn't didn't want to seperate the icons so I just attached my whole folder and you can choose.
One last thing, if you want the cool gradient bars use this script.
Gradient Bars - Place above Main
Code:
#--------------------------------------------------------------------------
# * Begin SDK Log
#--------------------------------------------------------------------------
SDK.log("Trickster Plug And Play Gradient Bars", "Trickster", 1.0, "8.27.05")
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.state("Trickster Plug And Play Gradient Bars") == true
#--------------------------------------------------------------------------
# * Load Gradient from RPG::Cache
#--------------------------------------------------------------------------
module RPG
module Cache
def self.gradient(filename, hue = 0)
self.load_bitmap("Graphics/Gradients/", filename, hue)
end
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# * Constants Bar Types and Hues for parameters and parameter names
#--------------------------------------------------------------------------
HP_BAR = "014-Reds01"
SP_BAR = "013-Blues01"
EXP_BAR = "023-Dusk01"
ATK_BAR = "020-Metallic01"
PDEF_BAR = "020-Metallic01"
MDEF_BAR = "020-Metallic01"
STR_BAR = "020-Metallic01"
DEX_BAR = "020-Metallic01"
AGI_BAR = "020-Metallic01"
INT_BAR = "020-Metallic01"
HUES = [150,180,60,30,270,350,320]
STATS = ["atk","pdef","mdef","str","dex","agi","int"]
# leave this alone if you don't know what you are doing
OUTLINE = 1
BORDER = 1
#--------------------------------------------------------------------------
# * Draw Gradient Bar
#--------------------------------------------------------------------------
def draw_gradient_bar(x, y, min, max, file, width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2")
bar = RPG::Cache.gradient(file, hue)
back = RPG::Cache.gradient(back)
back2 = RPG::Cache.gradient(back2)
cx = BORDER
cy = BORDER
dx = OUTLINE
dy = OUTLINE
zoom_x = width != nil ? width : back.width
zoom_y = height != nil ? height : back.height
percent = min / max.to_f if max != 0
percent = 0 if max == 0
back_dest_rect = Rect.new(x,y,zoom_x,zoom_y)
back2_dest_rect = Rect.new(x+dx,y+dy,zoom_x -dx*2,zoom_y-dy*2)
bar_dest_rect = Rect.new(x+cx,y+cy,zoom_x * percent-cx*2,zoom_y-cy*2)
back_source_rect = Rect.new(0,0,back.width,back.height)
back2_source_rect = Rect.new(0,0,back2.width,back2.height)
bar_source_rect = Rect.new(0,0,bar.width* percent,bar.height)
self.contents.stretch_blt(back_dest_rect, back, back_source_rect)
self.contents.stretch_blt(back2_dest_rect, back2, back2_source_rect)
self.contents.stretch_blt(bar_dest_rect, bar, bar_source_rect)
end
#--------------------------------------------------------------------------
# * Draw Vertical Gradient Bar
#--------------------------------------------------------------------------
def draw_vertical_gradient_bar(x, y, min, max, file, width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2")
bar = RPG::Cache.gradient(file, hue)
back = RPG::Cache.gradient(back)
back2 = RPG::Cache.gradient(back2)
cx = BORDER
cy = BORDER
dx = OUTLINE
dy = OUTLINE
zoom_x = width != nil ? width : back.width
zoom_y = height != nil ? height : back.height
percent = min / max.to_f if max != 0
percent = 0 if max == 0
bar_y = (zoom_y - zoom_y * percent).ceil
source_y = bar.height - bar.height * percent
back_dest_rect = Rect.new(x,y,zoom_x,zoom_y)
back2_dest_rect = Rect.new(x+dx,y+dy,zoom_x -dx*2,zoom_y-dy*2)
bar_dest_rect = Rect.new(x+cx,y+bar_y+cy,zoom_x-cx*2,(zoom_y * percent).to_i-cy*2)
back_source_rect = Rect.new(0,0,back.width,back.height)
back2_source_rect = Rect.new(0,0,back2.width,back2.height)
bar_source_rect = Rect.new(0,source_y,bar.width,bar.height * percent)
self.contents.stretch_blt(back_dest_rect, back, back_source_rect)
self.contents.stretch_blt(back2_dest_rect, back2, back2_source_rect)
self.contents.stretch_blt(bar_dest_rect, bar, bar_source_rect)
end
#--------------------------------------------------------------------------
# * Draw HP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
alias trick_draw_actor_hp draw_actor_hp
def draw_actor_hp(actor, x, y, width = 144)
# Calculate if there is draw space for MaxHP
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
width = hp_x - x
width += $game_temp.in_battle ? 50 : 100
percent = actor.hp / actor.maxhp.to_f
hue = 120 * percent
# Draw HP
draw_gradient_bar(x, y + 16, actor.hp, actor.maxhp, HP_BAR, width, 8, hue)
trick_draw_actor_hp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw SP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
alias trick_draw_actor_sp draw_actor_sp
def draw_actor_sp(actor, x, y, width = 144)
# Calculate if there is draw space for MaxHP
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
width = sp_x - x
width += $game_temp.in_battle ? 50 : 100
percent = actor.sp / actor.maxsp.to_f
hue = 0
# Draw SP
draw_gradient_bar(x, y + 16, actor.sp, actor.maxsp, SP_BAR, width, 8, hue)
trick_draw_actor_sp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw Exp
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
alias trick_bars_base_exp draw_actor_exp
def draw_actor_exp(actor, x, y)
min = actor.level == 99 ? 1 : actor.now_exp
max = actor.level == 99 ? 1 : actor.next_exp
draw_gradient_bar(x, y + 16, min, max, EXP_BAR, 192, 8)
trick_bars_base_exp(actor, x, y)
end
#--------------------------------------------------------------------------
# * Draw Parameter
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : draw which parameter
#--------------------------------------------------------------------------
alias trick_bars_base_parameter draw_actor_parameter
def draw_actor_parameter(actor, x, y, type)
hue = HUES[type]
stat = toto("actor.#{STATS[type]}")
bar_type = toto("#{STATS[type].upcase}_BAR")
draw_gradient_bar(x, y + 18, stat, 999, bar_type, 190, 8, hue)
trick_bars_base_parameter(actor, x, y, type)
end
end
class Game_Actor
#--------------------------------------------------------------------------
# * Get the current EXP
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get the next level's EXP
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end
This obviously, in case you couldnt tell, requires SDK so keep that in mind if you have scripts that dont work with the SDK. The gradients are also attached just place those in the graphics folder.
Comments And Questions Please!