#==============================================================================## AWESOMEGUY-TITLE ##==============================================================================## Authors : Rikifive (original author), ## KockaAdmiralac (bug fixer) ## Sixth (bug fixer) ## Date : 12/09/15 (12. September 2015.) ## Version : 1.0 ## Support :
https://forums.rpgmakerweb.com/inde...w-to-add-a-command-to-the-title-screen.44522/ ##------------------------------------------------------------------------------## ▼ Description ▼ ##------------------------------------------------------------------------------## ## This script is for adding the "Controls" command to the title screen that ## calls the make-it-yourself scene. ## ##------------------------------------------------------------------------------## ▼ Installation ▼ ##------------------------------------------------------------------------------## ## Put this script below Materials, but above "▼ Main" ## ## If you want to edit the make-it-yourself scene and window, do as following : ## 1) Open the Script Editor (F11) ## 2) Enter the AWESOMEGUY-TITLE script. ## 3) Click CTRL+F ## 4) Search for "EDIT-S-01" or "EDIT-S-02" (without quotes) ## - EDIT-S-01 is for changing the on-click handle ## - EDIT-S-02 is for changing the window display ## 5) Follow the instructions given at those lines. ## ##------------------------------------------------------------------------------## ▼ Requirements ▼ ##------------------------------------------------------------------------------## ## It is specifically made for RPG Maker VX Ace (RGSS3), ## and it is unlikely it will work on any other engine. ## ##------------------------------------------------------------------------------## ▼ Version History ▼ ##------------------------------------------------------------------------------## Version | Date | Description ##_________|__________|_________________________________________________________## 1.0 | 12/09/15 | Initial release. ##------------------------------------------------------------------------------## ▼ Examples ▼ ##------------------------------------------------------------------------------## ## If you need some examples, I'll put them here. ## ##------------------------------------------------------------------------------## ▼ Compatibility ▼ ##------------------------------------------------------------------------------## ## This script ALIASES the following methods : ## - Window_TitleCommand ## - make_command_list ## - Scene_Title ## - create_command_window ## ## This script does not OVERRIDE any mathods. ## ## Compatibility note : ## What does this mean? ## When a script is ALIASING a method, that means, that script is ment to ## be put BELOW a script that OVERWRITES that method. ## If there are two scripts that OVERWRITE the same method, only one of ## them will work, and that may cause bugs and crashes. ## ## This script has no known compatibility bugs. ## ##==============================================================================#module AWESOMEGUY # DO NOT REMOVE module TITLE # DO NOT REMOVE#==============================================================================## ▼ CONFIGURATION OPTIONS ▼ ##------------------------------------------------------------------------------## You can edit between lines with ▼ and lines with ▲, and above SCRIPT ##==============================================================================## COMMAND - Hash for editing the "Controls" commandCOMMAND = { :name => "Controls", # This is the text that will be displayed on the command. :index => 3, # This is the place where command will be shown, if it's 3, it will show in the 3rd place}# The setting of the window# [x, y, width, height, opacity]WINDOW = [0, 0, 100, 100, 0]# The picture that should be used as a custom background.# Set to nil to disable.CUSTOM_BACKGROUND = "Your custom background"# Number of items.ITEMS = 3# Number of columns.COLUMNS = 1#==============================================================================## ▼ SCRIPT ▼ ##------------------------------------------------------------------------------## Editing stuff below this point is not recommended unless noted otherwise. ##==============================================================================# endend#==============================================================================# ** Window_TitleCommand#------------------------------------------------------------------------------# This window is for selecting New Game/Continue on the title screen.#==============================================================================class Window_TitleCommand < Window_Command include AWESOMEGUY::TITLE #-------------------------------------------------------------------------- # * Aliases #-------------------------------------------------------------------------- alias :add_control_command8632 :make_command_list #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list # By : Sixth add_control_command8632 controlcomm = { :name => COMMAND[:name], # The name of the command button. :symbol=> :controls, # The symbol used for the handler. :enabled => true, # Enable check, can be any method that return true/false. :ext => nil # Extra data, can be anything, literally. } @list.insert(COMMAND[:index] - 1, controlcomm) endend#==============================================================================# ** Scene_Title#------------------------------------------------------------------------------# This class performs the title screen processing.#==============================================================================class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # * Aliases #-------------------------------------------------------------------------- alias :awesomeguy_random_alias_create_command_window_eB2z :create_command_window #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window awesomeguy_random_alias_create_command_window_eB2z @command_window.set_handler
🙂controls, method
🙂command_controls)) end #-------------------------------------------------------------------------- # * [Controls] Command #-------------------------------------------------------------------------- def command_controls SceneManager.call(Scene_Controls) endend#==============================================================================# ** Scene_Title#------------------------------------------------------------------------------# This class is your make-it-yourself scene.#==============================================================================class Scene_Controls < Scene_MenuBase include AWESOMEGUY::TITLE #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start super create_controls_window end #-------------------------------------------------------------------------- # * Create Controls Window #-------------------------------------------------------------------------- def create_controls_window @controls_window = Window_Controls.new @controls_window.set_handler
🙂cancel, method
🙂return_scene)) @controls_window.set_handler
🙂ok, method
🙂on_control_ok)) @controls_window.activate.select(0) end #-------------------------------------------------------------------------- # * Control [OK] #-------------------------------------------------------------------------- def on_control_ok#==============================================================================## EDITABLE PART (EDIT-S-01) ##==============================================================================# # This part will handle when you click on an item in your window. # You must enter your Ruby code here, but if you don't know what, # feel free to ask.#==============================================================================## STOP EDITING HERE ##==============================================================================# end #-------------------------------------------------------------------------- # * Create Background #-------------------------------------------------------------------------- def create_background if(CUSTOM_BACKGROUND) @background_sprite = Sprite.new @background_sprite.bitmap = Cache.picture(CUSTOM_BACKGROUND) else super end end # And yeah,
@Rikifive, don't worry about the disposal. # It's automatical. # Of course, not all Sprites are disposed automatically, but since this scene is # inheriting from Scene_MenuBase, there is a method that disposes # @background_sprite. And note it MUST be named @background_sprite.end#==============================================================================# ** Window_Controls#------------------------------------------------------------------------------# This class is your make-it-yourself window.#==============================================================================class Window_Controls < Window_Selectable include AWESOMEGUY::TITLE #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(WINDOW[0], WINDOW[1], WINDOW[2], WINDOW[3]) self.opacity = WINDOW[4] refresh end #-------------------------------------------------------------------------- # * Get Number of Items #-------------------------------------------------------------------------- def item_max; ITEMS; end #-------------------------------------------------------------------------- # * Get Digit Count #-------------------------------------------------------------------------- def col_max; COLUMNS; end #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index)#==============================================================================## EDITABLE PART (EDIT-S-02) ##==============================================================================# # do your magic here # for example to draw text write this: # draw_text(X, Y, WIDTH, HEIGHT, "ENTER YOUR TEXT HERE") # or for icon: # draw_icon(ID, X, Y) # Change X, Y, WIDTH adn HEIGHT to numbers and set them to your liking. # EXAMPLE #change_color(text_color(6)) #draw_text(80, 20, 200, 24, "Action / Interact") #draw_icon(1, 50, 20) #Here put Z icon #draw_text(80, 60, 200, 24, "Back / Cancel") #draw_icon(2, 50, 60) #here put X icon # PUT STUFF BELOW # NOTE (from KockaAdmiralac): When using those commands, don't use X and Y like # direct numbers. Use rect.x and rect.y like this : # draw_icon(123, rect.x, rect.y) # draw_text_ex(rect.x, rect.y, "Some text") #==============================================================================## NO MORE EDITING FOR TODAY! ##==============================================================================# endend#==============================================================================## ■ END OF SCRIPT ■ ##==============================================================================#