Okay, the thing is that when i open my menu once it works fine, but when i try to open it again afterwards...hole game crashes. so what should i do?
I think it´s in my menu system. there is only one script that isn´t in the RTP: COGWHEEL Plug 'n' Play Menu Bars. And here´s the script
I think it´s in my menu system. there is only one script that isn´t in the RTP: COGWHEEL Plug 'n' Play Menu Bars. And here´s the script
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# Lisätään map_name, jota käytetään kartan nimen näyttämiseen
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# Luodaan muuttuja map_name, johon tallennetaan kartan nimi
#--------------------------------------------------------------------------
attr_reader :map_name # Paikan nimi
def map_name
@map_name = load_data("Data/MapInfos.rxdata")[$game_map.map_id].name # kartan nimi
end
end
#==============================================================================
# ** Window_Location
#------------------------------------------------------------------------------
# Luodaan uusi luokka kartan nimen näyttämistä varten, ja annetaan nimeksi
# Window_Location. Kartan nimi luetaan muuttujasta map_name
#==============================================================================
class Window_Location < Window_Base
#--------------------------------------------------------------------------
# Alustetaan
#--------------------------------------------------------------------------
def initialize
super(0, 0, 300, 116)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# Päivitetään normaalisti
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, -4, 265, 95, $game_map.map_name.to_s, 1)
end
end
#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
# This window displays amount of gold.
#==============================================================================
class Window_Gold < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
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(124-cx, 0, cx, 32, $data_system.words.gold, 2)
end
end
#==============================================================================
# ** Window_PlayTime
#------------------------------------------------------------------------------
# This window displays play time on the menu screen.
#==============================================================================
class Window_PlayTime < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Play Time")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, text, 2)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#==============================================================================
# ** Window_Steps
#------------------------------------------------------------------------------
# This window displays step count on the menu screen.
#==============================================================================
class Window_Steps < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Step Count")
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, $game_party.steps.to_s, 2)
end
end
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 340, 480)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 64
y = i * 116
actor = $game_party.actors
draw_actor_graphic(actor, x - 50, y + 75)
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 114, y)
draw_actor_level(actor, x - 36, y + 32)
draw_actor_state(actor, x + 27, y + 32)
draw_actor_exp(actor, x - 50, y + 70)
draw_actor_hp(actor, x + 100, y + 26)
draw_actor_sp(actor, x + 100, y + 55)
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
end
#==============================================================================
# ** COGWHEEL Plug 'n' Play Menu Bars (based on Syvkal's revisions)
#-------------------------------------------------------------------------------
# by DerVVulfman
# Version 1.1
# 06-28-06
#------------------------------------------------------------------------------
# This is a revision of Cogwheel's famous bargraph system, now set as an inser-
# table script to display bargraphs behind values in the menus.
#
# To prevent conflict with Cogwheel's RTAB system, two key definitions have been
# renamed: "gauge_rect" to "cw_gauge" & "gradation_rect" to "cw_grad_rect."
#
#
# Affected Systems: Main Menu
# Skill Menu
# Status Menu
# Hero Select Menu (for Items & Skills)
# Equipment Menu
# BattleStatus Menu
#
# The system uses a series of CONSTANTS that can be edited here. They control
# the basic gauge colors and the manner the gauge is filled:
# Gauge Border Colors
COG_COLOR1 = Color.new(0, 0, 0, 192) # Outer Border
COG_COLOR2 = Color.new(255, 255, 192, 192) # Inner Border
# Gauge Empty filler
COG_COLOR3 = Color.new(0, 0, 0, 192) # Half of Inner Shading
COG_COLOR4 = Color.new(64, 0, 0, 192) # Half of Inner Shading
# Alignment
COG_ALIGN1 = 1 # Type 1: (0: Left / 1: Center / 2: Right Justify)
COG_ALIGN2 = 2 # Type 2: (0: Upper / 1: Central / 2: Lower)
COG_ALIGN3 = 0 # FILL ALIGNMENT (0: Left Justify / 1: Right Justify)
# Gauge Settings
COG_GRADE1 = 1 # EMPTY gauge (0: Side / 1: Vertical / 2: Slanted)
COG_GRADE2 = 0 # FILLER gauge (0: Side / 1: Vertical / 2: Slanted)
#==============================================================================
# ** 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 < Game_Battler
#--------------------------------------------------------------------------
# * Get EXP - numeric for calculations
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get Next Level EXP - numeric for calculations
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
#--------------------------------------------------------------------------
# * End of Class
#--------------------------------------------------------------------------
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw EXP w/ Bars
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
alias draw_actor_exp_original draw_actor_exp
def draw_actor_exp(actor, x, y, width = 204)
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
# Calculate Bar Gradiation
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
# Adjust Bar Color based on Gradiation
color1 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
color2 = Color.new(100 - 72 * rate, 240 * rate, 62 * rate, 192)
# Calculate Bar Width
if actor.next_exp != 0
exp = width * actor.now_exp / actor.next_exp
else
exp = width
end
# Draw Bar Graph
cw_gauge(x, y + 25, width, 10, exp, color1, color2)
# Call original EXP
draw_actor_exp_original(actor, x, y)
end
#--------------------------------------------------------------------------
# * Draw HP w/ Bars
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
alias draw_actor_hp_original draw_actor_hp
def draw_actor_hp(actor, x, y, width = 140)
# Calculate Bar Gradiation
if actor.maxhp != 0
rate = actor.hp.to_f / actor.maxhp
else
rate = 0
end
# Adjust Bar Color based on Gradiation
color1 = Color.new(216 - 24 * rate, 0 * rate, 0 * rate, 192)
color2 = Color.new(255 * rate, 165 * rate, 0 * rate, 192)
# Calculate Bar Width
if actor.maxhp != 0
hp = width * actor.hp / actor.maxhp
else
hp = 0
end
# Draw Bar Graph
cw_gauge(x, y + 25, width, 10, hp, color1, color2)
# Call original HP
draw_actor_hp_original(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw SP w/ Bars
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
alias draw_actor_sp_original draw_actor_sp
def draw_actor_sp(actor, x, y, width = 140)
# Calculate Bar Gradiation
if actor.maxsp != 0
rate = actor.sp.to_f / actor.maxsp
else
rate = 1
end
# Adjust Bar Color based on Gradiation
color1 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
color2 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
# Calculate Bar Width
if actor.maxsp != 0
sp = width * actor.sp / actor.maxsp
else
sp = width
end
# Draw Bar Graph
cw_gauge(x + width * 0 / 100, y + 25, width, 10, sp, color1, color2)
# Call original SP
draw_actor_sp_original(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw Parameter w/ Bars
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : parameter type (0-6)
#--------------------------------------------------------------------------
alias draw_actor_parameter_original draw_actor_parameter
def draw_actor_parameter(actor, x, y, type)
# Choose Color & Parameter Type
case type
when 0
e1 = actor.atk
c6 = Color.new(253, 53, 56, 192)
c5 = Color.new(242, 2, 6, 192)
when 1
e1 = actor.pdef
c6 = Color.new(238, 254, 124, 192)
c5 = Color.new(228, 253, 48, 192)
when 2
e1 = actor.mdef
c6 = Color.new(150, 37, 184, 192)
c5 = Color.new(170, 57, 204, 192)
when 3
e1 = actor.str
c6 = Color.new(253, 163, 33, 192)
c5 = Color.new(254, 209, 154, 192)
when 4
e1 = actor.dex
c6 = Color.new(255, 255, 255, 192)
c5 = Color.new(222, 222, 222, 192)
when 5
e1 = actor.agi
c6 = Color.new(124, 254, 155, 192)
c5 = Color.new(33, 253, 86, 192)
when 6
e1 = actor.int
c6 = Color.new(119, 203, 254, 192)
c5 = Color.new(8, 160, 253, 192)
end
# Calculate Bar Gradiation
e2 = 999
if e1.to_f != 0
rate = e1.to_f / e2.to_f
else
rate = 1
end
# Adjust Bar Color based on Gradiation & Parameter Type
for i in 0..7
r = c6.red * rate
g = (c6.green - 10) * rate
b = c6.blue * rate
a = c6.alpha
end
# Calculate Bar Width
width = 168
if e1.to_f != 0
par = width * e1.to_f / e2.to_f
else
par = width
end
# Equipment Calc Fix
case type
when 0
if e1 == 0
par = 0
end
when 1
if e1 == 0
par = 0
end
when 2
if e1 == 0
par = 0
end
end
# Draw Bar Graph
cw_gauge(x , y + 25, width, 7, par, c5, Color.new(r, g, b, a))
# Call Original Parameter
draw_actor_parameter_original(actor, x, y, type)
end
#--------------------------------------------------------------------------
# * Gauge Rectangle (New to Class)
#--------------------------------------------------------------------------
def cw_gauge(x, y, width, height, gauge, color1, color2)
# Use Cogwheel PRESETS
color3 = COG_COLOR1
color4 = COG_COLOR2
color5 = COG_COLOR3
color6 = COG_COLOR4
align1 = COG_ALIGN1
align2 = COG_ALIGN2
align3 = COG_ALIGN3
grade1 = COG_GRADE1
grade2 = COG_GRADE2
# Create Rectangle Width based on gauge max.
rect_width = width
case align1
when 1
x += (rect_width - width) / 2
when 2
x += rect_width - width
end
case align2
when 1
y -= height / 2
when 2
y -= height
end
self.contents.fill_rect(x, y, width, height, color3)
self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color4)
if align3 == 0
if grade1 == 2
grade1 = 3
end
if grade2 == 2
grade2 = 3
end
end
if (align3 == 1 and grade1 == 0) or grade1 > 0
color = color5
color5 = color6
color6 = color
end
if (align3 == 1 and grade2 == 0) or grade2 > 0
color = color1
color1 = color2
color2 = color
end
self.contents.cw_grad_rect(x + 2, y + 2, width - 4, height - 4, color5, color6, grade1)
if align3 == 1
x += width - gauge
end
self.contents.cw_grad_rect(x + 2, y + 2, gauge - 4, height - 4, color1, color2, grade2)
end
#--------------------------------------------------------------------------
# * End of Class
#--------------------------------------------------------------------------
end
#==============================================================================
# ** Bitmap
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# * Gradation Rectangle
#--------------------------------------------------------------------------
def cw_grad_rect(x, y, width, height, color3, color4, align = 0)
if align == 0
for i in x...x + width
red = color3.red + (color4.red - color3.red) * (i - x) / (width - 1)
green = color3.green +
(color4.green - color3.green) * (i - x) / (width - 1)
blue = color3.blue +
(color4.blue - color3.blue) * (i - x) / (width - 1)
alpha = color3.alpha +
(color4.alpha - color3.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color3.red +
(color4.red - color3.red) * (i - y) / (height - 1)
green = color3.green +
(color4.green - color3.green) * (i - y) / (height - 1)
blue = color3.blue +
(color4.blue - color3.blue) * (i - y) / (height - 1)
alpha = color3.alpha +
(color4.alpha - color3.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color3.red + (color4.red - color3.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color3.green + (color4.green - color3.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color3.blue + (color4.blue - color3.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color3.alpha + (color4.alpha - color3.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color3.red + (color4.red - color3.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color3.green + (color4.green - color3.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color3.blue + (color4.blue - color3.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color3.alpha + (color4.alpha - color3.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
#--------------------------------------------------------------------------
# * End of Class
#--------------------------------------------------------------------------
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
#Draw Background
@background = Spriteset_Map.new
# Make command window
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Save"
s6 = "End Game"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
@command_window.x = 230 - @command_window.width / 2
@command_window.y = 0
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(4)
end
# Make location window
@location_window = Window_Location.new
@location_window.x = 0
@location_window.y = 225
# Make play time window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 0
@playtime_window.y = 0
# Make steps window
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = 100
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 200
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 300
@status_window.y = 0
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@command_window.dispose
@playtime_window.dispose
@steps_window.dispose
@gold_window.dispose
@location_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@command_window.update
@playtime_window.update
@steps_window.update
@gold_window.update
@location_window.update
@status_window.update
# If command window is active: call update_command
if @command_window.active
update_command
return
end
# If status window is active: call update_status
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Item.new
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 # save
# If saving is forbidden
if $game_system.save_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to save screen
$scene = Scene_Save.new
when 5 # end game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 1 # skill
# If this actor's action limit is 2 or more
if $game_party.actors[@status_window.index].restriction >= 2
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to skill screen
$scene = Scene_Skill.new(@status_window.index)
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to equipment screen
$scene = Scene_Equip.new(@status_window.index)
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to status screen
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
# ** Game_Map
#------------------------------------------------------------------------------
# Lisätään map_name, jota käytetään kartan nimen näyttämiseen
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# Luodaan muuttuja map_name, johon tallennetaan kartan nimi
#--------------------------------------------------------------------------
attr_reader :map_name # Paikan nimi
def map_name
@map_name = load_data("Data/MapInfos.rxdata")[$game_map.map_id].name # kartan nimi
end
end
#==============================================================================
# ** Window_Location
#------------------------------------------------------------------------------
# Luodaan uusi luokka kartan nimen näyttämistä varten, ja annetaan nimeksi
# Window_Location. Kartan nimi luetaan muuttujasta map_name
#==============================================================================
class Window_Location < Window_Base
#--------------------------------------------------------------------------
# Alustetaan
#--------------------------------------------------------------------------
def initialize
super(0, 0, 300, 116)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# Päivitetään normaalisti
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, -4, 265, 95, $game_map.map_name.to_s, 1)
end
end
#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
# This window displays amount of gold.
#==============================================================================
class Window_Gold < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
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(124-cx, 0, cx, 32, $data_system.words.gold, 2)
end
end
#==============================================================================
# ** Window_PlayTime
#------------------------------------------------------------------------------
# This window displays play time on the menu screen.
#==============================================================================
class Window_PlayTime < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Play Time")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, text, 2)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#==============================================================================
# ** Window_Steps
#------------------------------------------------------------------------------
# This window displays step count on the menu screen.
#==============================================================================
class Window_Steps < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Step Count")
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, $game_party.steps.to_s, 2)
end
end
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 340, 480)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 64
y = i * 116
actor = $game_party.actors
draw_actor_graphic(actor, x - 50, y + 75)
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 114, y)
draw_actor_level(actor, x - 36, y + 32)
draw_actor_state(actor, x + 27, y + 32)
draw_actor_exp(actor, x - 50, y + 70)
draw_actor_hp(actor, x + 100, y + 26)
draw_actor_sp(actor, x + 100, y + 55)
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
end
#==============================================================================
# ** COGWHEEL Plug 'n' Play Menu Bars (based on Syvkal's revisions)
#-------------------------------------------------------------------------------
# by DerVVulfman
# Version 1.1
# 06-28-06
#------------------------------------------------------------------------------
# This is a revision of Cogwheel's famous bargraph system, now set as an inser-
# table script to display bargraphs behind values in the menus.
#
# To prevent conflict with Cogwheel's RTAB system, two key definitions have been
# renamed: "gauge_rect" to "cw_gauge" & "gradation_rect" to "cw_grad_rect."
#
#
# Affected Systems: Main Menu
# Skill Menu
# Status Menu
# Hero Select Menu (for Items & Skills)
# Equipment Menu
# BattleStatus Menu
#
# The system uses a series of CONSTANTS that can be edited here. They control
# the basic gauge colors and the manner the gauge is filled:
# Gauge Border Colors
COG_COLOR1 = Color.new(0, 0, 0, 192) # Outer Border
COG_COLOR2 = Color.new(255, 255, 192, 192) # Inner Border
# Gauge Empty filler
COG_COLOR3 = Color.new(0, 0, 0, 192) # Half of Inner Shading
COG_COLOR4 = Color.new(64, 0, 0, 192) # Half of Inner Shading
# Alignment
COG_ALIGN1 = 1 # Type 1: (0: Left / 1: Center / 2: Right Justify)
COG_ALIGN2 = 2 # Type 2: (0: Upper / 1: Central / 2: Lower)
COG_ALIGN3 = 0 # FILL ALIGNMENT (0: Left Justify / 1: Right Justify)
# Gauge Settings
COG_GRADE1 = 1 # EMPTY gauge (0: Side / 1: Vertical / 2: Slanted)
COG_GRADE2 = 0 # FILLER gauge (0: Side / 1: Vertical / 2: Slanted)
#==============================================================================
# ** 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 < Game_Battler
#--------------------------------------------------------------------------
# * Get EXP - numeric for calculations
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get Next Level EXP - numeric for calculations
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
#--------------------------------------------------------------------------
# * End of Class
#--------------------------------------------------------------------------
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw EXP w/ Bars
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
alias draw_actor_exp_original draw_actor_exp
def draw_actor_exp(actor, x, y, width = 204)
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
# Calculate Bar Gradiation
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
# Adjust Bar Color based on Gradiation
color1 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
color2 = Color.new(100 - 72 * rate, 240 * rate, 62 * rate, 192)
# Calculate Bar Width
if actor.next_exp != 0
exp = width * actor.now_exp / actor.next_exp
else
exp = width
end
# Draw Bar Graph
cw_gauge(x, y + 25, width, 10, exp, color1, color2)
# Call original EXP
draw_actor_exp_original(actor, x, y)
end
#--------------------------------------------------------------------------
# * Draw HP w/ Bars
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
alias draw_actor_hp_original draw_actor_hp
def draw_actor_hp(actor, x, y, width = 140)
# Calculate Bar Gradiation
if actor.maxhp != 0
rate = actor.hp.to_f / actor.maxhp
else
rate = 0
end
# Adjust Bar Color based on Gradiation
color1 = Color.new(216 - 24 * rate, 0 * rate, 0 * rate, 192)
color2 = Color.new(255 * rate, 165 * rate, 0 * rate, 192)
# Calculate Bar Width
if actor.maxhp != 0
hp = width * actor.hp / actor.maxhp
else
hp = 0
end
# Draw Bar Graph
cw_gauge(x, y + 25, width, 10, hp, color1, color2)
# Call original HP
draw_actor_hp_original(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw SP w/ Bars
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
alias draw_actor_sp_original draw_actor_sp
def draw_actor_sp(actor, x, y, width = 140)
# Calculate Bar Gradiation
if actor.maxsp != 0
rate = actor.sp.to_f / actor.maxsp
else
rate = 1
end
# Adjust Bar Color based on Gradiation
color1 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
color2 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
# Calculate Bar Width
if actor.maxsp != 0
sp = width * actor.sp / actor.maxsp
else
sp = width
end
# Draw Bar Graph
cw_gauge(x + width * 0 / 100, y + 25, width, 10, sp, color1, color2)
# Call original SP
draw_actor_sp_original(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw Parameter w/ Bars
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : parameter type (0-6)
#--------------------------------------------------------------------------
alias draw_actor_parameter_original draw_actor_parameter
def draw_actor_parameter(actor, x, y, type)
# Choose Color & Parameter Type
case type
when 0
e1 = actor.atk
c6 = Color.new(253, 53, 56, 192)
c5 = Color.new(242, 2, 6, 192)
when 1
e1 = actor.pdef
c6 = Color.new(238, 254, 124, 192)
c5 = Color.new(228, 253, 48, 192)
when 2
e1 = actor.mdef
c6 = Color.new(150, 37, 184, 192)
c5 = Color.new(170, 57, 204, 192)
when 3
e1 = actor.str
c6 = Color.new(253, 163, 33, 192)
c5 = Color.new(254, 209, 154, 192)
when 4
e1 = actor.dex
c6 = Color.new(255, 255, 255, 192)
c5 = Color.new(222, 222, 222, 192)
when 5
e1 = actor.agi
c6 = Color.new(124, 254, 155, 192)
c5 = Color.new(33, 253, 86, 192)
when 6
e1 = actor.int
c6 = Color.new(119, 203, 254, 192)
c5 = Color.new(8, 160, 253, 192)
end
# Calculate Bar Gradiation
e2 = 999
if e1.to_f != 0
rate = e1.to_f / e2.to_f
else
rate = 1
end
# Adjust Bar Color based on Gradiation & Parameter Type
for i in 0..7
r = c6.red * rate
g = (c6.green - 10) * rate
b = c6.blue * rate
a = c6.alpha
end
# Calculate Bar Width
width = 168
if e1.to_f != 0
par = width * e1.to_f / e2.to_f
else
par = width
end
# Equipment Calc Fix
case type
when 0
if e1 == 0
par = 0
end
when 1
if e1 == 0
par = 0
end
when 2
if e1 == 0
par = 0
end
end
# Draw Bar Graph
cw_gauge(x , y + 25, width, 7, par, c5, Color.new(r, g, b, a))
# Call Original Parameter
draw_actor_parameter_original(actor, x, y, type)
end
#--------------------------------------------------------------------------
# * Gauge Rectangle (New to Class)
#--------------------------------------------------------------------------
def cw_gauge(x, y, width, height, gauge, color1, color2)
# Use Cogwheel PRESETS
color3 = COG_COLOR1
color4 = COG_COLOR2
color5 = COG_COLOR3
color6 = COG_COLOR4
align1 = COG_ALIGN1
align2 = COG_ALIGN2
align3 = COG_ALIGN3
grade1 = COG_GRADE1
grade2 = COG_GRADE2
# Create Rectangle Width based on gauge max.
rect_width = width
case align1
when 1
x += (rect_width - width) / 2
when 2
x += rect_width - width
end
case align2
when 1
y -= height / 2
when 2
y -= height
end
self.contents.fill_rect(x, y, width, height, color3)
self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color4)
if align3 == 0
if grade1 == 2
grade1 = 3
end
if grade2 == 2
grade2 = 3
end
end
if (align3 == 1 and grade1 == 0) or grade1 > 0
color = color5
color5 = color6
color6 = color
end
if (align3 == 1 and grade2 == 0) or grade2 > 0
color = color1
color1 = color2
color2 = color
end
self.contents.cw_grad_rect(x + 2, y + 2, width - 4, height - 4, color5, color6, grade1)
if align3 == 1
x += width - gauge
end
self.contents.cw_grad_rect(x + 2, y + 2, gauge - 4, height - 4, color1, color2, grade2)
end
#--------------------------------------------------------------------------
# * End of Class
#--------------------------------------------------------------------------
end
#==============================================================================
# ** Bitmap
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# * Gradation Rectangle
#--------------------------------------------------------------------------
def cw_grad_rect(x, y, width, height, color3, color4, align = 0)
if align == 0
for i in x...x + width
red = color3.red + (color4.red - color3.red) * (i - x) / (width - 1)
green = color3.green +
(color4.green - color3.green) * (i - x) / (width - 1)
blue = color3.blue +
(color4.blue - color3.blue) * (i - x) / (width - 1)
alpha = color3.alpha +
(color4.alpha - color3.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color3.red +
(color4.red - color3.red) * (i - y) / (height - 1)
green = color3.green +
(color4.green - color3.green) * (i - y) / (height - 1)
blue = color3.blue +
(color4.blue - color3.blue) * (i - y) / (height - 1)
alpha = color3.alpha +
(color4.alpha - color3.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color3.red + (color4.red - color3.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color3.green + (color4.green - color3.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color3.blue + (color4.blue - color3.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color3.alpha + (color4.alpha - color3.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color3.red + (color4.red - color3.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color3.green + (color4.green - color3.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color3.blue + (color4.blue - color3.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color3.alpha + (color4.alpha - color3.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
#--------------------------------------------------------------------------
# * End of Class
#--------------------------------------------------------------------------
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
#Draw Background
@background = Spriteset_Map.new
# Make command window
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Save"
s6 = "End Game"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
@command_window.x = 230 - @command_window.width / 2
@command_window.y = 0
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(4)
end
# Make location window
@location_window = Window_Location.new
@location_window.x = 0
@location_window.y = 225
# Make play time window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 0
@playtime_window.y = 0
# Make steps window
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = 100
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 200
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 300
@status_window.y = 0
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@command_window.dispose
@playtime_window.dispose
@steps_window.dispose
@gold_window.dispose
@location_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@command_window.update
@playtime_window.update
@steps_window.update
@gold_window.update
@location_window.update
@status_window.update
# If command window is active: call update_command
if @command_window.active
update_command
return
end
# If status window is active: call update_status
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Item.new
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 # save
# If saving is forbidden
if $game_system.save_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to save screen
$scene = Scene_Save.new
when 5 # end game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 1 # skill
# If this actor's action limit is 2 or more
if $game_party.actors[@status_window.index].restriction >= 2
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to skill screen
$scene = Scene_Skill.new(@status_window.index)
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to equipment screen
$scene = Scene_Equip.new(@status_window.index)
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to status screen
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end