I couldn't think of anything to go between windows and Menu Systems, if you think there should be something in-between these, then just say so
Most scripters start their scripts with comment lines, there are two ways (that I know of) of doing this
One is to put a # at the start of every comment line, note that you can put these after parts in a script on the same line, to explain what each line does, for example
$scene = Scene_Menu.new(3) #Calls the Menu and starts at the 4th option (Will be explained later in the tutorial)
But, you CANNOT use a comment, then use a scripting syntax, e.g.
#To call the menu# $scene = Scene_Menu.new(3)
The syntax itself will be seen as a comment and therefore ignored
To save the time and trouble of putting a # on
every line, most scripters use these
=begin
This begins a section of comments
=end
And this ends it, pretty self-explanatory I think
All scripts released on forums or whatnot should include comments so that the user knows exactly what they're doing
def initializeNow the comments are over, name your scene, for example, the default menu is called Scene_Menu, so we'll call it that.
So, start off with
class Scene_Menu
So that's over and done with, now type def initialize
The way I do my menus (the only way I know) may be different to what other scripters use
So... on the SAME LINE as def initialize, type (menu_index = 0), I think this presets the starting option for when you access the menu, in scripting, most things start at 0, so 0 = 1, 1 = 2, 2 = 3 etc etc etc
So your def initialize should look like this now,
def initialize(menu_index = 0)
Now, you need to define what menu_index actually is, to do this
@menu_index = menu_index
can be used.
Now end your def initialize
So your CMS should look like this now,
class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
end
Short eh?
That's only the very beginning
def mainStart off your def main as, well, def main
Now to make the options for your menu
s1 = "Items"
That would be an option for your menu, keep in mind that the options
here don't start at 0, so s1 would be the first option, you could also put
s1 = $data_system.words.item
This searches the last page of the database for whatever you have named "Items", note that this only works for item, skill and equip, make all your options
Once you're done you should have something like this
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Save"
s6 = "Quit"
Remember that you can add options and remove them as you please, i've no idea why, but the program automatically sees these as menu_index
Now, it's decision time, is your menu not going to cover the whole screen? If so, do you want to see the map instead of blackness? If so, add this line
@spriteset = Spriteset_Map.new
Now, to make your options appear, you need to put them in a window, use this to do that
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
The number is the width (x) of the window, and the options appear at the end, remember to update these whenever you add or remove options
Now to set the index for Window_Command
@command_window.index = @menu_index
This sets Window_Command to menu_index
You can disable options if contitions are not met, like not enough characters
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)
end
The == is not a typo, you need that to determine that if your party has no more, no less than 0 characters then those options will be disabled, notice they start from 0
Now to disable saving
if $game_system.save_disabled
@command_window.disable_item(4)
end
That means that if save is disabled then "Save" will turn grey, you can actually disable it later
@playtime_window = Window_PlayTime.new
@playtime_window.x = #Set the x co-ordinates of where the playtime window will appear
@playtime_window.y = #Set the playtime window's y co-ords
@steps_window = Window_Steps.new
@steps_window.x = #The x co-ords of the steps window
@steps_window.y = #The steps window's y co-ords
@gold_window = Window_Gold.new
@gold_window.x = #The x of the gold window
@gold_window.y = #The y of the gold window
@status_window = Window_MenuStatus.new
@status_window.x = #The x of the menustatus window
@status_window.y = #The y of the menustatus window
Here you can set wher each window goes, and what each window is, a menu only really needs a command_window and a status_window, but you can add or remove windows as you please
Graphics.transition
loop do
Graphics.update
Input.update
update
These lines set the transition
if $scene != self
break
end
end
This means that if the current scene isn't the menu, then loop do breaks
Graphics.freeze
@spriteset.dispose
@command_window.dispose
@playtime_window.dispose
@steps_window.dispose
@gold_window.dispose
@status_window.dispose
end
These lines dispose of all the windows when the menu is exited, you don't need the spriteset line if you didn't add the line earlier, and the end ends def main
def updatedef update
@spriteset.update
@command_window.update
@playtime_window.update
@steps_window.update
@gold_window.update
@status_window.update
Again, don't put the spriteset line if you didn't before
These lines update each window every frame or so I think
if @command_window.active
update_command
return
end
These lines mean that if the cursor is on the command window, then it tells the program to go to the definition of update_command
if @status_window.active
update_status
return
end
end
These lines do the same but for the status window (the window you go to when you are selecting the characters)
And the last end ends def update
def update_commanddef update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
These lines mean that if the cancel button is pressed then you go back to the map
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
These lines mean that if the party has exactly 0 characters and the option you have chosen is less than 4 (starting from 0) Then it plays a buzzer and returns to the command window
case @command_window.index
This line means that the response changes for each option in the command window
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
This is the basic response for a selection, though it can get more advanced than that
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
Those 3 are skill, equip and status, they appear the same, but for the responses, see def update_status
when 4
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
That means that if save is disabled, then it plays a buzzer and returns to the command window
If save is enabled then it goes to the save screen
when 5
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end
This calls the end screen when Quit is selected
Then the ends end everything except class Scene_Menu
def update_statusdef 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
Those lines make it so when the cancel button is pressed and the status screen is active, then it goes back to the command window
if Input.trigger?(Input::C)
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
This makes it go to the skill screen, i've no idea what the first lines under when 1 do...
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
The rest of the lines seem pretty self explanatory, that's the end of Scene_Menu, make sure there are enough ends at the end, you will get a syntax error if there aren't the right number of ends at the end
Showing IconsWhat I do here, is make myself a brand spanking new window with the same co-ordinates as my at the top of my menu, before class Scene_Menu
class Window_Icons < Window_Base
def initialize
super(x position of your command window, y position of you command window, x of your command window, y of you command window)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
Now, like in the Making a Window section, you need to place the icons, like this
def refresh
self.contents.clear
bitmap = RPG::Cache.icon("034-Item03")
self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24), 160)
bitmap = RPG::Cache.icon("044-Skill01")
self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24), 160)
bitmap = RPG::Cache.icon("013-Body01")
self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24), 160)
bitmap = RPG::Cache.icon("Status")
self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24), 160)
bitmap = RPG::Cache.icon("037-Item06")
self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24), 160)
bitmap = RPG::Cache.icon("039-Item08")
self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24), 160)
end
end
Where x and y are the x and y of where you want the icons to appear, if you want you can add a number at the end like I have, to set the opacity (transparency) of the icon
Then, you need to add it into your menu
Before the line that says
@command_window = Window_Command.new
Paste this:
@icon_window = Window_Icon.new
@icon_window.x = !!!
@icon_window.y = !!!!
Change the !!! to the x co-ordinates of your command windowand change !!!! to the y co-ordinates of it
Then where it says all the crap like:
@command_window.dispose
Insert:
@icon_window.dispose
Then find:
@command_window.update
And add:
@icon_window.update
That should be it, enjoy