How do I add an option in the title for instructions? Like I want it to have text saying the instructions of the game (option like “start, load, and shutdown”)
Add instructions in rpg maker title
RPG Maker XP SupportYou'd have to alter Scene_Title to do that. The first change would have to be done inside the main method. Then you'd need to add an extra option for the case statement in the update method.
I already added the option, the problem is, how do I type the instructions in text?
You have 3 options here.
- Custom images
- Message boxes
- Custom Script
I would like the 3rd option, I want to know
Ok... this would be the first step. Let's see if you get a grasp on it.
Inside a method (def some_name) you can use a local variable (i_am_variable) and set it to "any text you can come up with."
text = "Text"
or
lines = ["First line", "Second line", "Third line"]
Inside a method (def some_name) you can use a local variable (i_am_variable) and set it to "any text you can come up with."
text = "Text"
or
lines = ["First line", "Second line", "Third line"]
So I tried the first few steps, but I don’t understand the variable thing (or the text and the lines)
Let me leave an example here.
There I created a custom scene called Scene_Help. It will ask you to pass an array of texts. I mean, you type in a list of "text messages" in a row. Or you can define an array or two first and then pass them as arguments.
During gameplay, you'll see how a new black screen with a dialog window similar to the typical message window will show up at the very bottom of the scene.
Inside the initialize method, you can find a "No more messages left." string that will get added to the end of the array. If you hit the OK button after reading it, the scene will be closed immediately.
Ruby:
class Scene_Help
def initialize(*new_messages)
@texts = new_messages
@texts << ["No more messages left."]
end
def main
start
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
terminate
end
def start
@width = 640 - 32
@height = 160 - 32
@help_window = Window_Base.new(0, 320, @width + 32, @height + 32)
@help_window.contents = Bitmap.new(@width, @height)
draw_help
end
def draw_help
@help_window.contents.clear
return if @texts.empty?
lines = @texts.shift
lines.each_with_index do |text, n|
@help_window.contents.draw_text(0, n * 32, @width, 32, text)
end
end
def back2map
$scene = Scene_Map.new
end
def terminate
@help_window.dispose
end
def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
back2map
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@texts.any? ? draw_help : back2map
end
end
end
There I created a custom scene called Scene_Help. It will ask you to pass an array of texts. I mean, you type in a list of "text messages" in a row. Or you can define an array or two first and then pass them as arguments.
Ruby:
list1 = ["Hey!", "Back off!", "Beware the dog!"]
list2 = ["Just kidding!", "Don't take it personal"]
$scene = Scene_Help.new(list1, list2)
During gameplay, you'll see how a new black screen with a dialog window similar to the typical message window will show up at the very bottom of the scene.
Inside the initialize method, you can find a "No more messages left." string that will get added to the end of the array. If you hit the OK button after reading it, the scene will be closed immediately.
That actually helped and all! but there is a small problem, every time I press "0" or "x" to return to the main title screen, this pops up.
It's not related to my sample script. I'd need to know how have you altered the Scene_Map and Spriteset_Map scripts to find out what happened there.
Scene_Map:
Spriteset_Map:
Spriteset_Map:
Got it. My test scene was intended to be used after you had picked the new game option. You're using it by choosing your custom help option. Instead of back2map calling a new map scene, let it go to the title scene.
Oh my god it worked! Thank you so much!! By the way, how do I make the text under each other
Ex:
“Hi
Hello
Bye”
Just follow the example I have already provided here. Change the contents of the arrays, and sooner or later you'll learn how to do that.
But I don't really understand the ex. like where do I put the code? do I create another script for it? or do I put it in the same script I'm using? and if I it's in the same script, where should I put it without getting me an error?
Well, if you're only going to use it in the main menu by choosing the help option, then the script would need to be slightly modified first...
Main Menu Version
Above you will find a new Constant called TEXTS. Leave the first line intact. Then play with, I mean, edit the second or third lines as many times as needed till you get used to how to use that array. You can add as many extra lines as needed, by the way.
Main Menu Version
Ruby:
class Scene_Help
TEXTS = []
TEXTS << ["Example Line 1", "Line 2", "Line 3"]
TEXTS << ["No more messages left."]
def main
start
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
terminate
end
def start
@texts = TEXTS.dup
@width = 640 - 32
@height = 160 - 32
@help_window = Window_Base.new(0, 320, @width + 32, @height + 32)
@help_window.contents = Bitmap.new(@width, @height)
draw_help
end
def draw_help
@help_window.contents.clear
return if @texts.empty?
lines = @texts.shift
lines.each_with_index do |text, n|
@help_window.contents.draw_text(0, n * 32, @width, 32, text)
end
end
def go_back
$scene = Scene_Title.new
end
def terminate
@help_window.dispose
end
def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
go_back
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@texts.any? ? draw_help : go_back
end
end
end
Above you will find a new Constant called TEXTS. Leave the first line intact. Then play with, I mean, edit the second or third lines as many times as needed till you get used to how to use that array. You can add as many extra lines as needed, by the way.
Thank you so much!
Original thread: https://forums.rpgmakerweb.com/threads/add-instructions-in-rpg-maker-title.162647/