_________________________________________________________________________________________
__
_________________________________________________________________________________________
__
Well people, I decided to make this tutorial for whose that want to modify the default menu optior or add new options there.
Let's begin:
_________________________________________________________________________________________
__
First, open your project or create a new one then press F11 to the scripts editor show up. After that create a new script section by pressing the mouse right button over main and choosing the insert option.
On the new script section, copy and paste the code below:
Spoiler for :
class Scene_Menu < Scene_Base def create_command_window s1 = Vocab::item s2 = Vocab::skill s3 = Vocab::equip s4 = Vocab::status s5 = Vocab::save s6 = Vocab::game_end s7 = "Options" @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5,s7, s6]) @command_window.index = @menu_index if $game_party.members.size == 0 # If there isn't any party members @command_window.draw_item(0, false) # Disable "Items" @command_window.draw_item(1, false) # Disable "Skills" @command_window.draw_item(2, false) # Disable "Equipments" @command_window.draw_item(3, false) # Disable "Status" end if $game_system.save_disabled # If saving is forbidden @command_window.draw_item(4, false) # Disable "Save" end end end
Explanation of the script above:Firstly acess the class
Scene_Menu ,then we are going to "rewrite" the method
create_command_window.
First you should create 7 local variables, which one storing a value.
s1 = Vocab::item
It means that this variable will have the value of the vocabulary used to name the window.
(Which can be modified on the database, on the system tab),if you write the name:
Item bag , The variable s1 will have the value of the string "Mochila de Itens"
The same occurs with the other variables, except the s7 which you you gave it's own name, in that case it's "Options".
On line 10 we create an variable named:
@command_window and it's values are:
Window_Command.new(160, [s1, s2, s3, s4, s5,s7, s6]) Window_Command is the class responsable for creating the script where you can
choose an option, here the options are the values stored on the
7 lacals variables shown above.( 160 in the window width in pixels!)
On line
11 we determine that the "index",the window indicator(cursor) will start
on the defined variable
@menu_index which by default is 0 (Itens).
But from line
12 till 16 ,determines that if the size of the group "heros" is equal to 0, it'll disable
the following options:
Itens,Skills,Equipments and Status (As there won1t be any hero)
Your menu will look like that:
Menu with a new option: OBS: The line 53 to 71 on the default rmvx scene_menu script, you'll see
that it's very similar to what we have just writeen.
_________________________________________________________________________________________
__
Now paste the script we have written and open the menu,you'll that the option
“Options ” is there on the menu, now click on it.
What happened?
The game over scene appeared when we clicked on the option “options ”, but why? I'll explain soon,but now turn back to the menu and click in the option “
Exit ”,You will see that nothing happens.
Which option on the menu has it's own “
index ”,that is, an indicator.
When the index is on
0 it will open the itens scene, on 1 the skill scene, on 2 the equipment one, on 3 the status one and if it is on 5 it will open the game over screen.
Take a look at the “
array ” that contains the menu options:
@command_window
= Window_Command.new
( 160 , [ s1
, s2
, s3
, s4
, s5
, s7
, s6
] ) Lets start counting the "index" of that “
array ” after the [color="red"]160[/color]:
s1 = 0
s2 = 1
s3 = 2
s4 = 3
s5 = 4
s7 = 5
s6 = 6
Before doing anything, remove the last "end" of the code we created at the start.
Now we will see the method that creates the action depending on our index value:
Obs .: Don't put the code below our script
_________________________________________________________________________________________
__
_________________________________________________________________________________________
__
_________________________________________________________________________________________
__
This code can be read like that:
•
If buttom B is pressed (esc or x) play an SE and return to the map scene.
?
But if if button C(Enter or space)
? And inside this condition
if the group equals
0 and the cursor is shorter than
4 ? If the command window is shorter than
4 plays an error SE.
? Still inside the condition press button :
But if save is disabled and
? if the command window cursor is equal, plays an SE and returns.
?
End of the condition • If press button and none of the conditions above are true, plays an decision SE then continue.
• If the cursos is at:
?
when 0 ? Go to items window
?
when 1 2 e 3 ? Go to chose character window
?
when 4 ? Go to save game
?
when 5 ? Go to end game window
•
end •
end •
end Well what is the array of the indicator when it is over "options"?
And on the refresh of the cursor position when C is pressed (space or Enter) on the cursor 5?( Look at the code to see what happens)
_________________________________________________________________________________________
__
Past the script below the one you have already pasted.
_________________________________________________________________________________________
__
_________________________________________________________________________________________
__
The script now should look like this:
_________________________________________________________________________________________
__
Spoiler for :
1.
class Scene_Menu < Scene_Base def create_command_window s1 = Vocab::item s2 = Vocab::skill s3 = Vocab::equip s4 = Vocab::status s5 = Vocab::save s6 = Vocab::game_end s7 = "Options" @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5,s7, s6]) @command_window.index = @menu_index if $game_party.members.size == 0 @command_window.draw_item(0, false) @command_window.draw_item(1, false) @command_window.draw_item(2, false) @command_window.draw_item(3, false) end if $game_system.save_disabled @command_window.draw_item(4, false) end end def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) if $game_party.members.size == 0 and @command_window.index < 4 Sound.play_buzzer return elsif $game_system.save_disabled and @command_window.index == 4 Sound.play_buzzer return end Sound.play_decision case @command_window.index when 0 # Item $scene = Scene_Item.new when 1,2,3 # Skil,equip,status start_actor_selection when 4 # Save $scene = Scene_File.new(true, false, false) when 5 # End Game $scene = Scene_End.new end end end end
_________________________________________________________________________________________
__
_________________________________________________________________________________________
__
Now we are going to edit the part that when the cursor is over 5 it will open the options window.
First we are going to create the script to show the option, paste the code below in a new script section.
_________________________________________________________________________________________
__
_________________________________________________________________________________________
__
Now back to our script, the menu one and on
line 44 change to the following code:
$scene = Scene_Option.new
Now run the game and choose the option "options" one the menu that is possible to access the options window created by us, get back to the menu and click on the exit option and you'll see that it only plays a SE but it's not working.
Why that?
Options screen: Because on the script that refreshs the cursor position we didn't indicated what happens if it is on the indicator "6",there is only till 5 (
when 5 )
For that open it on
line 44 of our menu script, press enter go to the empty line that should be line 45 and paste there :
_________________________________________________________________________________________
__
_________________________________________________________________________________________
__
Done! Your new option was added on rmvx menu! Just post if you have any question! I'll be glad to answer it^^ Criticizing and comentários are welcome too xD Tutorial by ::. Rafidelis .::
Thanks to a brazilian friend ~ JV ~, by translating the tutorial from Portuguese to English.
_________________________________________________________________________________________
__
_________________________________________________________________________________________
__
[/font]