Hi people! I'm trying to get a CMS for my project and I wish to pack some options into 1 inside of a tab-window, something like this option from Star Ocean CMS
Help much appreciated ^^
EDIT: The Window_Command from my menu is actually on the other side (right-side)
I have this kind of menu in my current project. It's in xp, so I don't know which version you use.
I'm unsure who to give credit to though besides Rafidelis.
The script overrides your standard window script.
The code regarding the pop-up menu can be found on code lines 68 to 73.
Closing the extra menu on 99.
The scenes it directs to are called in 111 to 133.
The pop-up menu is called in 184 to 187.
I'm sorry I can't explain it more thoroughly to you, but I hope it helps.
Code
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
# Modified by Rafidelis
#==============================================================================
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
# Make command window
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Extras"
s6 = "Save"
s7 = "End Game"
s8 = "Summon"
s9 = "Quests"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s8, s6, s9, s5, s7])
@command_window.index = @menu_index
@command_window.height = 225
# 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)
@command_window.disable_item(4)
end
# If save is forbidden
#if $game_system.save_disabled
# Disable save
# @command_window.disable_item(8)
#end
#if number of summons is 0
if $game_party.summons.size < 1
#disable summon
@command_window.disable_item(4)
end
# Make play time window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 0
@playtime_window.y = 224
# Make steps window
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = 320
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 0
@command_window_extra = Window_Command.new(130,["Bestiary","Journal"])
@command_window_extra.x = @command_window.width - 50
@command_window_extra.y = 120
@command_window_extra.z = @command_window.z + @status_window.z
@command_window_extra.active = false
@command_window_extra.visible = false
# 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
@status_window.dispose
@command_window_extra.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@command_window.update
@playtime_window.update
@steps_window.update
@gold_window.update
@status_window.update
@command_window_extra.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
if Input.trigger?(Input::C) and @command_window_extra.active
case @command_window_extra.index
when 0
$scene = Scene_MonsterBook.new
when 1
$scene = Scene_Journal.new
end
elsif Input.trigger?(Input::B) and @command_window_extra.active
@command_window.active = true
@command_window_extra.visible = false
@command_window_extra.active = false
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B) and @command_window_extra.active == false
# 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 < 5
# 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 7 #extras
@command_window.active = false
@command_window_extra.active = true
@command_window_extra.visible = true
when 4
#if number of summons is 0
if $game_party.summons.size < 1
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Summon_Status.new
when 6 #quests
$game_system.se_play($data_system.decision_se)
# Switch to quest screen
$scene = Scene_Questbook.new($scene)
when 5 # 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 8 # 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
class Scene_End
def update
# Update command window
@command_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(6)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # to title
command_to_title
when 1 # shutdown
command_shutdown
when 2 # quit
command_cancel
end
return
end
end
end
class Scene_Save
def on_decision(filename)
# Play save SE
$game_system.se_play($data_system.save_se)
# Write save data
file = File.open(filename, "wb")
write_save_data(file)
file.close
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to menu screen
$scene = Scene_Menu.new(5)
end
def on_cancel
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to menu screen
$scene = Scene_Menu.new(5)
end
end
Thanks a lot! But, I don't know if it is triggered by your piece of script (I copyed the parts you said on my own menu) but an error in line 17 from Window_Base crashed the game (Window_Base 17 NoMethodError- undefined method 'windowskin_name' for nil:NilClass):
class Window_Base < Window
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super()
@windowskin_name = $game_system.windowskin_name <---- this seems to be the conflict
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
self.x = x
self.y = y
self.width = width
self.height = height
self.z = 100
end
The script I gave you doesn't change anything to the way the game calls its windowskin so it shouldn't be giving that error. In fact the script simply calls the game's window methods to draw itself in the same style your menu window should be to prevent discrepancy with the rest of your game.
In human language: The script I gave you, bases itself upon the standard script for its windows so it wouldn't appear different from the rest of your window. That's why it shouldn't be giving that error, unless you have overridden the standard script. (not adjusted it, but overridden)
Are you using any other custom menus and if so, which ones?
#*********************************************************
#Final Fantasy VII menu setup
#*********************************************************
#To use:
#If you do not want Faces, go to line 94
#and change delete the # of draw_actor_graphic
#and put a # infront of draw_actor_face
#
#Create a new folder in the Characters folder, and call it Faces
#Adding faces: add a 80x80 picture with the same name as the characterset it
#corrosponds with in the Faces folder
#========================================
#�ˇ Window_Base
#--------------------------------------------------------------------------------
# Setting functions for the "Base"
#========================================
#========================================
#�ˇ 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_MenuStatus
#------------------------------------------------------------------------------
# Sets up the Choosing.
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 560, 454)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Corbel"
self.contents.font.size = 18
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# Drawing Info on Screen
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 94
y = i * 110
actor = $game_party.actors[i]
draw_actor_face(actor, 12, y + 90) #To get rid of the Face, put a "#" before the draw_ of this line
# draw_actor_graphic(actor, 48, y + 65) #and delete the "#" infront of draw of this line
draw_actor_name(actor, x, y)
draw_actor_level(actor, x + 144, y)
draw_actor_state(actor, x + 280, y )
draw_actor_exp(actor, x+ 144, y + 38)
draw_actor_hp(actor, x, y + 38)
draw_actor_sp(actor, x, y + 58)
end
end
#--------------------------------------------------------------------------
# Update of Cursor
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 110, self.width - 32, 96)
end
end
end
#=======================================#
# �ˇWindow_GameStats #
# written by AcedentProne #
#------------------------------------------------------------------------------#
@command_window_extra = Window_Command.new(160,["Bestiary", "Quest", "Journal", "Achieve.", "Guide", "Load"]
@command_window_extra.x = @command_window.width - 50
@command_window_extra.y = 120
@command_window_extra.z = @command_window.z + @status_window.z
@command_window_extra.active = false
@command_window_extra.visible = false
end
#--------------------------------------------------------------------------
# Update of The count
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
#==============================================================================
# �ˇ Window_Mapname
#------------------------------------------------------------------------------
# �@Draws the Map name
#==============================================================================
class Window_Mapname < Window_Base
#--------------------------------------------------------------------------
# Set up
#--------------------------------------------------------------------------
def initialize
super(0, 0, 320, 44)
self.contents = Bitmap.new(width - 60, height - 32)
self.contents.font.name = "Corbel"
self.contents.font.size = 17
refresh
end
#--------------------------------------------------------------------------
# Draws info on screen
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# Map Name
#map = $game_map.name
self.contents.font.color = system_color
self.contents.draw_text(4, -10, 220, 32, "Location")
self.contents.font.color = normal_color
self.contents.draw_text(175, -10, 80, 32, $game_map.name)
end
end
#==============================================================================
# �ˇ Scene_Menu
#------------------------------------------------------------------------------
# FF7 menu layout as requested by AcedentProne.
#==============================================================================
class Scene_Menu
#--------------------------- edit-------------------------------
attr_reader :status_window
#/--------------------------- edit-------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
def main
#--------------------------- edit-------------------------------
# Command menu
@command_window = Window_MenuIcons.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10])
@command_window.x = 640 - @command_window.width
@command_window.y = 480
@command_window.z = 110
@command_window.index = @menu_index
#If certain options are avaliable
if $game_party.actors.size == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
@command_window.disable_item(5)
end
if $game_party.actors.size <= 1 #
@command_window.disable_item(7)
end
if $game_system.save_disabled
@command_window.disable_item(6)
end
#Showing location window
@map = Window_Mapname.new
@map.x = 640 - @map.width
@map.y = 0 - @map.height - 1
@map.z = 110
#Showing the game stats
@game_stats_window = Window_GameStats.new
@game_stats_window.x = 0 - @game_stats_window.width
@game_stats_window.y = 480 - @map.height - @game_stats_window.height
@game_stats_window.z =110
#Showing the Menu Status window
@status_window = Window_MenuStatus.new
@status_window.x = 640
@status_window.y = 8
@status_window.z = 100
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@game_stats_window.dispose
@status_window.dispose
@map.dispose
@command_window_extra.dispose
end
#--------------------------------------------------------------------------
#Defining the delay
#--------------------------------------------------------------------------
def delay(seconds)
for i in 0...(seconds * 1)
sleep 0.01
Graphics.update
end
end
#--------------------------------------------------------------------------
# Updating
#--------------------------------------------------------------------------
def update
@command_window.update
@game_stats_window.update
@status_window.update
@map.update
@command_window_extra.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
if Input.trigger?(Input::C) and @command_window_extra.active
case @command_window_extra.index
when 0 #Bestiary
$game_system.se_play($data_system.decision_se)
$scene = Scene_Bestiary.new
when 1 #Quest
$game_system.se_play($data_system.decision_se)
$scene = Scene_Quest.new
when 2 #Journal
$game_system.se_play($data_system.decision_se)
$scene = Scene_Biography.new
when 3 #Achievements
$game_system.se_play($data_system.decision_se)
$scene = Scene_Achievements.new
when 4 #help
$game_system.se_play($data_system.decision_se)
$scene = Scene_Achievements.new
when 5 #Load
$game_system.se_play($data_system.decision_se)
$scene = Scene_MenuLoad.new
end
#Moving Windows inplace
gamepos = 640 - @game_stats_window.width
mappos = 480 - @map.height - 1
if @command_window.y > 0
@command_window.y -= 60
end
if @game_stats_window.x < gamepos
@game_stats_window.x += 80
end
if @map.y < mappos
@map.y += 80
end
if @status_window.x > 0
@status_window.x -= 80
end
#Saying if options are active
if @command_window.active
update_command
return
end
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# Updating the Command Selection
#--------------------------------------------------------------------------
def update_command
# If B button is pushed
if Input.trigger?(Input::B)
# Plays assigned SE
$game_system.se_play($data_system.cancel_se)
#Looping for moving windows out
loop do
if @command_window.y < 480
@command_window.y += 40
end
if @game_stats_window.x > 0 - @game_stats_window.width
@game_stats_window.x -= 40
end
if @map.y > 0 - @map.height
@map.y -= 40
end
if @status_window.x < 640
@status_window.x += 40
end
delay(0.5)
if @status_window.x >= 640
break
end
end
# Go to Map
$scene = Scene_Map.new
return
end
# If C button is pused
if Input.trigger?(Input::C)
# Checks actor size
if $game_party.actors.size == 0 and @command_window.index < 4
# plays SE
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
loop do
if @command_window.y < 480
@command_window.y += 40
end
if @game_stats_window.x > 0 - @game_stats_window.width
@game_stats_window.x -= 40
end
if @map.y > 0 - @map.height
@map.y -= 40
end
if @status_window.x < 640
@status_window.x += 40
end
delay(0.5)
if @status_window.x >= 640
break
end
end
$scene = Scene_Item.new
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 #Quests; mover de aquí
$game_system.se_play($data_system.decision_se)
$game_temp.quest_menu_calling = true
$scene = Scene_Quests.new
when 5 # limit
# 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 7 # Order
#Change Party Order by Yargovish
$game_system.se_play($data_system.decision_se)
@checker = 0
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 8 # Opciones
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
$scene = Scene_ColorWindow.new
when 6 #extras
@command_window.active = false
@command_window_extra.active = true
@command_window_extra.visible = true
when 9
$game_system.se_play($data_system.decision_se)
loop do
if @command_window.y < 480
@command_window.y += 40
end
if @game_stats_window.x > 0 - @game_stats_window.width
@game_stats_window.x -= 40
end
if @map.y > 0 - @map.height
@map.y -= 40
end
if @status_window.x < 640
@status_window.x += 40
end
delay(0.5)
if @status_window.x >= 640
break
end
end
$scene = Scene_End.new
return
end
end
#--------------------------------------------------------------------------
# Updating Status Screen
#--------------------------------------------------------------------------
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
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
$game_system.se_play($data_system.decision_se)
loop do
if @command_window.y < 480
@command_window.y += 40
end
if @game_stats_window.x > 0 - @game_stats_window.width
@game_stats_window.x -= 40
end
if @map.y > 0 - @map.height
@map.y -= 40
end
if @status_window.x < 640
@status_window.x += 40
end
delay(0.5)
if @status_window.x >= 640
break
end
end
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
loop do
if @command_window.y < 480
@command_window.y += 40
end
if @game_stats_window.x > 0 - @game_stats_window.width
@game_stats_window.x -= 40
end
if @map.y > 0 - @map.height
@map.y -= 40
end
if @status_window.x < 640
@status_window.x += 40
end
delay(0.5)
if @status_window.x >= 640
break
end
end
$scene = Scene_Status.new(@status_window.index)
when 5 # limits
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to skill screen
$scene = Scene_LimitMenu.new(@status_window.index)
when 7 #Order
#Change Party Order by Yargovish
$game_system.se_play($data_system.decision_se)
if @checker == 0
@changer = $game_party.actors[@status_window.index]
@where = @status_window.index
@checker = 1
else
$game_party.actors[@where] = $game_party.actors[@status_window.index]
$game_party.actors[@status_window.index] = @changer
@checker = 0
@status_window.refresh
$game_player.refresh #
end
return
end
end
end
end
end
end
EDIT: This problem has already been solved, it was another script indeed, however I still have problems with the code:
I have isolated the script from the rest and I get a different error:
Your error isn't on line 174 as it says. (wish rmxp had intellisense sometimes)
It's on line 173. You forgot to close your round brackets when defining the menu.
This line: @command_window_extra = Window_Command.new(160,["Bestiary", "Quest", "Journal", "Achieve.", "Guide", "Load"]
Has to become: @command_window_extra = Window_Command.new(160,["Bestiary", "Quest", "Journal", "Achieve.", "Guide", "Load"])
That should fix things. Now hope for no more errors ^^